[v3,28/31] autobuild-run: modify do_build() to accept outputdir as argument
diff mbox series

Message ID 20190707052831.9469-28-itsatharva@gmail.com
State Superseded
Headers show
Series
  • [v3,01/31] autobuild-run: introduce Builder class
Related show

Commit Message

Atharva Lele July 7, 2019, 5:28 a.m. UTC
Pass outputdir to do_build() so in future patches we can pass
different output directories to increase variance in case of
reproducibility testing.

Signed-off-by: Atharva Lele <itsatharva@gmail.com>
---
 scripts/autobuild-run | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Patch
diff mbox series

diff --git a/scripts/autobuild-run b/scripts/autobuild-run
index acd1547..522421e 100755
--- a/scripts/autobuild-run
+++ b/scripts/autobuild-run
@@ -454,14 +454,14 @@  class Builder:
         log_write(self.log, "INFO: Build is reproducible!")
         return 0
 
-    def do_build(self):
+    def do_build(self, outputdir):
         """Run the build itself"""
 
-        f = open(os.path.join(self.outputdir, "logfile"), "w+")
+        f = open(os.path.join(outputdir, "logfile"), "w+")
         log_write(self.log, "INFO: build started")
 
         cmd = ["nice", "-n", str(self.nice),
-               "make", "O=%s" % self.outputdir,
+               "make", "O=%s" % outputdir,
                "-C", self.srcdir, "BR2_DL_DIR=%s" % self.dldir,
                "BR2_JLEVEL=%s" % self.njobs] \
             + self.make_opts.split()
@@ -473,7 +473,7 @@  class Builder:
         build_monitor = Thread(target=self.stop_on_build_hang,
                                args=(monitor_thread_hung_build_flag,
                                      monitor_thread_stop_flag,
-                                     sub, self.outputdir))
+                                     sub, outputdir))
         build_monitor.daemon = True
         build_monitor.start()
 
@@ -494,7 +494,7 @@  class Builder:
             log_write(self.log, "INFO: build failed [%d]" % ret)
             return -1
 
-        cmd = ["make", "O=%s" % self.outputdir, "-C", self.srcdir,
+        cmd = ["make", "O=%s" % outputdir, "-C", self.srcdir,
                "BR2_DL_DIR=%s" % self.dldir, "legal-info"] \
             + self.make_opts.split()
         ret = subprocess.call(cmd, stdout=f, stderr=f)
@@ -513,7 +513,7 @@  class Builder:
 
         # Start the first build
         log_write(self.log, "INFO: Reproducible Build Test, starting build 1")
-        ret = self.do_build()
+        ret = self.do_build(self.outputdir)
         if ret != 0:
             log_write(self.log, "INFO: build 1 failed, skipping build 2")
             return ret
@@ -527,7 +527,7 @@  class Builder:
 
         # Start the second build
         log_write(self.log, "INFO: Reproducible Build Test, starting build 2")
-        ret = self.do_build()
+        ret = self.do_build(self.outputdir)
         if ret != 0:
             log_write(self.log, "INFO: build 2 failed")
             return ret