]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
wic: implement binary repeatable disk identifiers
authorSergei Zhmylev <s.zhmylev@yadro.com>
Thu, 13 Oct 2022 11:03:45 +0000 (14:03 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 26 Oct 2022 11:26:16 +0000 (12:26 +0100)
When SOURCE_DATE_EPOCH variable is set, binary repeatable build
is expected. This commit implements reproducable disk identifiers
in such a case using its value as a Random seed.

Signed-off-by: Sergei Zhmylev <s.zhmylev@yadro.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
scripts/lib/wic/plugins/imager/direct.py

index da483daed5f2c9a0f5c591339ec5f38950a723c1..6faa16bf9b89da7d329e0bb2e7017bfba1f363c5 100644 (file)
@@ -310,7 +310,10 @@ class PartitionedImage():
                           # all partitions (in bytes)
         self.ptable_format = ptable_format  # Partition table format
         # Disk system identifier
-        self.identifier = random.SystemRandom().randint(1, 0xffffffff)
+        if os.getenv('SOURCE_DATE_EPOCH'):
+            self.identifier = random.Random(int(os.getenv('SOURCE_DATE_EPOCH'))).randint(1, 0xffffffff)
+        else:
+            self.identifier = random.SystemRandom().randint(1, 0xffffffff)
 
         self.partitions = partitions
         self.partimages = []