From 652460330e4d454c3e04b128540590b89d8ffc1f Mon Sep 17 00:00:00 2001 From: Milan Lysonek Date: Thu, 26 Sep 2024 14:02:45 +0200 Subject: [PATCH] Search for extracted rpm src dir instead of hardcoded path --- lib/util/content.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/util/content.py b/lib/util/content.py index 060f366..6919e96 100644 --- a/lib/util/content.py +++ b/lib/util/content.py @@ -141,10 +141,14 @@ def get_content(build=True): check=True, stdout=subprocess.PIPE, universal_newlines=True, cwd=tmpdir, ) name_version = ret.stdout.strip() - extracted = Path(tmpdir) / 'BUILD' / name_version + # extracted sources directory varies across distro versions, thus + # try to search for the directory rather than using hardcoded path + try: + builddir = Path(tmpdir) / 'BUILD' + extracted = next(builddir.glob(f'**/{name_version}')) + except StopIteration: + raise FileNotFoundError("extracted SRPM content sources not found") util.log(f"using {extracted} as content source") - if not extracted.exists(): - raise FileNotFoundError(f"{extracted} not in extracted/patched SRPM") # build content if build: cmd = ['./build_product', '--playbook-per-rule', f'rhel{rhel.major}']