[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] reproducible: Also generate diffoscope .json results.

Holger Levsen gitlab at salsa.debian.org
Wed Nov 28 19:42:15 GMT 2018


Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
1c1e7a27 by Chris Lamb at 2018-11-28T19:41:44Z
reproducible: Also generate diffoscope .json results.

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


7 changed files:

- bin/rblib/const.py
- bin/reproducible.ini
- bin/reproducible_build.sh
- bin/reproducible_common.sh
- bin/reproducible_html_breakages.py
- bin/reproducible_html_packages.py
- mustache-templates/reproducible/package_suitearch_details.mustache


Changes:

=====================================
bin/rblib/const.py
=====================================
@@ -38,6 +38,7 @@ DISTRO_BASE = os.path.join(BASE, conf_distro['distro_root'])
 
 DBD_URI = os.path.join(DISTRO_URI, conf_distro['diffoscope_html'])
 DBDTXT_URI = os.path.join(DISTRO_URI, conf_distro['diffoscope_txt'])
+DBDJSON_URI = os.path.join(DISTRO_URI, conf_distro['diffoscope_json'])
 LOGS_URI = os.path.join(DISTRO_URI, conf_distro['buildlogs'])
 DIFFS_URI = os.path.join(DISTRO_URI, conf_distro['logdiffs'])
 NOTES_URI = os.path.join(DISTRO_URI, conf_distro['notes'])
@@ -48,6 +49,7 @@ HISTORY_URI = os.path.join(DISTRO_URI, conf_distro['pkghistory'])
 BUILDINFO_URI = os.path.join(DISTRO_URI, conf_distro['buildinfo'])
 DBD_PATH = BASE + DBD_URI
 DBDTXT_PATH = BASE + DBDTXT_URI
+DBDJSON_PATH = BASE + DBDJSON_URI
 LOGS_PATH = BASE + LOGS_URI
 DIFFS_PATH = BASE + DIFFS_URI
 NOTES_PATH = BASE + NOTES_URI
@@ -92,6 +94,8 @@ log.debug("DBD_URI:\t\t" + DBD_URI)
 log.debug("DBD_PATH:\t" + DBD_PATH)
 log.debug("DBDTXT_URI:\t" + DBDTXT_URI)
 log.debug("DBDTXT_PATH:\t" + DBDTXT_PATH)
+log.debug("DBDJSON_URI:\t" + DBDJSON_URI)
+log.debug("DBDJSON_PATH:\t" + DBDJSON_PATH)
 log.debug("LOGS_URI:\t" + LOGS_URI)
 log.debug("LOGS_PATH:\t" + LOGS_PATH)
 log.debug("DIFFS_URI:\t" + DIFFS_URI)


=====================================
bin/reproducible.ini
=====================================
@@ -11,6 +11,7 @@ json_out = reproducible.json
 tracker.json_out = reproducible-tracker.json
 diffoscope_html = dbd
 diffoscope_txt = dbdtxt
+diffoscope_json = dbdjson
 buildlogs = logs
 logdiffs = logdiffs
 notes = notes


=====================================
bin/reproducible_build.sh
=====================================
@@ -35,6 +35,7 @@ exit_early_if_debian_is_broken() {
 create_results_dirs() {
 	mkdir -vp $DEBIAN_BASE/dbd/${SUITE}/${ARCH}
 	mkdir -vp $DEBIAN_BASE/dbdtxt/${SUITE}/${ARCH}
+	mkdir -vp $DEBIAN_BASE/dbdjson/${SUITE}/${ARCH}
 	mkdir -vp $DEBIAN_BASE/logs/${SUITE}/${ARCH}
 	mkdir -vp $DEBIAN_BASE/logdiffs/${SUITE}/${ARCH}
 	mkdir -vp $DEBIAN_BASE/rbuild/${SUITE}/${ARCH}
@@ -288,6 +289,10 @@ handle_ftbr() {
 		mv ./$DBDTXT $DEBIAN_BASE/dbdtxt/$SUITE/$ARCH/
 		gzip -9n $DEBIAN_BASE/dbdtxt/$SUITE/$ARCH/$DBDTXT
 	fi
+	if [ -f ./$DBDJSON ] ; then
+		mv ./$DBDJSON $DEBIAN_BASE/dbdjson/$SUITE/$ARCH/
+		gzip -9n $DEBIAN_BASE/dbdjson/$SUITE/$ARCH/$DBDJSON
+	fi
 	calculate_build_duration
 	update_db_and_html "FTBR"
 }
@@ -363,6 +368,7 @@ call_diffoscope_on_changes_files() {
 		-- sh -c "export TMPDIR=$TEMP ; timeout $TIMEOUT diffoscope \
 			--html $TMPDIR/${DBDREPORT} \
 			--text $TMPDIR/$DBDTXT \
+			--json $TMPDIR/$DBDJSON \
 			--profile=- \
 			$TMPDIR/b1/${CHANGES} \
 			$TMPDIR/b2/${CHANGES}" \
@@ -511,6 +517,7 @@ get_source_package() {
 	EVERSION="$(echo $VERSION | cut -d ':' -f2)"  # EPOCH_FREE_VERSION is too long
 	DBDREPORT="${SRCPACKAGE}_${EVERSION}.diffoscope.html"
 	DBDTXT="${SRCPACKAGE}_${EVERSION}.diffoscope.txt"
+	DBDJSON="${SRCPACKAGE}_${EVERSION}.diffoscope.json"
 	BUILDINFO="${SRCPACKAGE}_${EVERSION}_${ARCH}.buildinfo"
 	BUILDINFO_SIGNED="${BUILDINFO}.asc"
 


=====================================
bin/reproducible_common.sh
=====================================
@@ -685,6 +685,7 @@ cleanup_pkg_files() {
 	rm -vf $DEBIAN_BASE/logs/${SUITE}/${ARCH}/${SRCPACKAGE}_*.build?.log{,.gz}
 	rm -vf $DEBIAN_BASE/dbd/${SUITE}/${ARCH}/${SRCPACKAGE}_*.diffoscope.html
 	rm -vf $DEBIAN_BASE/dbdtxt/${SUITE}/${ARCH}/${SRCPACKAGE}_*.diffoscope.txt{,.gz}
+	rm -vf $DEBIAN_BASE/dbdjson/${SUITE}/${ARCH}/${SRCPACKAGE}_*.diffoscope.json{,.gz}
 	rm -vf $DEBIAN_BASE/buildinfo/${SUITE}/${ARCH}/${SRCPACKAGE}_*.buildinfo
 	rm -vf $DEBIAN_BASE/logdiffs/${SUITE}/${ARCH}/${SRCPACKAGE}_*.diff{,.gz}
 }


=====================================
bin/reproducible_html_breakages.py
=====================================
@@ -77,17 +77,17 @@ def not_unrep_with_dbd_file():
     results = query_db(query)
     for pkg, version, suite, arch in results:
         eversion = strip_epoch(version)
-        dbd = DBD_PATH + '/' + suite + '/' + arch + '/' + pkg + '_' + \
-            eversion + '.diffoscope.html'
-        dbdtxt = '{}/{}/{}/{}_{}.diffoscope.txt.gz'.format(
-            DBDTXT_PATH, suite, arch, pkg, eversion)
-        if os.access(dbd, os.R_OK):
-            bad_pkgs.append((pkg, version, suite, arch))
-            log.warning(dbd + ' exists but ' + suite + '/' + arch + '/' + pkg + ' (' + version + ')'
-                        ' is not FTBR.')
-        if os.access(dbdtxt, os.R_OK):
+        for prefix, extension in ((
+            (DBD_PATH, 'html'),
+            (DBDTXT_PATH, 'txt.gz'),
+            (DBDJSON_PATH, 'json.gz'),
+        )):
+            filename = '{}/{}/{}/{}_{}.diffoscope.{}.gz'.format(
+                prefix, suite, arch, pkg, eversion, extension)
+            if not os.access(filename, os.R_OK):
+                continue
             bad_pkgs.append((pkg, version, suite, arch))
-            log.warning(dbdtxt + ' exists but ' + suite + '/' + arch + '/' + pkg + ' (' + version + ')'
+            log.warning(filename + ' exists but ' + suite + '/' + arch + '/' + pkg + ' (' + version + ')'
                         ' is not FTBR.')
     return bad_pkgs
 


=====================================
bin/reproducible_html_packages.py
=====================================
@@ -32,6 +32,7 @@ from rblib.const import (
     HISTORY_PATH, HISTORY_URI,
     NOTES_PATH, NOTES_URI,
     DBDTXT_PATH, DBDTXT_URI,
+    DBDJSON_PATH, DBDJSON_URI,
     DBD_PATH, DBD_URI,
 #    DIFFS_PATH, DIFFS_URI,
 #    LOGS_PATH, LOGS_URI,
@@ -72,6 +73,8 @@ def get_dbd_links(package, eversion, suite, arch):
     dbd_uri -- included only if file for formatted diffoscope results exists
     dbdtxt_uri -- included only if file for unformatted diffoscope results
                   exists
+    dbdjson_uri -- included only if file for JSON-formatted diffoscope results
+                  exists
     dbd_page_uri -- included only if file for formatted diffoscope results
                     (dbd_uri) exists. This uri is a package page with diffoscope
                     results in main iframe by default.
@@ -82,12 +85,16 @@ def get_dbd_links(package, eversion, suite, arch):
                        + '.diffoscope.html')
     dbdtxt_file = os.path.join(DBDTXT_PATH, suite, arch, package + '_' + eversion
                           + '.diffoscope.txt.gz')
+    dbdjson_file = os.path.join(DBDJSON_PATH, suite, arch, package + '_' + eversion
+                          + '.diffoscope.json.gz')
     dbd_page_file = os.path.join(RB_PKG_PATH, suite, arch, 'diffoscope-results',
                                  package + '.html')
     dbd_uri = DBD_URI + '/' + suite + '/' + arch + '/' +  package + '_' + \
               eversion + '.diffoscope.html'
     dbdtxt_uri = DBDTXT_URI + '/' + suite + '/' + arch + '/' +  package + '_' + \
                 eversion + '.diffoscope.txt.gz'
+    dbdjson_uri = DBDJSON_URI + '/' + suite + '/' + arch + '/' +  package + '_' + \
+                eversion + '.diffoscope.json.gz'
     dbd_page_uri = RB_PKG_URI + '/' + suite + '/' + arch + \
                    '/diffoscope-results/' + package + '.html'
     links = {}
@@ -97,6 +104,8 @@ def get_dbd_links(package, eversion, suite, arch):
         links['dbd_page_uri'] = dbd_page_uri
         if os.access(dbdtxt_file, os.R_OK):
             links['dbdtxt_uri'] = dbdtxt_uri
+        if os.access(dbdjson_file, os.R_OK):
+            links['dbdjson_uri'] = dbdjson_uri
 
     # always return dbd_page_file, because we might need to delete it
     links['dbd_page_file'] = dbd_page_file
@@ -152,6 +161,7 @@ def gen_suitearch_details(package, version, suite, arch, status, spokenstatus,
         context['dbd'] = {
             'dbd_page_uri': dbd_links['dbd_page_uri'],
             'dbdtxt_uri': dbd_links.get('dbdtxt_uri', ''),
+            'dbdjson_uri': dbd_links.get('dbdjson_uri', ''),
         }
         default_view = default_view if default_view else dbd_uri
 


=====================================
mustache-templates/reproducible/package_suitearch_details.mustache
=====================================
@@ -15,6 +15,9 @@
       {{#dbdtxt_uri}}
       <a href="{{dbdtxt_uri}}" target="main">(txt)</a>
       {{/dbdtxt_uri}}
+      {{#dbdjson_uri}}
+      <a href="{{dbdjson_uri}}" target="main">(json)</a>
+      {{/dbdjson_uri}}
     </div>
   </li>
   {{/dbd}}



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/1c1e7a274b834f72475c3070377ef576f594472d

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/1c1e7a274b834f72475c3070377ef576f594472d
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20181128/8e31d60d/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list