Skip to contentSkip to conversation

Use jQuery in diffoscope output

PATCH New Joshua Watt 1 participant 3 messages Feb 19, 2020

lore
Share & tools
lore
#0 lore raw

cover Use jQuery in diffoscope output

The diffoscope HTML output has the option of using jQuery to make browsing the output easier. Enable support for this in the reproducible OEQA test.

Joshua Watt (2):
jquery: Add recipe
oeqa: reproducible: Include jquery in results

 meta/conf/distro/include/maintainers.inc     |  1 +
 meta/lib/oeqa/selftest/cases/reproducible.py | 13 +++++++--
 meta/recipes-devtools/jquery/jquery_3.4.1.bb | 29 ++++++++++++++++++++
 3 files changed, 40 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-devtools/jquery/jquery_3.4.1.bb
Signature · 1 line
2.24.1
#1 lore raw

PATCH 1/2 jquery: Add recipe

Adds a recipe that packages jQuery in a manner borrowed from debian. The primary purpose is to make the diffoscope output from the autobuilder easier to navigate.

---
 meta/conf/distro/include/maintainers.inc     |  1 +
 meta/recipes-devtools/jquery/jquery_3.4.1.bb | 29 ++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 meta/recipes-devtools/jquery/jquery_3.4.1.bb
meta/conf/distro/include/maintainers.inc +1 -0
index 4a267faabce..901d607f2ec 100644
@@ -284,6 +284,7 @@ RECIPE_MAINTAINER_pn-iw = "Changhyeok Bae <[email protected]>"
 RECIPE_MAINTAINER_pn-libjpeg-turbo = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER_pn-json-c = "Yi Zhao <[email protected]>"
 RECIPE_MAINTAINER_pn-json-glib = "Yi Zhao <[email protected]>"
+RECIPE_MAINTAINER_pn-jquery = "Joshua Watt <[email protected]>"
 RECIPE_MAINTAINER_pn-kbd = "Alexander Kanavin <[email protected]>"
 RECIPE_MAINTAINER_pn-kern-tools-native = "Bruce Ashfield <[email protected]>"
 RECIPE_MAINTAINER_pn-kernel-devsrc = "Bruce Ashfield <[email protected]>"
meta/recipes-devtools/jquery/jquery_3.4.1.bb new file +29 -0
new file mode 100644
index 00000000000..e1080aec1d1
@@ -0,0 +1,29 @@
+SUMMARY = "jQuery is a fast, small, and feature-rich JavaScript library"
+HOMEPAGE = "https://jquery.com/"
+LICENSE = "MIT"
+SECTION = "devel"
+LIC_FILES_CHKSUM = "file://${WORKDIR}/${BP}.js;startline=8;endline=10;md5=cdb86f5bda90caec023592d2e768357c"
+
+SRC_URI = "\
+    https://code.jquery.com/${BP}.js;name=js \
+    https://code.jquery.com/${BP}.min.js;name=min \
+    https://code.jquery.com/${BP}.min.map;name=map \
+    "
+
+SRC_URI[js.sha256sum] = "5a93a88493aa32aab228bf4571c01207d3b42b0002409a454d404b4d8395bd55"
+SRC_URI[min.sha256sum] = "0925e8ad7bd971391a8b1e98be8e87a6971919eb5b60c196485941c3c1df089a"
+SRC_URI[map.sha256sum] = "8da74aec0fcdd7678a2663b3cc9bafbaf009e6d6929b28bb3dd95bced18206f6"
+
+inherit allarch
+
+do_install() {
+    install -d ${D}${datadir}/javascript/${BPN}/
+    install -m 644 ${WORKDIR}/${BP}.js ${D}${datadir}/javascript/${BPN}/${BPN}.js
+    install -m 644 ${WORKDIR}/${BP}.min.js ${D}${datadir}/javascript/${BPN}/${BPN}.min.js
+    install -m 644 ${WORKDIR}/${BP}.min.map ${D}${datadir}/javascript/${BPN}/${BPN}.min.map
+}
+
+PACKAGES = "${PN}"
+FILES_${PN} = "${datadir}"
+
+BBCLASSEXTEND += "native nativesdk"
Signature · 1 line
2.24.1
#2 lore raw

PATCH 2/2 oeqa: reproducible: Include jquery in results

In reply to Joshua Watt

Includes jquery in the output directory to make the diffoscope output easier to navigate

---
 meta/lib/oeqa/selftest/cases/reproducible.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
meta/lib/oeqa/selftest/cases/reproducible.py +10 -3
index d3fd8c392b8..5d3959be77b 100644
@@ -174,9 +174,10 @@ class ReproducibleTests(OESelftestTestCase):
 
         # Build native utilities
         self.write_config('')
-        bitbake("diffoscope-native diffutils-native -c addto_recipe_sysroot")
+        bitbake("diffoscope-native diffutils-native jquery-native -c addto_recipe_sysroot")
         diffutils_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "diffutils-native")
         diffoscope_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "diffoscope-native")
+        jquery_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "jquery-native")
 
         if self.save_results:
             os.makedirs(self.save_results, exist_ok=True)
@@ -225,8 +226,14 @@ class ReproducibleTests(OESelftestTestCase):
                 os.rmdir(save_dir)
             else:
                 self.logger.info('Running diffoscope')
-                runCmd(['diffoscope', '--no-default-limits', '--exclude-directory-metadata', '--html-dir', 'diff-html', 'reproducibleA', 'reproducibleB'],
-                        native_sysroot=diffoscope_sysroot, ignore_status=True, cwd=os.path.join(save_dir, 'packages'))
+                package_dir = os.path.join(save_dir, 'packages')
+                package_html_dir = os.path.join(package_dir, 'diff-html')
+
+                # Copy jquery to improve the diffoscope output usability
+                self.copy_file(os.path.join(jquery_sysroot, 'usr/share/javascript/jquery/jquery.min.js'), os.path.join(package_html_dir, 'jquery.js'))
+
+                runCmd(['diffoscope', '--no-default-limits', '--exclude-directory-metadata', '--html-dir', package_html_dir, 'reproducibleA', 'reproducibleB'],
+                        native_sysroot=diffoscope_sysroot, ignore_status=True, cwd=package_dir)
 
         if fails:
             self.fail('\n'.join(fails))
Signature · 1 line
2.24.1