Skip to contentSkip to conversation

reproducibility fixes

PATCH New Juro Bystricky 1 participant 9 messages Aug 28, 2017

lore
Share & tools
lore
#0 lore raw

cover reproducibility fixes

Various simple patches that eliminate buildhost references from several packages and improve the reproducibility/determinism when building package/images.

Juro Bystricky (8):
zlib_1.2.11.bb: remove build host references bash.inc: improve reproducibility
flex_2.6.0.bb: remove build host references diffutils_3.6.bb: remove build host references package_manager.py: improve reproducibility eudev_3.2.2: improve reproducibility image_types.bbclass: improve reproducibility of .gz files qemuboot.bbclass: create deterministic qemuboot.conf file

 meta/classes/image_types.bbclass                 |  2 +-
 meta/classes/qemuboot.bbclass                    |  2 +-
 meta/lib/oe/package_manager.py                   |  2 +-
 meta/recipes-core/udev/eudev_3.2.2.bb            |  6 ++++++
 meta/recipes-core/zlib/zlib_1.2.11.bb            |  5 +++++
 meta/recipes-devtools/flex/flex_2.6.0.bb         |  6 +++++-
 meta/recipes-extended/bash/bash.inc              | 22 +++++++++++++++++++---
 meta/recipes-extended/diffutils/diffutils_3.6.bb |  7 ++++++-
 8 files changed, 44 insertions(+), 8 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/8 zlib_1.2.11.bb: remove build host references

Remove build host references from libz-ptest package.

[YOCTO #11668]

---
 meta/recipes-core/zlib/zlib_1.2.11.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-core/zlib/zlib_1.2.11.bb +5 -0
index ba216f67..6410519 100644
@@ -45,6 +45,11 @@ do_install_ptest() {
 	install ${B}/minigzip   ${D}${PTEST_PATH}
 	install ${B}/examplesh  ${D}${PTEST_PATH}
 	install ${B}/minigzipsh ${D}${PTEST_PATH}
+
+	# Remove buildhost references...
+	sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
+		-e 's|${DEBUG_PREFIX_MAP}||g' \
+	 ${D}${PTEST_PATH}/Makefile
 }
 
 # Move zlib shared libraries for target builds to $base_libdir so the library
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/8 bash.inc: improve reproducibility

In reply to Juro Bystricky

Remove all host build references from the following bash packages:
bash-ptest, bash-bashbug, bash-dev, bash-loadable.

[YOCTO #11918]

---
 meta/recipes-extended/bash/bash.inc | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
meta/recipes-extended/bash/bash.inc +19 -3
index 92916d9..f6cb7e4 100644
@@ -48,16 +48,32 @@ do_install_append () {
 	fi
 }
 do_install_append_class-target () {
-	# Clean host path in bashbug
+	# Clean buildhost references in bashbug
 	sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
-		-e "s,-I${WORKDIR}/\S* ,,g" ${D}${bindir}/bashbug
+		-e "s,-I${WORKDIR}/\S* ,,g" \
+		-e 's|${DEBUG_PREFIX_MAP}||g' \
+		${D}${bindir}/bashbug
+
+	# Clean buildhost references in bash.pc
+	sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
+	     ${D}${libdir}/pkgconfig/bash.pc
+
+	# Clean buildhost references in Makefile.inc
+	sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
+		-e 's|${DEBUG_PREFIX_MAP}||g' \
+		-e 's:${HOSTTOOLS_DIR}/::g' \
+		-e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
+		${D}${libdir}/bash/Makefile.inc
 }
 
 do_install_ptest () {
 	make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test
 	cp ${B}/Makefile ${D}${PTEST_PATH}
         sed -i -e 's/^Makefile/_Makefile/' -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
-	    -e "s,${S},,g" -e "s,${B},,g" -e "s,${STAGING_DIR_NATIVE},,g" ${D}${PTEST_PATH}/Makefile
+	    -e 's|${DEBUG_PREFIX_MAP}||g' \
+	    -e "s,${S},,g" -e "s,${B},,g" -e "s,${STAGING_DIR_NATIVE},,g" \
+	    -e 's:${HOSTTOOLS_DIR}/::g' \
+	     ${D}${PTEST_PATH}/Makefile
 }
 
 pkg_postinst_${PN} () {
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/8 flex_2.6.0.bb: remove build host references

In reply to Juro Bystricky

Remove build host references from flex-ptest package.

[YOCTO #11667]

---
 meta/recipes-devtools/flex/flex_2.6.0.bb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta/recipes-devtools/flex/flex_2.6.0.bb +5 -1
index ab35b09..a906fe8 100644
@@ -55,7 +55,11 @@ do_install_ptest() {
 	cp ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/
 	cp -r ${S}/tests/* ${D}${PTEST_PATH}
 	cp -r ${B}/tests/* ${D}${PTEST_PATH}
-	sed -e 's/^Makefile:/_Makefile:/' \
+	sed -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
+	    -e 's|${DEBUG_PREFIX_MAP}||g' \
+	    -e 's:${HOSTTOOLS_DIR}/::g' \
+	    -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
+	    -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \-e 's/^Makefile:/_Makefile:/' \
 	    -e 's/^srcdir = \(.*\)/srcdir = ./' -e 's/^top_srcdir = \(.*\)/top_srcdir = ./' \
 	    -e 's/^builddir = \(.*\)/builddir = ./' -e 's/^top_builddir = \(.*\)/top_builddir = ./' \
 	    -i ${D}${PTEST_PATH}/Makefile
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/8 diffutils_3.6.bb: remove build host references

In reply to Juro Bystricky

Remove build host references from diffutils-ptest package.

---
 meta/recipes-extended/diffutils/diffutils_3.6.bb | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meta/recipes-extended/diffutils/diffutils_3.6.bb +6 -1
index a2ea484..deadd62 100644
@@ -24,7 +24,12 @@ do_install_ptest() {
 	install -D ${S}/build-aux/test-driver $t/build-aux/test-driver
 	cp -r ${S}/tests $t/
 	install ${B}/tests/Makefile $t/tests/
-	sed -e 's|^Makefile:|_Makefile:|' \
+	sed -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
+	    -e 's|${DEBUG_PREFIX_MAP}||g' \
+	    -e 's:${HOSTTOOLS_DIR}/::g' \
+	    -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
+	    -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
+	    -e 's|^Makefile:|_Makefile:|' \
 	    -e 's|bash|sh|' \
 	    -e 's|^top_srcdir = \(.*\)|top_srcdir = ..\/|' \
 	    -e 's|^srcdir = \(.*\)|srcdir = .|' \
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/8 package_manager.py: improve reproducibility

In reply to Juro Bystricky

When creating Packages.gz, do not save the time stamp in the compressed file metadata.

---
 meta/lib/oe/package_manager.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/package_manager.py +1 -1
index d43d729..49058d7 100644
@@ -232,7 +232,7 @@ class DpkgIndexer(Indexer):
 
             cmd = "cd %s; PSEUDO_UNLOAD=1 %s packages . > Packages;" % (arch_dir, apt_ftparchive)
 
-            cmd += "%s -fc Packages > Packages.gz;" % gzip
+            cmd += "%s -fcn Packages > Packages.gz;" % gzip
 
             with open(os.path.join(arch_dir, "Release"), "w+") as release:
                 release.write("Label: %s\n" % arch)
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/8 eudev_3.2.2: improve reproducibility

In reply to Juro Bystricky

Remove all host build references from the eudev-dbg package

---
 meta/recipes-core/udev/eudev_3.2.2.bb | 6 ++++++
 1 file changed, 6 insertions(+)
meta/recipes-core/udev/eudev_3.2.2.bb +6 -0
index 47d958b..fcadfa3 100644
@@ -50,6 +50,12 @@ do_install_append() {
 	rm -f ${D}${base_libdir}/udev/hid2hci
 }
 
+do_install_prepend_class-target () {
+	# Remove references to buildmachine
+	sed -i -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
+		${B}/src/udev/keyboard-keys-from-name.h
+}
+
 INITSCRIPT_NAME = "udev"
 INITSCRIPT_PARAMS = "start 04 S ."
 
Signature · 1 line
2.7.4
#7 lore raw

PATCH 7/8 image_types.bbclass: improve reproducibility of .gz files

In reply to Juro Bystricky

When compressing with "gzip", do not save the time stamp in the compressed file metadata.

---
 meta/classes/image_types.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/image_types.bbclass +1 -1
index e0368c7..9b646e9 100644
@@ -268,7 +268,7 @@ COMPRESSIONTYPES ?= ""
 
 CONVERSIONTYPES = "gz bz2 lzma xz lz4 lzo zip sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum bmap u-boot vmdk vdi qcow2 ${COMPRESSIONTYPES}"
 CONVERSION_CMD_lzma = "lzma -k -f -7 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
-CONVERSION_CMD_gz = "gzip -f -9 -c ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.gz"
+CONVERSION_CMD_gz = "gzip -f -9 -n -c ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.gz"
 CONVERSION_CMD_bz2 = "pbzip2 -f -k ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"
 CONVERSION_CMD_xz = "xz -f -k -c ${XZ_COMPRESSION_LEVEL} ${XZ_THREADS} --check=${XZ_INTEGRITY_CHECK} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.xz"
 CONVERSION_CMD_lz4 = "lz4 -9 -z ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.lz4"
Signature · 1 line
2.7.4
#8 lore raw

PATCH 8/8 qemuboot.bbclass: create deterministic qemuboot.conf file

In reply to Juro Bystricky

The lines in qemuboot.conf are in random order. This patch fixes this by printing the lines in sorted order. This makes it easier to compare two different builds for any differences.

---
 meta/classes/qemuboot.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/qemuboot.bbclass +1 -1
index 0e21fc9..bd2f01d 100644
@@ -87,7 +87,7 @@ python do_write_qemuboot_conf() {
     topdir="%s/"%(d.getVar('TOPDIR')).replace("//","/")
     cf = configparser.ConfigParser()
     cf.add_section('config_bsp')
-    for k in qemuboot_vars(d):
+    for k in sorted(qemuboot_vars(d)):
         # qemu-helper-native sysroot is not removed by rm_work and
         # contains all tools required by runqemu
         if k == 'STAGING_BINDIR_NATIVE':
Signature · 1 line
2.7.4