From 619d4bb423beda134376d174e2d9241dffd01ba4 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Sun, 12 Oct 2014 18:12:48 +0200 Subject: reproducible: refactor, drop source_stats table for now --- bin/reproducible_build.sh | 5 ++--- bin/reproducible_setup.sh | 5 ----- bin/reproducible_stats.sh | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index 1f5a357d..111e16b5 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -30,6 +30,7 @@ update_sources_table() { (xzcat $TMPFILE | egrep "(^Package:|^Version:)" | sed -s "s#^Version: ##g; s#Package: ##g; s#\n# #g"| while read PKG ; do read VERSION ; echo "$PKG,$VERSION" ; done) > $CSVFILE sqlite3 -csv -init $INIT ${PACKAGES_DB} "DELETE from sources" echo ".import $CSVFILE sources" | sqlite3 -csv -init $INIT ${PACKAGES_DB} + rm $CSVFILE # $TMPFILE is still being used # FIXME: remove TMPFILE too... echo "$(date) Removing duplicate versions from sources db..." for PKG in $(sqlite3 ${PACKAGES_DB} 'SELECT name FROM sources GROUP BY name HAVING count(name) > 1') ; do BET="" @@ -44,7 +45,7 @@ update_sources_table() { sqlite3 -init $INIT ${PACKAGES_DB} "DELETE FROM sources WHERE name = '$PKG' AND version != '$BET'" done echo "$(date) Done removing duplicate versions from sources db..." - # update amount of available packages (for doing statistics later) + # verify duplicate entries have been removed correctly from the db P_IN_TMPFILE=$(xzcat $TMPFILE | grep "^Package:" | cut -d " " -f2 | sort -u | wc -l) P_IN_SOURCES=$(sqlite3 ${PACKAGES_DB} 'SELECT count(name) FROM sources') if [ $P_IN_TMPFILE -ne $P_IN_SOURCES ] ; then @@ -52,8 +53,6 @@ update_sources_table() { echo "DEBUG: P_IN_TMPFILE = $P_IN_TMPFILE" exit 1 fi - sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO source_stats VALUES (\"sid\", \"${P_IN_SOURCES}\")" - rm $CSVFILE # $TMPFILE is still being used } set +x diff --git a/bin/reproducible_setup.sh b/bin/reproducible_setup.sh index f56b0d11..50c7ac44 100755 --- a/bin/reproducible_setup.sh +++ b/bin/reproducible_setup.sh @@ -17,11 +17,6 @@ if [ ! -f ${PACKAGES_DB} ] ; then CHECK (status IN ("blacklisted", "FTBFS","reproducible","unreproducible","404", "not for us")), build_date TEXT NOT NULL, PRIMARY KEY (name))' - sqlite3 ${PACKAGES_DB} ' - CREATE TABLE source_stats - (suite TEXT NOT NULL, - amount INTEGER NOT NULL, - PRIMARY KEY (suite))' sqlite3 ${PACKAGES_DB} ' CREATE TABLE sources (name TEXT NOT NULL, diff --git a/bin/reproducible_stats.sh b/bin/reproducible_stats.sh index 91ab9444..8a84f8be 100755 --- a/bin/reproducible_stats.sh +++ b/bin/reproducible_stats.sh @@ -26,7 +26,7 @@ declare -A SPOKENTARGET LAST24="AND build_date > datetime('now', '-24 hours') " LAST48="AND build_date > datetime('now', '-48 hours') " SUITE=sid -AMOUNT=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT amount FROM source_stats WHERE suite = \"$SUITE\"" | xargs echo) +AMOUNT=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT count(name) FROM sources") ALLSTATES="reproducible FTBR_with_buildinfo FTBR FTBFS 404 not_for_us blacklisted" MAINVIEW="all_abc" ALLVIEWS="last_24h last_48h all_abc" -- cgit v1.2.3-54-g00ecf