Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search for extracted rpm src dir instead of hardcoded path #266

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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