Skip to content

Commit

Permalink
Merge pull request #102 from matyasselmeci/pr/fix-existing-symlink
Browse files Browse the repository at this point in the history
Deal with the 'latest' symlink already existing
  • Loading branch information
matyasselmeci authored Nov 29, 2024
2 parents 6527aae + cdd4e00 commit 0ea1100
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions distrepos/symlink_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def link_latest_release(options: Options, release_series: t.List[ReleaseSeries])

release_rpms.sort(key = _get_release_number, reverse=True)
latest_symlink = series_root / f"osg-{series.name}-{dver}-release-latest.rpm"
latest_symlink.symlink_to(release_rpms[0].relative_to(latest_symlink.parent))

latest_symlink_target = release_rpms[0].relative_to(latest_symlink.parent)
if latest_symlink.resolve() != latest_symlink_target:
latest_symlink.unlink(missing_ok=True)
latest_symlink.symlink_to(latest_symlink_target)

return True, ""

0 comments on commit 0ea1100

Please sign in to comment.