diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-02-28T14·12+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-02-28T14·12+0000 |
commit | 2c4302dd7a437c3153d6de704fb5ddec004ea308 (patch) | |
tree | bdc1a2658e48e56218127ded022ec70013352fe9 /scripts/generate-patches.pl.in | |
parent | 8376fff1518415a0d48b34e91298c846b0ab6b95 (diff) |
* Added a disambiguation heuristic: if two components have the same
name but differ to much in sice (by more than a factor of 3), then never generate a patch.
Diffstat (limited to 'scripts/generate-patches.pl.in')
-rwxr-xr-x | scripts/generate-patches.pl.in | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/scripts/generate-patches.pl.in b/scripts/generate-patches.pl.in index ef4ddcda4af5..87334b5fcb8e 100755 --- a/scripts/generate-patches.pl.in +++ b/scripts/generate-patches.pl.in @@ -134,11 +134,11 @@ print "creating patches...\n"; foreach my $p (keys %dstOutPaths) { # If exactly the same path already exists in the source, skip it. - next if defined $srcOutPaths{$p}; +# !!! next if defined $srcOutPaths{$p}; -# print " $p\n"; + print " $p\n"; - # If not, then we should find the path in the source that is + # If not, then we should find the paths in the source that are # `most' likely to be present on a system that wants to install # this path. @@ -153,6 +153,22 @@ foreach my $p (keys %dstOutPaths) { foreach my $q (keys %srcOutPaths) { (my $name2, my $version2) = getNameVersion $q; if ($name eq $name2) { + + # If the sizes differ to much, then skip. This + # disambiguates between, e.g., a real component and a + # wrapper component (cf. Firefox in Nixpkgs). + my $srcSize = @{$srcNarFiles{$q}}[0]->{size}; + my $dstSize = @{$dstNarFiles{$p}}[0]->{size}; + my $ratio = $srcSize / $dstSize; + $ratio = 1 / $ratio if $ratio < 1; + print " $srcSize $dstSize $ratio $q\n"; + + if ($ratio >= 3) { + print " SKIPPING $q due to size ratio $ratio\n"; + } + + # If there are multiple matching names, include the ones + # with the closest version numbers. my $dist = versionDiff $version, $version2; if ($dist > $minDist) { $minDist = $dist; @@ -174,6 +190,8 @@ foreach my $p (keys %dstOutPaths) { # Generate a patch between $closest and $p. print " $p <- $closest\n"; + next; + # If the patch already exists, skip it. if (containsPatch(\%srcPatches, $p, $closest) || containsPatch(\%dstPatches, $p, $closest)) @@ -242,6 +260,8 @@ foreach my $p (keys %dstOutPaths) { } } +exit 0; # !!! + # Add in any potentially useful patches in the source (namely, those # patches that produce either paths in the destination or paths that |