summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSergei Zhmylev <s.zhmylev@yadro.com>2022-10-13 14:03:45 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-10-26 12:26:16 +0100
commit2c0c54e12169e76f16fb3398904bc897a9190397 (patch)
tree2aa019474a677638b4def15cb05629f40d9b711f /scripts
parentfedf90d385d0bf0027c7d6a7c0571170d3b3a4d6 (diff)
downloadopenembedded-core-2c0c54e12169e76f16fb3398904bc897a9190397.tar.gz
wic: implement binary repeatable disk identifiers
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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index da483daed5..6faa16bf9b 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -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 = []