Skip to content

Commit

Permalink
Compatibility fix with EL 8
Browse files Browse the repository at this point in the history
The 'capture_output=True' was introduced in Python 3.7, while Enterprise
Linux 8 is Python 3.6.

Per report in Bodhi update:
https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2023-45ace77fca
  • Loading branch information
praiskup committed Sep 25, 2023
1 parent 6a148a0 commit efb62bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mock/py/mockbuild/podman.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ def mounted_image(self):
logger = getLog()
cmd_mount = [self.podman_binary, "image", "mount", self.image]
cmd_umount = [self.podman_binary, "image", "umount", self.image]
result = subprocess.run(cmd_mount, capture_output=True, check=False, encoding="utf8")
result = subprocess.run(cmd_mount, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, check=False,
encoding="utf8")
if result.returncode:
message = "Podman mount failed: " + result.stderr
raise BootstrapError(message)
Expand All @@ -101,7 +103,8 @@ def mounted_image(self):
finally:
logger.info("umounting image %s (%s) with podman image umount",
self.image, mountpoint)
subprocess.run(cmd_umount, capture_output=True, check=True)
subprocess.run(cmd_umount, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, check=True)

@traceLog()
def cp(self, destination, tar_cmd):
Expand Down
6 changes: 6 additions & 0 deletions releng/release-notes-next/epel-8-compat.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"The fixes introduced in Mock 5.1 included a compatibility issue with Python in
Enterprise Linux 8 due to a dependency on the `capture_output=True` feature in
the 'subprocess' module, which was added in Python 3.7. However, EL 8 is
running on Python 3.6. This compatibility issue has been resolved in Mock by
using 'stdout=subprocess.PIPE' instead. This update was made based on a [report
from Bodhi update](https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2023-45ace77fca).

0 comments on commit efb62bb

Please sign in to comment.