Skip to content

Commit

Permalink
Merge pull request #109 from matyasselmeci/pr/touch-repomd
Browse files Browse the repository at this point in the history
Touch repomd.xml files to update the timestamp
  • Loading branch information
matyasselmeci authored Dec 27, 2024
2 parents ad43820 + 0adaed8 commit 9a7e541
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions distrepos/tag_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ def run_createrepo(working_path: Path, arches: t.List[str]):
ok, proc = run_with_log(["createrepo_c", '--update', str(src_dir), f"--pkglist={src_pkglist}"])
description = "running createrepo on SRPMs"
if ok:
repomd = src_dir / "repodata/repomd.xml"
repomd.touch()
_log.info("%s ok", description)
else:
raise TagFailure(f"Error {description}")
Expand All @@ -293,6 +295,8 @@ def run_createrepo(working_path: Path, arches: t.List[str]):
)
description = f"running createrepo on {arch} rpms"
if ok:
repomd = arch_dir / "repodata/repomd.xml"
repomd.touch()
_log.info("%s ok", description)
else:
raise TagFailure(f"Error {description}")
Expand All @@ -306,6 +310,8 @@ def run_createrepo(working_path: Path, arches: t.List[str]):
)
description = f"running createrepo on {arch} debuginfo rpms"
if ok:
repomd = arch_debug_dir / "repodata/repomd.xml"
repomd.touch()
_log.info("%s ok", description)
else:
raise TagFailure(f"Error {description}")
Expand Down Expand Up @@ -346,9 +352,12 @@ def update_release_repos(release_path: Path, working_path: Path, previous_path:
raise TagFailure(failmsg)

# If we have an old previous path, clear it; also make sure its parents exist.
if previous_path.exists():
if os.path.lexists(previous_path):
try:
shutil.rmtree(previous_path)
if previous_path.is_dir():
shutil.rmtree(previous_path)
else:
previous_path.unlink()
except OSError as err:
_log.error(
"OSError clearing previous dir %s: %s",
Expand All @@ -361,7 +370,7 @@ def update_release_repos(release_path: Path, working_path: Path, previous_path:

# If we already have something in the release path, move it to the previous path.
# Also create the parent dirs if necessary.
if release_path.exists():
if os.path.lexists(release_path):
try:
shutil.move(release_path, previous_path)
except OSError as err:
Expand All @@ -387,7 +396,7 @@ def update_release_repos(release_path: Path, working_path: Path, previous_path:
)
_log.debug("Traceback follows", exc_info=True)
# Something failed. Undo, undo!
if previous_path.exists():
if os.path.lexists(previous_path):
try:
shutil.move(previous_path, release_path)
except OSError as err2:
Expand Down

0 comments on commit 9a7e541

Please sign in to comment.