From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH v2 4/4] wic: Restore compatibility with old distros
Date: Fri, 17 May 2024 14:44:34 +0300 [thread overview]
Message-ID: <20240517114434.778656-5-amikan@ilbers.de> (raw)
In-Reply-To: <20240517114434.778656-1-amikan@ilbers.de>
After update of WIC it requires sfdisk to support --disk-id command,
which is false for Debian Buster and Ubuntu Focal.
Do not try to set disk identifier for those distro versions to keep
them buildable but with lack of reproducibility.
This hack should be removed after deprecation of Buster and Focal.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
scripts/lib/wic/plugins/imager/direct.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 33a869ec..a65ae36a 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -530,6 +530,13 @@ class PartitionedImage():
exec_native_cmd("parted -s %s mklabel %s" % (device, ptable_format),
self.native_sysroot)
+ def _sfdisk_supports_disk_id(self):
+ ret, help_out = exec_native_cmd("sfdisk --help", self.native_sysroot)
+ if 'disk-id' not in help_out:
+ logger.warn("Current sfdisk version DOES NOT support changing disk ID")
+ return False
+ return True
+
def _write_disk_guid(self):
if self.ptable_format in ('gpt', 'gpt-hybrid'):
if os.getenv('SOURCE_DATE_EPOCH'):
@@ -537,6 +544,11 @@ class PartitionedImage():
else:
self.disk_guid = uuid.uuid4()
+ # Backport compatibility for Debian Buster and Ubuntu Focal
+ if not self._sfdisk_supports_disk_id():
+ logger.warn("Disk identifier can't be set, reproducibility is broken!")
+ return
+
logger.debug("Set disk guid %s", self.disk_guid)
sfdisk_cmd = "sfdisk --disk-id %s %s" % (self.path, self.disk_guid)
exec_native_cmd(sfdisk_cmd, self.native_sysroot)
--
2.34.1
next prev parent reply other threads:[~2024-05-17 11:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-17 11:44 [PATCH v2 0/4] Update WIC to the latest revision Anton Mikanovich
2024-05-17 11:44 ` [PATCH v2 1/4] Revert "wic/plugins/images/direct: Allow changes in fstab on rootfs" Anton Mikanovich
2024-05-17 11:44 ` [PATCH v2 2/4] wic: Update to the latest revision Anton Mikanovich
2024-05-17 11:44 ` [PATCH v2 3/4] Revert "Revert "wic/plugins/images/direct: Allow changes in fstab on rootfs"" Anton Mikanovich
2024-05-17 11:44 ` Anton Mikanovich [this message]
2024-05-17 12:49 ` [PATCH v2 0/4] Update WIC to the latest revision Anton Mikanovich
2024-05-23 13:15 ` MOESSBAUER, Felix
2024-05-21 11:07 ` Anton Mikanovich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240517114434.778656-5-amikan@ilbers.de \
--to=amikan@ilbers.de \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox