Merge pull request #22 from samueldr/fix/bttf-guard

Fixes channel going back in time due to incomplete change.
This commit is contained in:
Eelco Dolstra 2018-08-30 16:06:37 +02:00 committed by GitHub
commit 8dfa9f37c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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";
# Guard against the channel going back in time.
my $curReleaseDir = readlink "$channelsDir/$channelName";
if (defined $curReleaseDir) {
my $curRelease = basename($curReleaseDir);
my $d = `NIX_PATH= nix-instantiate --eval -E "builtins.compareVersions (builtins.parseDrvName \\"$curRelease\\").version (builtins.parseDrvName \\"$releaseName\\").version"`;
chomp $d;
die "channel would go back in time from $curRelease to $releaseName, bailing out\n" if $d == 1;
}
my @releaseUrl = split(/\//, read_file("$channelsDir/$channelName", err_mode => 'quiet') // "");
my $curRelease = pop @releaseUrl;
my $d = `NIX_PATH= nix-instantiate --eval -E "builtins.compareVersions (builtins.parseDrvName \\"$curRelease\\").version (builtins.parseDrvName \\"$releaseName\\").version"`;
chomp $d;
die "channel would go back in time from $curRelease to $releaseName, bailing out\n" if $d == 1;
if ($bucket->head_key("$releasePrefix")) {
print STDERR "release already exists\n";