Hello, I am working on upgrading python-packaging to version 23.0 and it will break test_chroot_gpg_hashes. Packaging removed support for LegacyVersion(https://github.com/pypa/packaging/pull/407) and this line is now failing: copr_backend/sign.py:119: in gpg_hashtype_for_chroot You can use this COPR https://copr.fedorainfracloud.org/coprs/thrnciar/python-packaging/builds/ for testing. I plan to ship the update next week on Thursday 26.1.2023. Thank you. =================================== FAILURES =================================== ____________________________ test_chroot_gpg_hashes ____________________________ def test_chroot_gpg_hashes(): chroots = [ ("fedora-26-x86_64", "sha1"), ("fedora-27-s390x", "sha256"), ("fedora-eln-x86_64", "sha256"), ("fedora-rawhide-x86_64", "sha256"), ("mageia-8-x86_64", "sha256"), ("opensuse-tumbleweed-aarch64", "sha256"), ("epel-7-ppc64", "sha256"), ("centos-7.dev-aarch64", "sha256"), ("epel-8-aarch64", "sha256"), ("rhel-8.dev-ppc64le", "sha256"), ("oraclelinux-9-s390x", "sha256"), ("centos-stream-8-s390x", "sha256"), ("centos-stream-9-s390x", "sha256"), ("rhel-rawhide-s390x", "sha256"), # we don't expect stream 7 will ever exist ("centos-stream-7-aarch64", "sha256"), ("srpm-builds", "sha256"), ("epel-4-s390x", "sha1"), ("epel-5-s390x", "sha256"), ("centos-stream+epel-next-9-aarch64", "sha256"), ] opts = Munch() opts.gently_gpg_sha256 = False for chroot, exp_type in chroots: assert (chroot, exp_type) == (chroot, gpg_hashtype_for_chroot(chroot, opts)) opts.gently_gpg_sha256 = True chroots = [ ("fedora-26-x86_64", "sha1"), ("fedora-27-s390x", "sha1"), ("fedora-eln-x86_64", "sha1"), ("fedora-rawhide-x86_64", "sha1"), ("mageia-8-x86_64", "sha1"), ("opensuse-tumbleweed-aarch64", "sha1"), ("epel-7-ppc64", "sha1"), ("centos-7.dev-aarch64", "sha1"), ("epel-8-aarch64", "sha256"), ("rhel-8.dev-ppc64le", "sha256"), ("oraclelinux-9-s390x", "sha256"), ("centos-stream-8-s390x", "sha256"), ("centos-stream-9-s390x", "sha256"), ("rhel-rawhide-s390x", "sha1"), ("srpm-builds", "sha1"), ] for chroot, exp_type in chroots: > assert (chroot, exp_type) == (chroot, gpg_hashtype_for_chroot(chroot, opts)) tests/test_sign.py:354: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copr_backend/sign.py:119: in gpg_hashtype_for_chroot if version.parse(el_version) > version.parse("7"): /usr/lib/python3.11/site-packages/packaging/version.py:52: in parse return Version(version) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7f1c7564f490> version = 'rawhide' def __init__(self, version: str) -> None: """Initialize a Version object. :param version: The string representation of a version which will be parsed and normalized before use. :raises InvalidVersion: If the ``version`` does not conform to PEP 440 in any way then this exception will be raised. """ # Validate the version and parse it into pieces match = self._regex.search(version) if not match: > raise InvalidVersion(f"Invalid version: '{version}'") E packaging.version.InvalidVersion: Invalid version: 'rawhide' /usr/lib/python3.11/site-packages/packaging/version.py:197: InvalidVersion
This only fails in the test because the chroot name is "rhel-rawhide-s390x". The code itself is: el_chroots = ["rhel", "epel", "centos", "oraclelinux"] ... if parts[0] in el_chroots: ... if version.parse(el_version) > version.parse("7"): And all the actual EL chroots have numeric versions, so this will never attempt to parse "rawhide" in production. However, to stay safe, the code should really try-version.parse-except now. Something like: try: el_version_ = version.parse(el_version) except InvalidVersion: return return "sha256" # or whatever action is appropriate else: if el_version_ > version.parse("7"): ...
Thank you very much for letting us know beforehand. PR: https://github.com/fedora-copr/copr/pull/2492/files
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle. Changing version to 38.