From: Sergei Zhmylev Date: Thu, 13 Oct 2022 11:03:45 +0000 (+0300) Subject: wic: implement binary repeatable disk identifiers X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~2764 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c0c54e12169e76f16fb3398904bc897a9190397;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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 Signed-off-by: Alexandre Belloni --- diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index da483daed5f..6faa16bf9b8 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 = []