From a3722c8457f22264c8d2850925addffb01e40e94 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Thu, 15 Oct 2015 10:43:44 +0000 Subject: reproducible: store in the db also the actual build host in stats_build, and rename the current "builder" field to "job", since it contains the jenkins job name and nummber --- bin/reproducible_build.sh | 4 ++-- bin/reproducible_common.py | 4 ++-- bin/reproducible_db_maintenance.py | 22 ++++++++++++++++++++++ bin/reproducible_html_live_status.py | 2 +- bin/reproducible_html_packages.py | 4 ++-- 5 files changed, 29 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index b1d3ebca..2170449c 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -121,8 +121,8 @@ update_db_and_html() { sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration, builder) VALUES ('$SRCPKGID', '$VERSION', '$STATUS', '$DATE', '$DURATION', '$JOB')" || \ sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration, builder) VALUES ('$SRCPKGID', '$VERSION', '$STATUS', '$DATE', '$DURATION', '$JOB')" if [ ! -z "$DURATION" ] ; then # this happens when not 404 and not_for_us - sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration, builder) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$JOB')" || \ - sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration, builder) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$JOB')" + sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration, node1, node2, job) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$NODE1', '$NODE2', '$JOB')" || \ + sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration, node1, node2, job) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$NODE1', '$NODE2', '$JOB')" fi # unmark build since it's properly finished sqlite3 -init $INIT ${PACKAGES_DB} "DELETE FROM schedule WHERE package_id='$SRCPKGID';" || \ diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index 6f2772ba..c3a64299 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -734,10 +734,10 @@ class Package: def _load_history(self): keys = ['build ID', 'version', 'suite', 'architecture', 'result', - 'build date', 'build duration', 'builder'] + 'build date', 'build duration', 'node1', 'node2', 'job'] query = """ SELECT id, version, suite, architecture, status, build_date, - build_duration, builder + build_duration, node1, node2, job FROM stats_build WHERE name='{}' ORDER BY build_date DESC """.format(self.name) results = query_db(query) diff --git a/bin/reproducible_db_maintenance.py b/bin/reproducible_db_maintenance.py index 33cc38be..47b50637 100755 --- a/bin/reproducible_db_maintenance.py +++ b/bin/reproducible_db_maintenance.py @@ -483,6 +483,28 @@ schema_updates = { '''DROP TABLE stats_builds_age;''', '''ALTER TABLE stats_builds_age_tmp RENAME TO stats_builds_age;''', 'INSERT INTO rb_schema VALUES ("22", "' + now + '")'], + 23: [ # save which builders built a package and change the name of the + # field keeping the job name + '''CREATE TABLE stats_build_tmp + (id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + version TEXT NOT NULL, + suite TEXT NOT NULL, + architecture TEXT NOT NULL, + status TEXT NOT NULL, + build_date TEXT NOT NULL, + build_duration TEXT NOT NULL, + node1 TEXT NOT NULL DEFAULT "", + node2 TEXT NOT NULL DEFAULT "", + job TEXT NOT NULL, + UNIQUE (name, version, suite, architecture, build_date))''', + '''INSERT INTO stats_build_tmp (id, name, version, suite, architecture, + status, build_date, build_duration, job) + SELECT id, name, version, suite, architecture, status, build_date, + build_duration, builder FROM stats_build''', + 'DROP TABLE stats_build', + 'ALTER TABLE stats_build_tmp RENAME TO stats_build', + 'INSERT INTO rb_schema VALUES ("23", "' + now + '")'], } diff --git a/bin/reproducible_html_live_status.py b/bin/reproducible_html_live_status.py index 6d51746d..2f044c67 100755 --- a/bin/reproducible_html_live_status.py +++ b/bin/reproducible_html_live_status.py @@ -51,7 +51,7 @@ def generate_live_status_table(arch): query = 'SELECT s.id, s.suite, s.architecture, s.name, s.version, ' + \ 'p.date_build_started, r.status, r.build_duration, ' + \ '(SELECT coalesce(AVG(h.build_duration), 0) FROM stats_build AS h WHERE h.status IN ("reproducible", "unreproducible") AND h.name=s.name AND h.suite=s.suite AND h.architecture=s.architecture) ' + \ - ', p.builder ' + \ + ', p.job ' + \ 'FROM sources AS s JOIN schedule AS p ON p.package_id=s.id LEFT JOIN results AS r ON s.id=r.package_id ' + \ 'WHERE p.date_build_started != "" AND s.architecture="{arch}" ' + \ 'ORDER BY p.date_build_started DESC' diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py index a178330a..ee35072c 100755 --- a/bin/reproducible_html_packages.py +++ b/bin/reproducible_html_packages.py @@ -211,7 +211,7 @@ def gen_suites_links(package, current_suite, current_arch): def gen_history_page(package): keys = ('build date', 'version', 'suite', 'architecture', 'result', - 'build duration', 'builder') + 'build duration', 'node1', 'node2', 'job') try: head = package.history[0] except IndexError: @@ -222,7 +222,7 @@ def gen_history_page(package): html += '{}'.format(i) html += '\n{tab}'.format(tab=tab) for record in package.history: - # huma formatting of build duration + # human formatting of build duration record['build duration'] = convert_into_hms_string( int(record['build duration'])) html += '\n{tab}\n{tab}{tab}'.format(tab=tab) -- cgit v1.2.3-70-g09d2