Просмотр исходного кода

Do not print warnings resulting from the autopatch analysis

Colin's change in 40dcf24632684ec726210dd4437fdedbdbe6134e meant that the
autopatch is parsed while it's already applied and this can trigger some
undue warnings.

This patch silences them. And also deals with similar cases that were
unnoticed up to now.
Raphaël Hertzog лет назад: 15
Родитель
Сommit
34d922eef1

+ 2 - 2
scripts/Dpkg/Source/Package/V2.pm

@@ -231,7 +231,7 @@ sub unapply_patches {
         my $path = File::Spec->catfile($dir, "debian", "patches", $patch);
         info(_g("unapplying %s"), $patch) unless $opts{"quiet"};
         my $patch_obj = Dpkg::Source::Patch->new(filename => $path);
-        $patch_obj->apply($dir, force_timestamp => 1,
+        $patch_obj->apply($dir, force_timestamp => 1, verbose => 0,
                           timestamp => $timestamp,
                           add_options => [ '-E', '-R' ]);
     }
@@ -451,7 +451,7 @@ sub do_build {
     } else {
         mkpath(File::Spec->catdir($dir, "debian", "patches"));
         info(_g("local changes stored in %s, the modified files are:"), $autopatch);
-        my $analysis = $diff->analyze($dir);
+        my $analysis = $diff->analyze($dir, verbose => 0);
         foreach my $fn (sort keys %{$analysis->{'filepatched'}}) {
             print " $fn\n";
         }

+ 3 - 1
scripts/Dpkg/Source/Package/V3/quilt.pm

@@ -170,6 +170,7 @@ sub apply_quilt_patch {
 
     info(_g("applying %s"), $patch) if $opts{"verbose"};
     $obj->apply($dir, timestamp => $opts{"timestamp"},
+                verbose => $opts{"verbose"},
                 force_timestamp => 1, create_dirs => 1, remove_backup => 0,
                 options => [ '-t', '-F', '0', '-N', '-p1', '-u',
                              '-V', 'never', '-g0', '-E', '-b',
@@ -243,6 +244,7 @@ sub unapply_patches {
 
         info(_g("unapplying %s"), $patch) if $opts{"verbose"};
         $obj->apply($dir, timestamp => $opts{"timestamp"},
+                    verbose => 0,
                     force_timestamp => 1, remove_backup => 0,
                     options => [ '-R', '-t', '-N', '-p1',
                                  '-u', '-V', 'never', '-g0', '-E',
@@ -352,7 +354,7 @@ sub register_autopatch {
         # reverse-apply the patch, drop .pc/$patch, re-apply it
         # with the correct options to recreate the backup files
         my $patch_obj = Dpkg::Source::Patch->new(filename => $patch);
-        $patch_obj->apply($dir, add_options => ['-R', '-E']);
+        $patch_obj->apply($dir, add_options => ['-R', '-E'], verbose => 0);
         erasedir(File::Spec->catdir($dir, ".pc", $auto_patch));
         $self->apply_quilt_patch($dir, $auto_patch);
     } else {

+ 10 - 5
scripts/Dpkg/Source/Patch.pm

@@ -238,7 +238,7 @@ sub add_diff_directory {
     if ($opts{"order_from"} and -e $opts{"order_from"}) {
         my $order_from = Dpkg::Source::Patch->new(
             filename => $opts{"order_from"});
-        my $analysis = $order_from->analyze($basedir);
+        my $analysis = $order_from->analyze($basedir, verbose => 0);
         my %patchorder;
         my $i = 0;
         foreach my $fn (@{$analysis->{"patchorder"}}) {
@@ -314,6 +314,7 @@ sub _fail_not_same_type {
 sub analyze {
     my ($self, $destdir, %opts) = @_;
 
+    $opts{"verbose"} = 1 if not defined $opts{"verbose"};
     my $diff = $self->get_filename();
     my %filepatched;
     my %dirtocreate;
@@ -425,8 +426,10 @@ sub analyze {
         } elsif ($path{'new'} eq '/dev/null') {
             error(_g("file removal without proper filename in diff `%s' (line %d)"),
                   $diff, $. - 1) unless defined $fn{'old'};
-            warning(_g("diff %s removes a non-existing file %s (line %d)"),
-                    $diff, $fn{'old'}, $.) unless -e $fn{'old'};
+            if ($opts{"verbose"}) {
+                warning(_g("diff %s removes a non-existing file %s (line %d)"),
+                        $diff, $fn{'old'}, $.) unless -e $fn{'old'};
+            }
         }
 	my $fn = intuit_file_patched($fn{'old'}, $fn{'new'});
 
@@ -456,7 +459,8 @@ sub analyze {
 	    while ($olines || $nlines) {
 		unless (defined($_ = getline($self))) {
                     if (($olines == $nlines) and ($olines < 3)) {
-                        warning(_g("unexpected end of diff `%s'"), $diff);
+                        warning(_g("unexpected end of diff `%s'"), $diff)
+                            if $opts{"verbose"};
                         last;
                     } else {
                         error(_g("unexpected end of diff `%s'"), $diff);
@@ -480,7 +484,8 @@ sub analyze {
     }
     close($self);
     unless ($diff_count) {
-	warning(_g("diff `%s' doesn't contain any patch"), $diff);
+	warning(_g("diff `%s' doesn't contain any patch"), $diff)
+	    if $opts{"verbose"};
     }
     *$self->{'analysis'}{$destdir}{"dirtocreate"} = \%dirtocreate;
     *$self->{'analysis'}{$destdir}{"filepatched"} = \%filepatched;