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 75d3f48
Show file tree
Hide file tree
Showing 2 changed files with 9 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
4 changes: 4 additions & 0 deletions releng/release-notes-next/epel-8-compat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fixes added in Mock 5.1 introduced an EL 8 Python incompatibility (dependency on
Python `capture_output=True` feature in `subprocess` which has been added in
Python 3.7 - while EL 8 is on Python 3.6). This has been fixed in Mock (using
`stdout=subprocess.PIPE` instead).

0 comments on commit 75d3f48

Please sign in to comment.