diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-12-29T18·58+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-12-29T18·58+0000 |
commit | e1e9c036f9313ac6bf160dba67e694b7868f1567 (patch) | |
tree | e2779f3eb9f6983ad45d08a0aac0c4d5826fcf50 /scripts/readmanifest.pm.in | |
parent | 77fc1c6c5c4f662ab9b15ff09300f2a626597bc8 (diff) |
* A utility to generate patches between releases based on their
manifests.
Diffstat (limited to 'scripts/readmanifest.pm.in')
-rw-r--r-- | scripts/readmanifest.pm.in | 58 |
1 files changed, 33 insertions, 25 deletions
diff --git a/scripts/readmanifest.pm.in b/scripts/readmanifest.pm.in index 6e2477994a1d..766aa4219944 100644 --- a/scripts/readmanifest.pm.in +++ b/scripts/readmanifest.pm.in @@ -1,6 +1,34 @@ use strict; +sub addPatch { + my $patches = shift; + my $storePath = shift; + my $patch = shift; + + $$patches{$storePath} = [] + unless defined $$patches{$storePath}; + + my $patchList = $$patches{$storePath}; + + my $found = 0; + foreach my $patch2 (@{$patchList}) { + if ($patch2->{url} eq $patch->{url}) { + if ($patch2->{hash} eq $patch->{hash}) { + $found = 1 if ($patch2->{basePath} eq $patch->{basePath}); + } else { + die "conflicting hashes for URL $patch->{url}, " . + "namely $patch2->{hash} and $patch->{hash}"; + } + } + } + + if (!$found) { + push @{$patchList}, $patch; + } +} + + sub readManifest { my $manifest = shift; my $narFiles = shift; @@ -81,31 +109,11 @@ sub readManifest { } elsif ($type eq "patch") { - - $$patches{$storePath} = [] - unless defined $$patches{$storePath}; - - my $patchList = $$patches{$storePath}; - - my $found = 0; - foreach my $patch (@{$patchList}) { - if ($patch->{url} eq $url) { - if ($patch->{hash} eq $hash) { - $found = 1 if ($patch->{basePath} eq $basePath); - } else { - die "conflicting hashes for URL $url, " . - "namely $patch->{hash} and $hash"; - } - } - } - if (!$found) { - push @{$patchList}, - { url => $url, hash => $hash, size => $size - , basePath => $basePath, baseHash => $baseHash - , narHash => $narHash, type => $patchType - }; - } - + addPatch $patches, $storePath, + { url => $url, hash => $hash, size => $size + , basePath => $basePath, baseHash => $baseHash + , narHash => $narHash, patchType => $patchType + }; } } |