about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2007-01-08T15·17+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2007-01-08T15·17+0000
commit50bdec410adaf4acacd40444203799ac110e34d8 (patch)
tree404cde34bd74f2ebead51626e97f114196aeecda /scripts
parent4c63f9fe0493e07039c2a75a0926d2aab8cb6549 (diff)
* Huge speedup in patch propagation (20 minutes or so to 3 seconds).
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generate-patches.pl.in23
1 files changed, 15 insertions, 8 deletions
diff --git a/scripts/generate-patches.pl.in b/scripts/generate-patches.pl.in
index 4a0233f0f931..8af5de9fe924 100755
--- a/scripts/generate-patches.pl.in
+++ b/scripts/generate-patches.pl.in
@@ -348,11 +348,22 @@ foreach my $p (keys %dstOutPaths) {
 # patches that produce either paths in the destination or paths that
 # can be used as the base for other useful patches).
 
+print "propagating patches...\n";
+
 my $changed;
 do {
     # !!! we repeat this to reach the transitive closure; inefficient
     $changed = 0;
 
+    print "loop\n";
+
+    my %dstBasePaths;
+    foreach my $q (keys %dstPatches) {
+	foreach my $patch (@{$dstPatches{$q}}) {
+	    $dstBasePaths{$patch->{basePath}} = 1;
+	}
+    }
+
     foreach my $p (keys %srcPatches) {
         my $patchList = $srcPatches{$p};
 
@@ -360,22 +371,18 @@ do {
 
         # Is path $p included in the destination?  If so, include
         # patches that produce it.
-        $include = 1 if (defined $dstNarFiles{$p});
+        $include = 1 if defined $dstNarFiles{$p};
 
         # Is path $p a path that serves as a base for paths in the
         # destination?  If so, include patches that produce it.
-        foreach my $q (keys %dstPatches) {
-            foreach my $patch (@{$dstPatches{$q}}) {
-                # !!! check baseHash
-                $include = 1 if ($p eq $patch->{basePath});
-            }
-        }
+	# !!! check baseHash
+        $include = 1 if defined $dstBasePaths{$p};
 
         if ($include) {
             foreach my $patch (@{$patchList}) {
                 $changed = 1 if addPatch \%dstPatches, $p, $patch;
             }
-        }            
+        }
         
     }