Skip to content

Commit

Permalink
Search for extracted rpm src dir instead of hardcoded path
Browse files Browse the repository at this point in the history
  • Loading branch information
mildas committed Sep 27, 2024
1 parent 0499ab1 commit 0da7fe5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/util/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}']
Expand Down

0 comments on commit 0da7fe5

Please sign in to comment.