diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/download-using-manifests.pl.in | 5 | ||||
-rw-r--r-- | scripts/nix-pull.in | 4 | ||||
-rw-r--r-- | scripts/readmanifest.pm.in | 9 |
3 files changed, 16 insertions, 2 deletions
diff --git a/scripts/download-using-manifests.pl.in b/scripts/download-using-manifests.pl.in index 890f8787cd91..8757355313e8 100644 --- a/scripts/download-using-manifests.pl.in +++ b/scripts/download-using-manifests.pl.in @@ -27,7 +27,10 @@ my %successors; for my $manifest (glob "$manifestDir/*.nixmanifest") { # print STDERR "reading $manifest\n"; - readManifest $manifest, \%narFiles, \%patches, \%successors; + if (readManifest($manifest, \%narFiles, \%patches, \%successors) < 3) { + print STDERR "you have an old-style manifest `$manifest'; please delete it\n"; + exit 1; + } } diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in index 13a2199fbb57..efd0c074fd44 100644 --- a/scripts/nix-pull.in +++ b/scripts/nix-pull.in @@ -42,7 +42,9 @@ sub processURL { "'$url' > '$manifest'") == 0 or die "curl failed: $?"; - readManifest $manifest, \%narFiles, \%patches, \%successors; + if (readManifest($manifest, \%narFiles, \%patches, \%successors) < 3) { + die "manifest `$url' is too old (i.e., for Nix <= 0.7)\n"; + } my $baseName = "unnamed"; if ($url =~ /\/([^\/]+)\/[^\/]+$/) { # get the forelast component diff --git a/scripts/readmanifest.pm.in b/scripts/readmanifest.pm.in index fa4ac65ac820..3ecb81f8f8e8 100644 --- a/scripts/readmanifest.pm.in +++ b/scripts/readmanifest.pm.in @@ -41,6 +41,8 @@ sub readManifest { my $inside = 0; my $type; + my $manifestVersion = 2; + my $storePath; my $url; my $hash; @@ -139,6 +141,7 @@ sub readManifest { elsif (/^\s*NarHash:\s*(\S+)\s*$/) { $narHash = $1; } elsif (/^\s*References:\s*(.*)\s*$/) { $references = $1; } elsif (/^\s*Deriver:\s*(\S+)\s*$/) { $deriver = $1; } + elsif (/^\s*ManifestVersion:\s*(\d+)\s*$/) { $manifestVersion = $1; } # Compatibility; elsif (/^\s*NarURL:\s*(\S+)\s*$/) { $url = $1; } @@ -148,6 +151,8 @@ sub readManifest { } close MANIFEST; + + return $manifestVersion; } @@ -159,6 +164,10 @@ sub writeManifest open MANIFEST, ">$manifest.tmp"; # !!! check exclusive + print MANIFEST "version {\n"; + print MANIFEST " ManifestVersion: 3\n"; + print MANIFEST "}\n"; + foreach my $storePath (keys %{$narFiles}) { my $narFileList = $$narFiles{$storePath}; foreach my $narFile (@{$narFileList}) { |