From c0464fc8b29ca38374997159e91126c503fc1a22 Mon Sep 17 00:00:00 2001 From: Carlo Landmeter Date: Fri, 6 Mar 2015 08:38:25 +0000 Subject: rename --- apk-content2sqlite.sh | 48 ------------------------------------------------ apkcontent2sqlite.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 48 deletions(-) delete mode 100755 apk-content2sqlite.sh create mode 100755 apkcontent2sqlite.sh diff --git a/apk-content2sqlite.sh b/apk-content2sqlite.sh deleted file mode 100755 index b1a53de..0000000 --- a/apk-content2sqlite.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -base="/var/www/localhost/htdocs/alpine" -#release=$(readlink $base/latest-stable) -release="edge" -repos="main testing" -archs="x86 x86_64 armhf" -output="output.csv" -database="filelist.db" - -create_filelist() { - local apk="$1" repo="$2" arch="$3" - local filelist=$(tar --exclude ".*" -ztf "$apk") - local filename="${apk##*/}" - local pkgname="${filename%-*-*}" - IFS=$'\n' - for item in $filelist; do - file="${item##*/}" - path="${item%/*}" - case "$file" in - *,*) file="\"$file\"" ;; - esac - case "$path" in - *,*) path="\"$path\"" ;; - esac - [ ! -z "$file" ] && \ - echo "$file,$path,$pkgname,$repo,$arch" >> $output - done - unset IFS -} - - -rm -f $output $database - -printf "CREATE TABLE filelist(file varchar(255), path text, pkgname varchar(255), repo varchar(8), arch varchar(8));" | sqlite3 $database - -for repo in $repos; do - for arch in $archs; do - printf "Starting: $repo/$arch" - for apk in $base/$release/$repo/$arch/*.apk; do - printf . - create_filelist "$apk" "$repo" "$arch" - done - printf "\n" - done -done - -printf ".mode csv\n.import $output filelist" | sqlite3 $database diff --git a/apkcontent2sqlite.sh b/apkcontent2sqlite.sh new file mode 100755 index 0000000..b1a53de --- /dev/null +++ b/apkcontent2sqlite.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +base="/var/www/localhost/htdocs/alpine" +#release=$(readlink $base/latest-stable) +release="edge" +repos="main testing" +archs="x86 x86_64 armhf" +output="output.csv" +database="filelist.db" + +create_filelist() { + local apk="$1" repo="$2" arch="$3" + local filelist=$(tar --exclude ".*" -ztf "$apk") + local filename="${apk##*/}" + local pkgname="${filename%-*-*}" + IFS=$'\n' + for item in $filelist; do + file="${item##*/}" + path="${item%/*}" + case "$file" in + *,*) file="\"$file\"" ;; + esac + case "$path" in + *,*) path="\"$path\"" ;; + esac + [ ! -z "$file" ] && \ + echo "$file,$path,$pkgname,$repo,$arch" >> $output + done + unset IFS +} + + +rm -f $output $database + +printf "CREATE TABLE filelist(file varchar(255), path text, pkgname varchar(255), repo varchar(8), arch varchar(8));" | sqlite3 $database + +for repo in $repos; do + for arch in $archs; do + printf "Starting: $repo/$arch" + for apk in $base/$release/$repo/$arch/*.apk; do + printf . + create_filelist "$apk" "$repo" "$arch" + done + printf "\n" + done +done + +printf ".mode csv\n.import $output filelist" | sqlite3 $database -- cgit v1.2.3