diff --git a/.gitignore b/.gitignore index 8e0579c..4603ea4 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /mkosi-10.tar.gz /mkosi-11.tar.gz /mkosi-12.tar.gz +/mkosi-13.tar.gz diff --git a/0001-py3.11-fix-Enum-formatting-to-work-with-python3.11-a.patch b/0001-py3.11-fix-Enum-formatting-to-work-with-python3.11-a.patch deleted file mode 100644 index e4ee572..0000000 --- a/0001-py3.11-fix-Enum-formatting-to-work-with-python3.11-a.patch +++ /dev/null @@ -1,81 +0,0 @@ -From f73a97aba7f6a586bf96ad970294a332109ab558 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Sun, 24 Apr 2022 12:54:57 +0200 -Subject: [PATCH] py3.11: fix Enum formatting to work with python3.11-a7 - -Something strange is happening with .__repr__() access in python3.11: - ->>> mkosi.backend.ManifestFormat.mro() -[, , , ] ->>> mkosi.backend.ManifestFormat.changelog.__repr__() -Traceback (most recent call last): - File "", line 1, in - File "/usr/lib64/python3.11/enum.py", line 1194, in __repr__ - return "<%s.%s: %s>" % (self.__class__.__name__, self._name_, v_repr(self._value_)) - ^^^^^^^^^^^^^^^^^^^^ - File "/home/zbyszek/src/mkosi/mkosi/backend.py", line 95, in __repr__ - return cast(str, getattr(self, "name")) - ^^^^^^^^^^^^^^^^^^^^^ -AttributeError: 'str' object has no attribute 'name' - -Enum somehow subverts normal lookup and makes its own __repr__ function be -used, even though Parseable is listed first in MRO. This seems to be related to -PEP 663, which was rejected, and the changes reverted for -a4 [1], but then the revert -was reverted [2]. - -Let's just sidestep MRO with a method redefinition: - ->>> mkosi.backend.ManifestFormat.changelog.__repr__ - ->>> mkosi.backend.ManifestFormat.changelog.__repr__() -'changelog' - -This should work on all python versions. If python3.11 returns to previous -semantics before the final release, we can remove the workaround. - -[1] commit acf7403f9baea3ae1119fc6b4a3298522188bf96 -Author: Ethan Furman -Date: Sat Jan 15 22:41:43 2022 -0800 - - bpo-40066: [Enum] update str() and format() output (GH-30582) - - Undo rejected PEP-663 changes: - - - restore `repr()` to its 3.10 status - - restore `str()` to its 3.10 status - -[2] commit 42a64c03ec5c443f2a5c2ee4284622f5d1f5326c -Author: Victor Stinner -Date: Mon Jan 17 13:58:40 2022 +0100 - - Revert "bpo-40066: [Enum] update str() and format() output (GH-30582)" (GH-30632) - - This reverts commit acf7403f9baea3ae1119fc6b4a3298522188bf96. ---- - mkosi/backend.py | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/mkosi/backend.py b/mkosi/backend.py -index 78006f392a..3c57ec6295 100644 ---- a/mkosi/backend.py -+++ b/mkosi/backend.py -@@ -217,11 +217,19 @@ class OutputFormat(Parseable, enum.Enum): - def has_fs_compression(self) -> bool: - return self.is_squashfs() or self.is_btrfs() - -+ def __repr__(self) -> str: -+ return Parseable.__repr__(self) -+ def __str__(self) -> str: -+ return Parseable.__str__(self) - - class ManifestFormat(Parseable, enum.Enum): - json = "json" # the standard manifest in json format - changelog = "changelog" # human-readable text file with package changelogs - -+ def __repr__(self) -> str: -+ return Parseable.__repr__(self) -+ def __str__(self) -> str: -+ return Parseable.__str__(self) - - class PartitionIdentifier(enum.Enum): - esp = 'esp' diff --git a/mkosi.spec b/mkosi.spec index d61d842..d7ee891 100644 --- a/mkosi.spec +++ b/mkosi.spec @@ -1,5 +1,5 @@ Name: mkosi -Version: 12 +Version: 13 Release: %autorelease Summary: Create bespoke OS images @@ -7,12 +7,12 @@ License: LGPLv2+ URL: https://github.com/systemd/mkosi Source0: https://github.com/systemd/mkosi/archive/v%{version}/%{name}-%{version}.tar.gz -Patch: 0001-py3.11-fix-Enum-formatting-to-work-with-python3.11-a.patch - BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pytest +BuildRequires: binutils +BuildRequires: python3dist(pexpect) %global recoreq %{?el7:Requires}%{!?el7:Recommends} @@ -23,6 +23,7 @@ BuildRequires: python3-pytest %{recoreq}: e2fsprogs %{recoreq}: squashfs-tools %{recoreq}: veritysetup +%{recoreq}: binutils %if 0%{?el7} == 0 Recommends: debootstrap Recommends: arch-install-scripts @@ -33,6 +34,7 @@ Recommends: cpio Recommends: zstd Recommends: python3dist(argcomplete) Recommends: python3dist(cryptography) +Recommends: python3dist(pexpect) %endif %description diff --git a/sources b/sources index f512a29..f0154de 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (mkosi-12.tar.gz) = ae59789e3b4855400d130714fac0b3b599b3e69631bc6a5267916697d0722c05a6c788cd70d224917261c931fe93fa287d3d23f6f00849cb80ff9794a13dc04e +SHA512 (mkosi-13.tar.gz) = 285964835daf5c971ff7580fd99a09107db057da15ad52be1f2aa0bd9be12909b5d214f24ffde857475f9a896731d201d193fc67423d56b6bb507f72a01f24ad