Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nora Puchreiner
Nix
Commits
bb2e5369
Commit
bb2e5369
authored
20 years ago
by
Eelco Dolstra
Browse files
Options
Downloads
Patches
Plain Diff
* Parse new hash format properly.
parent
5863f247
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/download-using-manifests.pl.in
+15
-6
15 additions, 6 deletions
scripts/download-using-manifests.pl.in
with
15 additions
and
6 deletions
scripts/download-using-manifests.pl.in
+
15
−
6
View file @
bb2e5369
...
@@ -80,6 +80,15 @@ sub isValidPath {
...
@@ -80,6 +80,15 @@ sub isValidPath {
return $? == 0;
return $? == 0;
}
}
sub parseHash {
my $hash = shift;
if ($hash =~ /^(.+):(.+)$/) {
return ($1, $2);
} else {
return ("md5", $hash);
}
}
while ($queueFront < scalar @queue) {
while ($queueFront < scalar @queue) {
my $u = $queue[$queueFront++];
my $u = $queue[$queueFront++];
# print "$u\n";
# print "$u\n";
...
@@ -99,10 +108,11 @@ while ($queueFront < scalar @queue) {
...
@@ -99,10 +108,11 @@ while ($queueFront < scalar @queue) {
foreach my $patch (@{$patchList}) {
foreach my $patch (@{$patchList}) {
if (isValidPath($patch->{basePath})) {
if (isValidPath($patch->{basePath})) {
# !!! this should be cached
# !!! this should be cached
my $hash = `@bindir@/nix-hash --type '$patch->{hashAlgo}' "$patch->{basePath}"`;
my ($baseHashAlgo, $baseHash) = parseHash $patch->{baseHash};
my $hash = `@bindir@/nix-hash --type '$baseHashAlgo' "$patch->{basePath}"`;
chomp $hash;
chomp $hash;
# print " MY HASH is $hash\n";
# print " MY HASH is $hash\n";
if ($hash ne $
patch->{
baseHash
}
) {
if ($hash ne $baseHash) {
print LOGFILE "$$ rejecting $patch->{basePath}\n";
print LOGFILE "$$ rejecting $patch->{basePath}\n";
next;
next;
}
}
...
@@ -177,8 +187,7 @@ my $maxStep = scalar @path;
...
@@ -177,8 +187,7 @@ my $maxStep = scalar @path;
sub downloadFile {
sub downloadFile {
my $url = shift;
my $url = shift;
my $hash = shift;
my ($hashAlgo, $hash) = parseHash(shift);
my $hashAlgo = shift;
$ENV{"PRINT_PATH"} = 1;
$ENV{"PRINT_PATH"} = 1;
$ENV{"QUIET"} = 1;
$ENV{"QUIET"} = 1;
$ENV{"NIX_HASH_ALGO"} = $hashAlgo;
$ENV{"NIX_HASH_ALGO"} = $hashAlgo;
...
@@ -210,7 +219,7 @@ while (scalar @path > 0) {
...
@@ -210,7 +219,7 @@ while (scalar @path > 0) {
# Download the patch.
# Download the patch.
print " downloading patch...\n";
print " downloading patch...\n";
my $patchPath = downloadFile "$patch->{url}", "$patch->{hash}"
, "$patch->{hashAlgo}"
;
my $patchPath = downloadFile "$patch->{url}", "$patch->{hash}";
# Turn the base path into a NAR archive, to which we can
# Turn the base path into a NAR archive, to which we can
# actually apply the patch.
# actually apply the patch.
...
@@ -237,7 +246,7 @@ while (scalar @path > 0) {
...
@@ -237,7 +246,7 @@ while (scalar @path > 0) {
# Download the archive.
# Download the archive.
print " downloading archive...\n";
print " downloading archive...\n";
my $narFilePath = downloadFile "$narFile->{url}", "$narFile->{hash}"
, "$narFile->{hashAlgo}"
;
my $narFilePath = downloadFile "$narFile->{url}", "$narFile->{hash}";
# Unpack the archive into the target path.
# Unpack the archive into the target path.
print " unpacking archive...\n";
print " unpacking archive...\n";
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment