Add a patch to address two determinism issues and allow reproducible
builds.

Also strip full paths we don't need out of some ptest files,
we can use the installed binaries.

Signed-off-by: Richard Purdie <[email protected]>
---
 meta/lib/oeqa/selftest/cases/reproducible.py  |  1 -
 meta/recipes-devtools/qemu/qemu.inc           |  4 ++
 .../qemu/qemu/determinism.patch               | 41 +++++++++++++++++++
 3 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/qemu/qemu/determinism.patch

diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py 
b/meta/lib/oeqa/selftest/cases/reproducible.py
index a510ad5200b..b78f5e1d7f0 100644
--- a/meta/lib/oeqa/selftest/cases/reproducible.py
+++ b/meta/lib/oeqa/selftest/cases/reproducible.py
@@ -41,7 +41,6 @@ exclude_packages = [
        'ovmf-shell-efi',
        'perf',
        'python3-cython',
-       'qemu',
        'ruby-ri-docs'
        ]
 
diff --git a/meta/recipes-devtools/qemu/qemu.inc 
b/meta/recipes-devtools/qemu/qemu.inc
index cb854914b2e..a6dc9416247 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -28,6 +28,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
            file://mingwfix.patch \
            file://mmap.patch \
            file://mmap2.patch \
+           file://determinism.patch \
            
file://0001-tests-meson.build-use-relative-path-to-refer-to-file.patch \
            "
 UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
@@ -57,6 +58,9 @@ do_install_ptest() {
         sed -i -e 's,${HOSTTOOLS_DIR}/python3,${bindir}/python3,' \
             ${D}/${PTEST_PATH}/tests/qemu-iotests/common.env 
        sed -i -e "1s,#!/usr/bin/bash,#!${base_bindir}/bash," 
${D}${PTEST_PATH}/tests/data/acpi/disassemle-aml.sh
+
+       # Strip the paths from the QEMU variable, we can use PATH
+       sed -i -e "s#^QEMU=.*/qemu-#QEMU=qemu-#g" 
${D}${PTEST_PATH}/tests/tcg/*.mak
 }
 
 # QEMU_TARGETS is overridable variable
diff --git a/meta/recipes-devtools/qemu/qemu/determinism.patch 
b/meta/recipes-devtools/qemu/qemu/determinism.patch
new file mode 100644
index 00000000000..cb1c907777f
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/determinism.patch
@@ -0,0 +1,41 @@
+When sources are included within debug information, a couple of areas of the 
+qemu build are not reproducible due to either full buildpaths or timestamps.
+
+Replace the full paths with relative ones. I couldn't figure out how to get
+meson to pass relative paths but we can fix that in the script.
+
+For the keymaps, omit the timestamps as they don't matter to us.
+
+Upstream-Status: Pending [some version of all/part of this may be accepted]
+RP 2021/3/1
+
+Index: qemu-5.2.0/scripts/decodetree.py
+===================================================================
+--- qemu-5.2.0.orig/scripts/decodetree.py
++++ qemu-5.2.0/scripts/decodetree.py
+@@ -1303,8 +1303,8 @@ def main():
+     toppat = ExcMultiPattern(0)
+ 
+     for filename in args:
+-        input_file = filename
+-        f = open(filename, 'r')
++        input_file = os.path.relpath(filename)
++        f = open(input_file, 'r')
+         parse_file(f, toppat)
+         f.close()
+ 
+Index: qemu-5.2.0/ui/keycodemapdb/tools/keymap-gen
+===================================================================
+--- qemu-5.2.0.orig/ui/keycodemapdb/tools/keymap-gen
++++ qemu-5.2.0/ui/keycodemapdb/tools/keymap-gen
+@@ -317,9 +317,8 @@ class LanguageGenerator(object):
+         raise NotImplementedError()
+ 
+     def generate_header(self, database, args):
+-        today = time.strftime("%Y-%m-%d %H:%M")
+         self._boilerplate([
+-            "This file is auto-generated from keymaps.csv on %s" % today,
++            "This file is auto-generated from keymaps.csv",
+             "Database checksum sha256(%s)" % database.mapchecksum,
+             "To re-generate, run:",
+             "  %s" % args,
-- 
2.27.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#148817): 
https://lists.openembedded.org/g/openembedded-core/message/148817
Mute This Topic: https://lists.openembedded.org/mt/81013999/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to