From cdd4e0099b48c3de6901d7d7f511607a5b8423ea Mon Sep 17 00:00:00 2001 From: Matyas Selmeci Date: Fri, 29 Nov 2024 11:35:47 -0600 Subject: [PATCH] Deal with the 'latest' symlink already existing --- distrepos/symlink_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/distrepos/symlink_utils.py b/distrepos/symlink_utils.py index 6f4a30f..300b47f 100644 --- a/distrepos/symlink_utils.py +++ b/distrepos/symlink_utils.py @@ -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, "" \ No newline at end of file