From 22fcf10d79006fadd7e7065b2ede7eac1273bff4 Mon Sep 17 00:00:00 2001 From: zhangruifang2020 Date: Thu, 1 Aug 2024 16:46:45 +0800 Subject: [PATCH] backport patch from upstream --- ...5sum.py-Support-genisoimage-Python-2.patch | 57 +++++++++++++++++++ isomd5sum.spec | 6 +- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 backport-testpyisomd5sum.py-Support-genisoimage-Python-2.patch diff --git a/backport-testpyisomd5sum.py-Support-genisoimage-Python-2.patch b/backport-testpyisomd5sum.py-Support-genisoimage-Python-2.patch new file mode 100644 index 0000000..4c4c3af --- /dev/null +++ b/backport-testpyisomd5sum.py-Support-genisoimage-Python-2.patch @@ -0,0 +1,57 @@ +From 37fc325798a582bee4a6d4370054b40e9c098c06 Mon Sep 17 00:00:00 2001 +From: Ryan Finnie +Date: Sun, 9 Dec 2018 06:31:08 +0000 +Subject: [PATCH] testpyisomd5sum.py: Support genisoimage, Python 2 + +Debian-based distributions no longer contains mkisofs, so use +genisoimage is mkisofs is not found. This is done in a way which is +compatible with both Python 2 and Python 3. Honor $(PYTHON) in Makefile +when calling testpyisomd5sum.py during make test. +--- + Makefile | 2 +- + testpyisomd5sum.py | 12 +++++++++++- + 2 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index c98cf35..8aaf3d9 100644 +--- a/Makefile ++++ b/Makefile +@@ -73,4 +73,4 @@ archive: + @echo "The final archive is in isomd5sum-$(VERSION).tar.bz2" + + test: +- ./testpyisomd5sum.py ++ $(PYTHON) ./testpyisomd5sum.py +diff --git a/testpyisomd5sum.py b/testpyisomd5sum.py +index 9d6b11b..9324ead 100755 +--- a/testpyisomd5sum.py ++++ b/testpyisomd5sum.py +@@ -1,6 +1,7 @@ + #!/usr/bin/python3 + + import os ++import subprocess + import pyisomd5sum + + # Pass in the rc, the expected value and the pass_all state +@@ -13,7 +14,16 @@ def pass_fail(rc, pass_value, pass_all): + + + # create iso file +-os.system("mkisofs -quiet . > testiso.iso") ++try: ++ # Python 3 ++ catch_error = FileNotFoundError ++except NameError: ++ # Python 2 ++ catch_error = OSError ++try: ++ subprocess.check_call(["mkisofs", "-quiet", "-o", "testiso.iso", "."]) ++except catch_error: ++ subprocess.check_call(["genisoimage", "-quiet", "-o", "testiso.iso", "."]) + + # implant it + (rstr, pass_all) = pass_fail(pyisomd5sum.implantisomd5sum("testiso.iso", 1, 0), 0, True) +-- +2.33.0 + diff --git a/isomd5sum.spec b/isomd5sum.spec index 4081d7f..6d9c173 100644 --- a/isomd5sum.spec +++ b/isomd5sum.spec @@ -1,6 +1,6 @@ Name: isomd5sum Version: 1.2.3 -Release: 8 +Release: 9 Epoch: 1 Summary: Utilities for working with md5sum implanted in ISO images License: GPLv2+ @@ -9,6 +9,7 @@ Source0: https://github.com/rhinstaller/%{name}/archive/%{version}.tar.gz Patch0001: 0001-isomd5sum-1.2.3-add-loongarch64-support.patch Patch0002: 0002-fix-build-error-for-riscv64.patch +Patch0003: backport-testpyisomd5sum.py-Support-genisoimage-Python-2.patch %global common_description %{expand: isomd5sum provides a way of making use of the ISO9660 application data @@ -68,6 +69,9 @@ make test %{_mandir}/man1/* %changelog +* Thu Aug 01 2024 zhangruifang - 1:1.2.3-9 +- backport patch from upstream + * Thu Mar 16 2023 laokz - 1:1.2.3-8 - fix build error for riscv64 - add %check -- Gitee