Skip to contentSkip to conversation

utils/genrandconfig: instantiate SystemInfo() earlier

PATCH New Thomas Petazzoni 2 participants 5 messages Aug 4, 2019 – Aug 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 utils/genrandconfig: instantiate SystemInfo() earlier

In a future patch, we are going to need a SystemInfo() instance in gen_config(), so create the SystemInfo() instance there, and pass it to fixup_config(), where we currently use it.

---
 utils/genrandconfig | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
utils/genrandconfig +4 -3
index aa5e151b7f..859996cfd5 100755
@@ -198,7 +198,7 @@ def is_toolchain_usable(configfile, config):
     return True
 
 
-def fixup_config(configfile):
+def fixup_config(sysinfo, configfile):
     """Finalize the configuration and reject any problematic combinations
 
     This function returns 'True' when the configuration has been
@@ -207,7 +207,6 @@ def fixup_config(configfile):
     generated).
     """
 
-    sysinfo = SystemInfo()
     with open(configfile) as configf:
         configlines = configf.readlines()
 
@@ -331,6 +330,8 @@ def gen_config(args):
     packages.
     """
 
+    sysinfo = SystemInfo()
+
     # Select a random toolchain configuration
     configs = get_toolchain_configs(args.toolchains_csv, args.buildrootdir)
 
@@ -403,7 +404,7 @@ def gen_config(args):
                                "KCONFIG_PROBABILITY=%d" % randint(1, 30),
                                "randpackageconfig"])
 
-        if fixup_config(configfile):
+        if fixup_config(sysinfo, configfile):
             break
 
     subprocess.check_call(["make", "O=%s" % args.outputdir, "-C", args.buildrootdir,
Signature · 1 line
2.21.0
author Applied
#1 lore raw

PATCH 1/2 utils/genrandconfig: instantiate SystemInfo() earlier

Quoted 8 lines · On Sun, 4 Aug 2019 11:13:18 +0200 Thomas Petazzoni…

In a future patch, we are going to need a SystemInfo() instance in gen_config(), so create the SystemInfo() instance there, and pass it to fixup_config(), where we currently use it.

---
 utils/genrandconfig | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

I've applied both patches. Thanks a lot Atharva for the review and testing, much appreciated!

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/2 utils/genrandconfig: instantiate SystemInfo() earlier

In reply to Thomas Petazzoni
Quoted 5 lines · IST Thomas Petazzoni

In a future patch, we are going to need a SystemInfo() instance in gen_config(), so create the SystemInfo() instance there, and pass it to fixup_config(), where we currently use it.

Tested on my machine. Properly outputs a randomly generated config.

Regards,
Atharva Lele

#3 lore raw

PATCH 2/2 utils/genrandconfig: only do reproducible builds with diffoscope

In reply to Thomas Petazzoni

After a few weeks of running reproducible builds in the autobuilders, we found out that such builds without a diffoscope analysis are pretty
useless: the cmp on the tarballs doesn't help us fix the reproducibility issue.

So, let's only do reproducible builds when diffoscope is available.

---
 utils/genrandconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
utils/genrandconfig +2 -2
index 859996cfd5..d6b7fd56b7 100755
@@ -49,7 +49,7 @@ else:
 
 class SystemInfo:
     DEFAULT_NEEDED_PROGS = ["make", "git", "gcc", "timeout"]
-    DEFAULT_OPTIONAL_PROGS = ["bzr", "java", "javac", "jar"]
+    DEFAULT_OPTIONAL_PROGS = ["bzr", "java", "javac", "jar", "diffoscope"]
 
     def __init__(self):
         self.needed_progs = list(self.__class__.DEFAULT_NEEDED_PROGS)
@@ -369,7 +369,7 @@ def gen_config(args):
 
     # Randomly enable BR2_REPRODUCIBLE 10% of times
     # also enable tar filesystem images for testing
-    if randint(0, 10) == 0:
+    if sysinfo.has("diffoscope") and randint(0, 10) == 0:
         configlines.append("BR2_REPRODUCIBLE=y\n")
         configlines.append("BR2_TARGET_ROOTFS_TAR=y\n")
 
Signature · 1 line
2.21.0
#4 lore raw

PATCH 2/2 utils/genrandconfig: only do reproducible builds with diffoscope

Quoted 6 lines · IST Thomas Petazzoni

After a few weeks of running reproducible builds in the autobuilders, we found out that such builds without a diffoscope analysis are pretty
useless: the cmp on the tarballs doesn't help us fix the reproducibility issue.

So, let's only do reproducible builds when diffoscope is available.

That makes sense.

Quoted 2 lines

Tested with and without diffoscope installed. Does not enable BR2_REPRODUCIBLE if diffoscope is not installed.

Regards,
Atharva Lele