diff mbox series

[RFC,07/10] sstatesig/dump_sigs: allow setting output directory explicitly from command line option

Message ID 20240223120134.3713127-7-alex@linutronix.de
State New
Headers show
Series [RFC,01/10] scripts/oe-setup-build: write a build environment initialization one-liner into the build directory | expand

Commit Message

Alexander Kanavin Feb. 23, 2024, 12:01 p.m. UTC
The default (current directory) is unfortunately non-deterministic, as
the operation is performed from bitbake-server and not from bitbake
process directly. If the server was started in a different directory
it will write the files there, and not where bitbake command requesting
those files was started.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/lib/oe/sstatesig.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index e2582917fbd..4c5b168fb3f 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -142,14 +142,19 @@  class SignatureGeneratorOEBasicHashMixIn(object):
         super().set_taskdata(data[3:])
 
     def dump_sigs(self, dataCache, options):
+        outdir = os.getcwd()
+        for o in options:
+            if o.startswith('outdir'):
+                outdir = o.split('=')[1]
+
         if 'lockedsigs' in options:
-            sigfile = os.getcwd() + "/locked-sigs.inc"
+            sigfile = outdir + "/locked-sigs.inc"
             bb.plain("Writing locked sigs to %s" % sigfile)
             self.dump_lockedsigs(sigfile)
         if 'unihash-cache-copy' in options:
-            cachefile = os.getcwd() + "/bb_unihashes.dat"
+            cachefile = outdir + "/bb_unihashes.dat"
             bb.plain("Writing unihash cache to %s" % cachefile)
-            bb.parse.siggen.copy_unitaskhashes(os.getcwd())
+            bb.parse.siggen.copy_unitaskhashes(outdir)
         return super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigs(dataCache, options)