Hi, On Sun, Apr 24, 2011 at 07:01:02PM +0200, Michael Banck wrote: > I have a 90 mb source tarball, which is 528 mb unpacked. Running > dpkg-buildpackage -S on it takes ages (657 seconds, to be exact) on my > notebook, as it checks whether there are changes in the original source > to put into debian/patches/debian-changes-foo, even though I made sure > there are no such changes. > > Indeed, in most subversion-based work-flows, there are only supposed to > be changes under debian/ and changes from diffing the source are usually > bugs, not features. > > So an option which tells dpkg-source to skip diffing the original source > against the current soure tree would reduce time to build the source > package tremendously and avoid unwanted errors due to > debian/patches/debian-changes*. > > Would you accept patches for this or even want to implement this > yourself?
This just bugged me again, so I had a look at how invasive it would be. It turns out all it takes would be to let do_build() in Source/Package/V2.pm not call _generate_patch(), but include the 'Identify original tarballs' logic at the beginning of _generate_patch(). The attached patch crudely does this, but breaks all the other use-cases, of course. I think the 'Identify original tarballs' part should be factored out into a different function (_generate_patch() is at least also called from do_commit()). Michael
--- /usr/share/perl5/Dpkg/Source/Package/V2.pm.orig 2018-02-04 14:37:17.568686018 +0100 +++ /usr/share/perl5/Dpkg/Source/Package/V2.pm 2018-02-04 14:40:54.324192770 +0100 @@ -563,35 +563,58 @@ $self->register_error(); } }; + + # Identify original tarballs + my ($tarfile, %addonfile); + my $comp_ext_regex = compression_get_file_extension_regex(); + my @origtarballs; - # Create a patch - my $autopatch = File::Spec->catfile($dir, 'debian', 'patches', - $self->get_autopatch_name()); - my $tmpdiff = $self->_generate_patch($dir, order_from => $autopatch, - header_from => $autopatch, - handle_binary => $handle_binary, - skip_auto => $self->{options}{auto_commit}, - usage => 'build'); - unless (-z $tmpdiff or $self->{options}{auto_commit}) { - info(g_('you can integrate the local changes with %s'), - 'dpkg-source --commit'); - error(g_('aborting due to unexpected upstream changes, see %s'), - $tmpdiff); + foreach my $file (sort $self->find_original_tarballs()) { + if ($file =~ /\.orig\.tar\.$comp_ext_regex$/) { + if (defined($tarfile)) { + error(g_('several orig.tar files found (%s and %s) but only ' . + 'one is allowed'), $tarfile, $file); + } + $tarfile = $file; + push @origtarballs, $file; + $self->add_file($file); + $self->add_file("$file.asc") if -e "$file.asc"; + } elsif ($file =~ /\.orig-([[:alnum:]-]+)\.tar\.$comp_ext_regex$/) { + $addonfile{$1} = $file; + push @origtarballs, $file; + $self->add_file($file); + $self->add_file("$file.asc") if -e "$file.asc"; + } } - push_exit_handler(sub { unlink($tmpdiff) }); + + # Create a patch +# my $autopatch = File::Spec->catfile($dir, 'debian', 'patches', +# $self->get_autopatch_name()); +# my $tmpdiff = $self->_generate_patch($dir, order_from => $autopatch, +# header_from => $autopatch, +# handle_binary => $handle_binary, +# skip_auto => $self->{options}{auto_commit}, +# usage => 'build'); +# unless (-z $tmpdiff or $self->{options}{auto_commit}) { +# info(g_('you can integrate the local changes with %s'), +# 'dpkg-source --commit'); +# error(g_('aborting due to unexpected upstream changes, see %s'), +# $tmpdiff); +# } +# push_exit_handler(sub { unlink($tmpdiff) }); $binaryfiles->update_debian_source_include_binaries() if $include_binaries; - # Install the diff as the new autopatch - if ($self->{options}{auto_commit}) { - make_path(File::Spec->catdir($dir, 'debian', 'patches')); - $autopatch = $self->register_patch($dir, $tmpdiff, - $self->get_autopatch_name()); - info(g_('local changes have been recorded in a new patch: %s'), - $autopatch) if -e $autopatch; - rmdir(File::Spec->catdir($dir, 'debian', 'patches')); # No check on purpose - } - unlink($tmpdiff) or syserr(g_('cannot remove %s'), $tmpdiff); - pop_exit_handler(); +# # Install the diff as the new autopatch +# if ($self->{options}{auto_commit}) { +# make_path(File::Spec->catdir($dir, 'debian', 'patches')); +# $autopatch = $self->register_patch($dir, $tmpdiff, +# $self->get_autopatch_name()); +# info(g_('local changes have been recorded in a new patch: %s'), +# $autopatch) if -e $autopatch; +# rmdir(File::Spec->catdir($dir, 'debian', 'patches')); # No check on purpose +# } +# unlink($tmpdiff) or syserr(g_('cannot remove %s'), $tmpdiff); +# pop_exit_handler(); # Create the debian.tar my $debianfile = "$basenamerev.debian.tar." . $self->{options}{comp_ext};