diff options
author | Sergei Zhmylev <s.zhmylev@yadro.com> | 2022-10-13 14:03:45 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-10-26 12:26:16 +0100 |
commit | 2c0c54e12169e76f16fb3398904bc897a9190397 (patch) | |
tree | 2aa019474a677638b4def15cb05629f40d9b711f /scripts | |
parent | fedf90d385d0bf0027c7d6a7c0571170d3b3a4d6 (diff) | |
download | openembedded-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.py | 5 |
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 = [] |