Explorar el Código

dpkg-source: enhance --commit to auto-whitelist modified binary files

That way the same command can be used whatever kind of upstream files has
been modified.

Reported-by: Cyril Brulebois <kibi@debian.org>
Raphaël Hertzog hace 14 años
padre
commit
d334aee245
Se han modificado 3 ficheros con 18 adiciones y 1 borrados
  1. 3 0
      debian/changelog
  2. 5 0
      man/dpkg-source.1
  3. 10 1
      scripts/Dpkg/Source/Package/V2.pm

+ 3 - 0
debian/changelog

@@ -8,6 +8,9 @@ dpkg (1.16.5) UNRELEASED; urgency=low
   * When dpkg-source regenerates the automatic patch (with formats "2.0"
   * When dpkg-source regenerates the automatic patch (with formats "2.0"
     or "3.0 (quilt)") it will keep the current patch header to avoid
     or "3.0 (quilt)") it will keep the current patch header to avoid
     losing changes made by the maintainer.
     losing changes made by the maintainer.
+  * Modify dpkg-source --commit to auto-whitelist modified binary files.
+    That way the same command can be used whatever kind of upstream files
+    has been modified.
 
 
   [ Updated dpkg translations ]
   [ Updated dpkg translations ]
   * Swedish (Peter Krefting).
   * Swedish (Peter Krefting).

+ 5 - 0
man/dpkg-source.1

@@ -517,6 +517,11 @@ pre-generated this file, and on this ground the given file is removed
 after integration. Note also that the changes contained in the patch file
 after integration. Note also that the changes contained in the patch file
 must already be applied on the tree and that the files modified by the
 must already be applied on the tree and that the files modified by the
 patch must not have supplementary unrecorded changes.
 patch must not have supplementary unrecorded changes.
+
+If the patch generation detects modified binary files, they will be
+automatically added to \fBdebian/source/include\-binaries\fP so that
+they end up in the debian tarball (exactly like \fBdpkg-source
+\-\-include\-binaries \-b\fP would do).
 .PP
 .PP
 .B Build options
 .B Build options
 .TP
 .TP

+ 10 - 1
scripts/Dpkg/Source/Package/V2.pm

@@ -619,8 +619,17 @@ sub do_commit {
         error(_g("patch file '%s' doesn't exist"), $tmpdiff) if not -e $tmpdiff;
         error(_g("patch file '%s' doesn't exist"), $tmpdiff) if not -e $tmpdiff;
     }
     }
 
 
+    my $binaryfiles = Dpkg::Source::Package::V2::BinaryFiles->new($dir);
+    my $handle_binary = sub {
+        my ($self, $old, $new) = @_;
+        my $fn = File::Spec->abs2rel($new, $dir);
+        $binaryfiles->new_binary_found($fn);
+    };
+
     unless ($tmpdiff) {
     unless ($tmpdiff) {
-        $tmpdiff = $self->generate_patch($dir, usage => "commit");
+        $tmpdiff = $self->generate_patch($dir, handle_binary => $handle_binary,
+                                         usage => "commit");
+        $binaryfiles->update_debian_source_include_binaries();
     }
     }
     push @Dpkg::Exit::handlers, sub { unlink($tmpdiff) };
     push @Dpkg::Exit::handlers, sub { unlink($tmpdiff) };
     unless (-s $tmpdiff) {
     unless (-s $tmpdiff) {