Skip to content

Commit

Permalink
target srpm file name now includes architecture and repository id in …
Browse files Browse the repository at this point in the history
…the name
  • Loading branch information
skabashnyuk committed Mar 8, 2024
1 parent 808a773 commit fd7619e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions source-container-build/app/source_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ def fetch_image_manifest_digest(image: str) -> str:
return run(cmd, check=True, text=True, capture_output=True).stdout.strip()


def safe_srp_artifact_name(file: str) -> str:
root, filename = os.path.split(file)
repoid = os.path.basename(root)
head, tail = os.path.split(root)
arch = os.path.basename(head)
return f"{arch}-{repoid}-{filename}"


def create_dir(*components) -> str:
path = os.path.join(*components)
os.makedirs(path)
Expand Down Expand Up @@ -343,8 +351,8 @@ def _find_prefetch_srpm_archives():
srpm_counter = itertools.count()
for root, filename in _find_prefetch_srpm_archives():
next(srpm_counter)
src = f"{root}/{filename}"
dest = sib_dirs.rpm_dir
src = os.path.join(root, filename)
dest = os.path.join(sib_dirs.rpm_dir, safe_srp_artifact_name(src))
log.debug("copy prefetched rpm source %s to %s", src, dest)
shutil.copy(src, dest)

Expand Down
2 changes: 1 addition & 1 deletion source-container-build/app/test_source_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ def _has_known_file_ext(filename: str) -> bool:
for dir_path, subdir_names, file_names in os.walk(sib_dirs.rpm_dir):
gathered_srpm_deps.extend(file_names)
self.assertListEqual(
sorted([os.path.basename(dep) for dep in src_rpm_deps]),
sorted([source_build.safe_srp_artifact_name(dep) for dep in src_rpm_deps]),
sorted(gathered_srpm_deps),
)

Expand Down

0 comments on commit fd7619e

Please sign in to comment.