ooo-build r15236 - in branches/ooo-build-3-0-1: . patches



Author: pmladek
Date: Thu Jan 29 10:35:50 2009
New Revision: 15236
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15236&view=rev

Log:
2009-01-29  Petr Mladek  <pmladek suse cz>

	* patches/apply.pl.in: (backport from trunk) add --hotfixes=<dir>
	  option to define another directory with hotfixes; improves the
	  hotfixes handling; the diff in the hotfixes dir overrrides the
	  original diff of the same name; the other diff files in the
	  hotfixes direcotry (with new names) are applied in the alphabetical
	  order after all the regular diffs; the new functionality is useful
	  for post-release hotfixes of the already included patches




Modified:
   branches/ooo-build-3-0-1/ChangeLog
   branches/ooo-build-3-0-1/patches/apply.pl.in

Modified: branches/ooo-build-3-0-1/patches/apply.pl.in
==============================================================================
--- branches/ooo-build-3-0-1/patches/apply.pl.in	(original)
+++ branches/ooo-build-3-0-1/patches/apply.pl.in	Thu Jan 29 10:35:50 2009
@@ -392,11 +392,13 @@
 sub list_patches(@) {
     my ( @distros ) = @_;
 
+    my %Hotfixes = ();
+    detect_hotfixes( \%Hotfixes );
     my @Patches = ();
     foreach $distro ( @distros ) {
-	@Patches = ( @Patches, list_patches_single( $distro ) );
+	@Patches = ( @Patches, list_patches_single( $distro, \%Hotfixes ) );
     }
-    @Patches = ( @Patches, list_hotfix_patches() );
+    @Patches = ( @Patches, list_hotfixes(\%Hotfixes) );
 
     return @Patches;
 }
@@ -426,6 +428,7 @@
     }
 
     my $forDistro = shift;
+    my $pHotfixes = shift;
     my @Patches = ();
 
     open (PatchList, "$apply_list") || die "Can't find $apply_list";
@@ -488,7 +491,16 @@
 		    next;
 		}
 
-		push @Patches, find_patch_file ($patch_name);
+		# look if we have a hotfix that would replace this patch
+		if ( defined $pHotfixes->{$patch_name} ) {
+		    my $orig_file = find_patch_file ($patch_name);
+		    print "Warning: \"$pHotfixes->{$patch_name}\" is used instead of \"$orig_file\"\n";
+		    push @Patches, $pHotfixes->{$patch_name};
+		    $pHotfixes->{$patch_name} = undef;
+		} else {
+		    push @Patches, find_patch_file ($patch_name);
+		}
+		
 		next;
 	    }
 
@@ -578,21 +590,37 @@
     return @Patches;
 }
 
-sub list_hotfix_patches
+sub detect_hotfixes($)
 {
+    my $pHotfixes = shift;
     my $dirh;
-    my @hotfix_patches;
 
-    if (opendir($dirh, $hotfixes_dir)) {
-	while (my $file = readdir ($dirh)) {
-	    $file =~ /^\./ && next;     # hidden
-	    $file =~ /\.diff$/ || next; # non-patch
-	    push @hotfix_patches, "$hotfixes_dir/$file";
+    foreach my $dir ( $hotfixes_dir, $extra_hotfixes_dir ) {
+	if ( ($dir ne "") && opendir($dirh, $dir)) {
+	    while (my $file = readdir ($dirh)) {
+		$file =~ /^\./ && next;     # hidden
+		$file =~ /\.diff$/ || next; # non-patch
+		$pHotfixes->{"$file"} = "$dir/$file";
+	    }
+	    closedir($dirh);
+	}
+    }
+    	
+    return;
+}
+
+sub list_hotfixes($)
+{
+    my $pHotfixes = shift;
+    my @Patches = ();
+
+    foreach my $patch ( sort (keys %{$pHotfixes} ) ) {
+	if ( defined $pHotfixes->{$patch} ) {
+	    push @Patches, "$pHotfixes->{$patch}";
 	}
-	closedir($dirh);
     }
     	
-    return (sort @hotfix_patches);
+    return (@Patches);
 }
 
 sub applied_patches_list
@@ -998,7 +1026,7 @@
 
 (@ARGV > 1) ||
     die "Syntax:\n".
-    "apply <path-to-patchdir> <src root> --tag=<src680-m90> [--distro=<Debian> [--distro=<Binfilter> [...]]] [--quiet] [--dry-run] [ patch flags ]\n" .
+    "apply <path-to-patchdir> <src root> --tag=<src680-m90> [--distro=<Debian> [--distro=<Binfilter> [...]]] [--hotfixes=<dir>] [--quiet] [--dry-run] [ patch flags ]\n" .
     "apply <path-to-patchdir> --series-from=<Debian>\n" .
     "apply <path-to-patchdir> --add-developer\n" .
     "apply <path-to-patchdir> --find-unused\n" .
@@ -1016,6 +1044,7 @@
 @distros = ();
 $additional_sections = "";
 $additional_sections_applied = 0;
+$extra_hotfixes_dir = "";
 $tag = '';
 $dry_run = 0;
 $find_unused = 0;
@@ -1052,6 +1081,8 @@
 	    push @distros, $1;
 	} elsif ($a =~ m/--additional-sections=(.*)/) {
 	    $additional_sections="$1";
+	} elsif ($a =~ m/--hotfixes=(.*)/) {
+	    $extra_hotfixes_dir="$1";
 	} elsif ($a =~ m/--add-developer/) {
 	    $add_developer = 1;
 	    $quiet = 1;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]