Skip to content

Commit

Permalink
Merge pull request #8490 from adrianschroeter/fix_static_links
Browse files Browse the repository at this point in the history
[backend] avoid multiple static link creation
  • Loading branch information
adrianschroeter authored Oct 4, 2019
2 parents 7f8469c + 877ec92 commit 1ddd57c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/backend/bs_publish
Original file line number Diff line number Diff line change
Expand Up @@ -1058,12 +1058,13 @@ sub createrepo_staticlinks {
for my $arch ('.', ls($extrep)) {
next unless -d "$extrep/$arch";
for (ls("$extrep/$arch")) {
unlink "$extrep/$arch/$_" if -l "$extrep/$arch/$_" && ! -e "$extrep/$arch/$_";
if (-l "$extrep/$arch/$_") {
unlink "$extrep/$arch/$_" unless -e "$extrep/$arch/$_";
next;
}
my $link;
if (/^(.*)-Build(?:\d\d\d\d|\d+\.\d+)(-Media\d?(\.license)?)$/s) {
$link = "$1$2"; # no support for versioned links
} else {
next unless -f "$extrep/$arch/$_";
}
if (/^(.*)-([^-]*)-[^-]*\.rpm$/s) {
$link = "$1.rpm";
Expand All @@ -1089,7 +1090,7 @@ sub createrepo_staticlinks {
next unless $link;
unlink("$extrep/$arch/.$link"); # drop left over
symlink($_, "$extrep/$arch/.$link");
rename("$extrep/$arch/.$link", "$extrep/$arch/$link"); # atomar update
rename("$extrep/$arch/.$link", "$extrep/$arch/$link"); # atomic update
}
}
}
Expand Down

0 comments on commit 1ddd57c

Please sign in to comment.