forked from the-distro/channel-scripts
Fixes channel going back in time due to incomplete change.
The change ind3d33d5b25
changed how the locally saved channel information was saved on the local machine. *d3d33d5b25 (diff-682bf482f6dd273f1c3c49afd99b4660R192)
The changeset did *not* change the guard clause, which now made it act like this: 1. Try readlink on the file 2. (bail as it's undefined) The new behaviour is as more or less expected: 1. Reads the file if available 2. Split the URL components 3. Keep the last bit This can give us an empty string, which will compare to `-1` thus fulfilling the need.
This commit is contained in:
parent
e9587f9388
commit
d313d2bd51
1 changed files with 5 additions and 7 deletions
|
@ -72,13 +72,11 @@ my $rev = $evalInfo->{jobsetevalinputs}->{nixpkgs}->{revision} or die;
|
||||||
print STDERR "release is ‘$releaseName’ (build $releaseId), eval is $evalId, prefix is $releasePrefix, Git commit is $rev\n";
|
print STDERR "release is ‘$releaseName’ (build $releaseId), eval is $evalId, prefix is $releasePrefix, Git commit is $rev\n";
|
||||||
|
|
||||||
# Guard against the channel going back in time.
|
# Guard against the channel going back in time.
|
||||||
my $curReleaseDir = readlink "$channelsDir/$channelName";
|
my @releaseUrl = split(/\//, read_file("$channelsDir/$channelName", err_mode => 'quiet') // "");
|
||||||
if (defined $curReleaseDir) {
|
my $curRelease = pop @releaseUrl;
|
||||||
my $curRelease = basename($curReleaseDir);
|
my $d = `NIX_PATH= nix-instantiate --eval -E "builtins.compareVersions (builtins.parseDrvName \\"$curRelease\\").version (builtins.parseDrvName \\"$releaseName\\").version"`;
|
||||||
my $d = `NIX_PATH= nix-instantiate --eval -E "builtins.compareVersions (builtins.parseDrvName \\"$curRelease\\").version (builtins.parseDrvName \\"$releaseName\\").version"`;
|
chomp $d;
|
||||||
chomp $d;
|
die "channel would go back in time from $curRelease to $releaseName, bailing out\n" if $d == 1;
|
||||||
die "channel would go back in time from $curRelease to $releaseName, bailing out\n" if $d == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($bucket->head_key("$releasePrefix")) {
|
if ($bucket->head_key("$releasePrefix")) {
|
||||||
print STDERR "release already exists\n";
|
print STDERR "release already exists\n";
|
||||||
|
|
Loading…
Reference in a new issue