Parcourir la source

Dpkg::Source::Patch: let analyze() extract the patch header too

Raphaël Hertzog il y a 14 ans
Parent
commit
d26b98123b
1 fichiers modifiés avec 8 ajouts et 1 suppressions
  1. 8 1
      scripts/Dpkg/Source/Patch.pm

+ 8 - 1
scripts/Dpkg/Source/Patch.pm

@@ -319,6 +319,7 @@ sub analyze {
     my %filepatched;
     my %filepatched;
     my %dirtocreate;
     my %dirtocreate;
     my @patchorder;
     my @patchorder;
+    my $patch_header = '';
     my $diff_count = 0;
     my $diff_count = 0;
 
 
     sub getline {
     sub getline {
@@ -375,7 +376,12 @@ sub analyze {
     while (defined($_) || not eof($self)) {
     while (defined($_) || not eof($self)) {
 	my (%path, %fn);
 	my (%path, %fn);
 	# skip comments leading up to patch (if any)
 	# skip comments leading up to patch (if any)
-	until (/^--- /) {
+	while (1) {
+	    if (/^--- /) {
+		last;
+	    } else {
+		$patch_header .= "$_\n";
+	    }
 	    last HUNK if not defined($_ = getline($self));
 	    last HUNK if not defined($_ = getline($self));
 	}
 	}
 	$diff_count++;
 	$diff_count++;
@@ -492,6 +498,7 @@ sub analyze {
     *$self->{'analysis'}{$destdir}{"dirtocreate"} = \%dirtocreate;
     *$self->{'analysis'}{$destdir}{"dirtocreate"} = \%dirtocreate;
     *$self->{'analysis'}{$destdir}{"filepatched"} = \%filepatched;
     *$self->{'analysis'}{$destdir}{"filepatched"} = \%filepatched;
     *$self->{'analysis'}{$destdir}{"patchorder"} = \@patchorder;
     *$self->{'analysis'}{$destdir}{"patchorder"} = \@patchorder;
+    *$self->{'analysis'}{$destdir}{"patchheader"} = $patch_header;
     return *$self->{'analysis'}{$destdir};
     return *$self->{'analysis'}{$destdir};
 }
 }