From 974fcc916c9b391d987fa723cd90c7320011e492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 15 Sep 2022 17:57:24 +0200 Subject: [PATCH] tools/list-discoverable-partitions: make the script work again --- tools/list-discoverable-partitions.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/list-discoverable-partitions.py b/tools/list-discoverable-partitions.py index 37ccd273024..43d7ee9984d 100644 --- a/tools/list-discoverable-partitions.py +++ b/tools/list-discoverable-partitions.py @@ -19,6 +19,7 @@ ARCHITECTURES = { 'LOONGARCH64': 'LoongArch 64-bit', 'MIPS_LE': '32-bit MIPS LittleEndian (mipsel)', 'MIPS64_LE': '64-bit MIPS LittleEndian (mips64el)', + 'PARISC': 'HPPA/PARISC', 'PPC': '32-bit PowerPC', 'PPC64': '64-bit PowerPC BigEndian', 'PPC64_LE': '64-bit PowerPC LittleEndian', @@ -54,7 +55,7 @@ DESCRIPTIONS = { 'ROOT': ( 'Any native, optionally in LUKS', 'On systems with matching architecture, the first partition with this type UUID on the disk ' - 'containing the active EFI ESP is automatically mounted to the root directory /. ' + 'containing the active EFI ESP is automatically mounted to the root directory `/`. ' 'If the partition is encrypted with LUKS or has dm-verity integrity data (see below), the ' 'device mapper file will be named `/dev/mapper/root`.'), 'USR': ( @@ -87,8 +88,8 @@ DESCRIPTIONS = { 'XBOOTLDR': ( 'Typically VFAT', 'The Extended Boot Loader Partition (XBOOTLDR) used for the current boot is automatically ' - 'mounted to /boot/, unless a different partition is mounted there (possibly via ' - '/etc/fstab) or the directory is non-empty on the root disk. This partition type ' + 'mounted to `/boot/`, unless a different partition is mounted there (possibly via ' + '`/etc/fstab`) or the directory is non-empty on the root disk. This partition type ' 'is defined by the [Boot Loader Specification](https://systemd.io/BOOT_LOADER_SPECIFICATION).'), 'SWAP': ( 'Swap, optionally in LUKS', @@ -123,7 +124,7 @@ DESCRIPTIONS = { 'automatically mounted to `/var/tmp/`. If the partition is encrypted with LUKS, the ' 'device mapper file will be named `/dev/mapper/tmp`. Note that the intended mount point ' 'is indeed `/var/tmp/`, not `/tmp/`. The latter is typically maintained in memory via ' - 'tmpfs and does not require a partition on disk. In some cases it might be ' + '`tmpfs` and does not require a partition on disk. In some cases it might be ' 'desirable to make `/tmp/` persistent too, in which case it is recommended to make it ' 'a symlink or bind mount to `/var/tmp/`, thus not requiring its own partition type UUID.'), 'USER_HOME': ( @@ -134,22 +135,21 @@ DESCRIPTIONS = { 'Any native, optionally in LUKS', 'No automatic mounting takes place for other Linux data partitions. This partition type ' 'should be used for all partitions that carry Linux file systems. The installer needs ' - 'to mount them explicitly via entries in /etc/fstab. Optionally, these ' - 'partitions may be encrypted with LUKS. This partition type predates the Discoverable ' - 'Partitions Specification.'), + 'to mount them explicitly via entries in `/etc/fstab`. Optionally, these partitions may ' + 'be encrypted with LUKS. This partition type predates the Discoverable Partitions Specification.'), } def extract(file): for line in file: # print(line) - m = re.match(r'^#define\s+GPT_(.*SD_ID128_MAKE\(.*\))', line) + m = re.match(r'^#define\s+SD_GPT_(.*SD_ID128_MAKE\(.*\))', line) if not m: continue if m2 := re.match(r'^(ROOT|USR)_([A-Z0-9]+|X86_64|PPC64_LE|MIPS_LE|MIPS64_LE)(|_VERITY|_VERITY_SIG)\s+SD_ID128_MAKE\((.*)\)', m.group(1)): type, arch, suffix, u = m2.groups() u = uuid.UUID(u.replace(',', '')) - assert arch in ARCHITECTURES + assert arch in ARCHITECTURES, f'{arch} not in f{ARCHITECTURES}' type = f'{type}{suffix}' assert type in TYPES