* Don't generate patches if the system type differs.

This commit is contained in:
Eelco Dolstra 2010-11-29 09:26:05 +00:00
parent bd48fd97f6
commit 9737a7eba0
2 changed files with 13 additions and 2 deletions

View file

@ -228,6 +228,13 @@ foreach my $p (keys %dstOutPaths) {
if ($name eq $name2) { if ($name eq $name2) {
my $srcSystem = @{$dstNarFiles{$p}}[0]->{system};
my $dstSystem = @{$srcNarFiles{$q}}[0]->{system};
if (defined $srcSystem && defined $dstSystem && $srcSystem ne $dstSystem) {
print " SKIPPING $q due to different systems ($srcSystem vs. $dstSystem)\n";
next;
}
# If the sizes differ too much, then skip. This # If the sizes differ too much, then skip. This
# disambiguates between, e.g., a real component and a # disambiguates between, e.g., a real component and a
# wrapper component (cf. Firefox in Nixpkgs). # wrapper component (cf. Firefox in Nixpkgs).
@ -238,7 +245,7 @@ foreach my $p (keys %dstOutPaths) {
# print " SIZE $srcSize $dstSize $ratio $q\n"; # print " SIZE $srcSize $dstSize $ratio $q\n";
if ($ratio >= 3) { if ($ratio >= 3) {
print " SKIPPING $q due to size ratio $ratio ($srcSize $dstSize)\n"; print " SKIPPING $q due to size ratio $ratio ($srcSize vs. $dstSize)\n";
next; next;
} }

View file

@ -34,7 +34,7 @@ sub readManifest {
my $manifestVersion = 2; my $manifestVersion = 2;
my ($storePath, $url, $hash, $size, $basePath, $baseHash, $patchType); my ($storePath, $url, $hash, $size, $basePath, $baseHash, $patchType);
my ($narHash, $narSize, $references, $deriver, $hashAlgo, $copyFrom); my ($narHash, $narSize, $references, $deriver, $hashAlgo, $copyFrom, $system);
while (<MANIFEST>) { while (<MANIFEST>) {
chomp; chomp;
@ -56,6 +56,7 @@ sub readManifest {
undef $basePath; undef $basePath;
undef $baseHash; undef $baseHash;
undef $patchType; undef $patchType;
undef $system;
$references = ""; $references = "";
$deriver = ""; $deriver = "";
$hashAlgo = "md5"; $hashAlgo = "md5";
@ -83,6 +84,7 @@ sub readManifest {
, narHash => $narHash, narSize => $narSize , narHash => $narHash, narSize => $narSize
, references => $references , references => $references
, deriver => $deriver, hashAlgo => $hashAlgo , deriver => $deriver, hashAlgo => $hashAlgo
, system => $system
}; };
} }
@ -128,6 +130,7 @@ sub readManifest {
elsif (/^\s*References:\s*(.*)\s*$/) { $references = $1; } elsif (/^\s*References:\s*(.*)\s*$/) { $references = $1; }
elsif (/^\s*Deriver:\s*(\S+)\s*$/) { $deriver = $1; } elsif (/^\s*Deriver:\s*(\S+)\s*$/) { $deriver = $1; }
elsif (/^\s*ManifestVersion:\s*(\d+)\s*$/) { $manifestVersion = $1; } elsif (/^\s*ManifestVersion:\s*(\d+)\s*$/) { $manifestVersion = $1; }
elsif (/^\s*System:\s*(\S+)\s*$/) { $system = $1; }
# Compatibility; # Compatibility;
elsif (/^\s*NarURL:\s*(\S+)\s*$/) { $url = $1; } elsif (/^\s*NarURL:\s*(\S+)\s*$/) { $url = $1; }
@ -165,6 +168,7 @@ sub writeManifest {
if defined $narFile->{references} && $narFile->{references} ne ""; if defined $narFile->{references} && $narFile->{references} ne "";
print MANIFEST " Deriver: $narFile->{deriver}\n" print MANIFEST " Deriver: $narFile->{deriver}\n"
if defined $narFile->{deriver} && $narFile->{deriver} ne ""; if defined $narFile->{deriver} && $narFile->{deriver} ne "";
print MANIFEST " System: $narFile->{system}\n" if defined $narFile->{system};
print MANIFEST "}\n"; print MANIFEST "}\n";
} }
} }