summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-02-18 00:36:35 +0100
committerHolger Levsen <holger@layer-acht.org>2015-02-26 17:13:54 +0100
commit65446e9be4491624368111b82f3057a0e29a7569 (patch)
tree105479d80cc1f33f4a90b17be87c6a61e8028b08
parentfda33a4069b4b95fe48035a1cc4350b52d734deb (diff)
downloadjenkins.debian.net-65446e9be4491624368111b82f3057a0e29a7569.tar.xz
reproducible: common: update the init querying to the new schema, querying data only for sid
-rwxr-xr-xbin/reproducible_common.py16
-rwxr-xr-xbin/reproducible_common.sh11
2 files changed, 18 insertions, 9 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index c7b37fc1..daef5857 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -427,12 +427,18 @@ def get_trailing_icon(package, bugs):
conn_db = start_db_connection() # the local sqlite3 reproducible db
conn_udd = start_udd_connection()
-# do the db querying
+# query some data we need everywhere (relative to sid, we care only about sid here)
try:
- amount = int(query_db('SELECT count(name) FROM sources')[0][0])
- count_total = int(query_db('SELECT COUNT(name) FROM source_packages')[0][0])
- count_good = int(query_db('SELECT COUNT(name) FROM source_packages ' + \
- 'WHERE status="reproducible"')[0][0])
+ amount = int(query_db('SELECT count(*) FROM sources WHERE suite="sid"')[0][0])
+ count_total = int(query_db('''SELECT COUNT(*)
+ FROM results AS r JOIN sources AS s
+ ON r.package_id=s.id
+ WHERE s.suite="sid"''')[0][0])
+ count_good = int(query_db('''SELECT COUNT(*)
+ FROM results AS r JOIN sources AS s
+ ON r.package_id=s.id
+ WHERE s.suite="sid"
+ AND r.status="reproducible"''')[0][0])
except sqlite3.OperationalError:
log.critical('Error performing basic queries. You have to setup the ' + \
'database to successfully continue after this point.')
diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh
index e69e03f5..37e4ca6a 100755
--- a/bin/reproducible_common.sh
+++ b/bin/reproducible_common.sh
@@ -88,12 +88,15 @@ init_html() {
SPOKENTARGET["repo_stats"]="statistics about the reproducible builds apt repository"
SPOKENTARGET["pkg_sets"]="statistics about reproducible builds of specific package sets"
SPOKENTARGET["stats"]="various statistics about reproducible builds"
- # query some data we need everywhere
- AMOUNT=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT count(name) FROM sources")
- COUNT_TOTAL=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT COUNT(name) FROM source_packages")
- COUNT_GOOD=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT COUNT(name) FROM source_packages WHERE status = \"reproducible\"")
+ # query some data we need everywhere (relative to sid, we care only about sid here)
+ AMOUNT=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT count(*) FROM sources WHERE suite=\"${SUITE}\"")
+ COUNT_TOTAL=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT COUNT(*) FROM results AS r JOIN sources AS s ON r.package_id=s.id WHERE s.suite=\"${SUITE}\"")
+ COUNT_GOOD=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT COUNT(*) FROM results AS r JOIN sources AS s ON r.package_id=s.id WHERE s.suite=\"${SUITE}\" AND r.status=\"reproducible\"")
+
PERCENT_TOTAL=$(echo "scale=1 ; ($COUNT_TOTAL*100/$AMOUNT)" | bc)
+ if [ -z "${PERCENT_TOTAL}" ]; then PERCENT_TOTAL=0; fi
PERCENT_GOOD=$(echo "scale=1 ; ($COUNT_GOOD*100/$COUNT_TOTAL)" | bc)
+ if [ -z "${PERCENT_GOOD}" ]; then PERCENT_GOOD=0; fi
}
write_page() {