From f548f40ba483fe8c2b0eab32ccfd1f3bd3cf769e Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Mon, 24 Sep 2007 21:37:21 +0200 Subject: [PATCH] dpkg-source: Allow -I without a pattern This loads a default list of pattern mostly similar to the default regexp of -i. --- ChangeLog | 9 +++++++++ debian/changelog | 3 +++ man/ChangeLog | 5 +++++ man/dpkg-source.1 | 12 ++++++++--- scripts/dpkg-source.pl | 46 ++++++++++++++++++++++++++++++++++++++++-- 5 files changed, 70 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 44a79668..30375cbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,15 @@ * scripts/dpkg-buildpackage.pl ($warnable_errors): Rename to ... ($warnable_error): ... this, and declare as 'our'. +2007-09-24 Jari Aalto + Frank Lichtenheld + + * scripts/dpkg-source.pl: Allow use of -I + without filename pattern and load a list + of default patterns which is in effect as + similar as possible to the default regexp + of -i. + 2007-09-23 Frank Lichtenheld * scripts/dpkg-buildpackage.pl: Add new option diff --git a/debian/changelog b/debian/changelog index 836e1090..70d0190e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -23,6 +23,9 @@ dpkg (1.14.7) UNRELEASED; urgency=low MAKEFLAGS(-j) and DEB_BUILD_OPTIONS(parallel=) accordingly. parallel= in DEB_BUILD_OPTIONS will be passed to MAKEFLAGS as well. Based on an idea by Robert Millan. Closes: #440636 + * Allow dpkg-source -I without a pattern which will load a default + list of pattern similar to -i without regexp. Patch by + Jari Aalto. Closes: #440972 [ Updated dpkg translations ] * Basque (Piarres Beobide). Closes: #440859 diff --git a/man/ChangeLog b/man/ChangeLog index 8ecb9324..ebc4d959 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2007-09-24 Jari Aalto + + * dpkg-source.1: Document new behaviour + of -I option. + 2007-09-23 Frank Lichtenheld * dpkg-buildpackage.1: Document the new -j diff --git a/man/dpkg-source.1 b/man/dpkg-source.1 index e83156fe..faaf238f 100644 --- a/man/dpkg-source.1 +++ b/man/dpkg-source.1 @@ -126,12 +126,18 @@ from the ones in your working directory, thus causing them to be unnecessarily included in every .diff.gz, unless you use the \fB\-i\fR switch. .TP -.BI \-I filename -If this option is specified, the filename will be passed to tar's \-\-exclude +.BI \-I[\fIfile-pattern\fP] + +If this option is specified, the pattern will be passed to tar's \-\-exclude option when it is called to generate a .orig.tar.gz or .tar.gz file. For example, \-ICVS will make tar skip over CVS directories when generating a .tar.gz file. The option may be repeated multiple times to list multiple -filenames to exclude. +patterns to exclude. + +\fB\-I\fR by itself adds default tar(1) \-\-exclude options that will +filter out control files and directories of the most common revision +control systems, backup and swap files and Libtool build output +directories. .PP All the .BI \-s X diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl index 83f63aa9..5b7802df 100755 --- a/scripts/dpkg-source.pl +++ b/scripts/dpkg-source.pl @@ -34,6 +34,37 @@ my $diff_ignore_default_regexp = ' \.shelf|_MTN|\.bzr(?:\.backup|tags)?)(?:$|/.*$) '; +no warnings 'qw'; +my @tar_ignore_default_pattern = qw( +*.a +*.la +*.o +*.so +*.swp +*~ +,,* +.[#~]* +.arch-ids +.arch-inventory +.bzr +.bzr.backup +.bzr.tags +.bzrignore +.cvsignore +.deps +.git +.gitignore +.hg +.shelf +.svn +CVS +DEADJOE +RCS +_MTN +_darcs +{arch} +); + # Take out comments and newlines $diff_ignore_default_regexp =~ s/^#.*$//mg; $diff_ignore_default_regexp =~ s/\n//sg; @@ -129,7 +160,8 @@ Build options: -q quiet operation, do not print warnings. -i[] filter out files to ignore diffs of (defaults to: '%s'). - -I filter out files when building tarballs. + -I[] filter out files when building tarballs + (defaults to: %s). -sa auto select orig source (-sA is default). -sk use packed orig source (unpack & keep). -sp use packed orig source (unpack & remove). @@ -147,7 +179,9 @@ Extract options: General options: -h, --help show this help message. --version show the version. -"), $progname, $diff_ignore_default_regexp; +"), $progname, + $diff_ignore_default_regexp, + join('', map { " -I$_" } @tar_ignore_default_pattern); } sub handleformat { @@ -158,6 +192,7 @@ sub handleformat { my $opmode; +my $tar_ignore_default_pattern_done; while (@ARGV && $ARGV[0] =~ m/^-/) { $_=shift(@ARGV); @@ -183,6 +218,13 @@ while (@ARGV && $ARGV[0] =~ m/^-/) { $diff_ignore_regexp = $1 ? $1 : $diff_ignore_default_regexp; } elsif (m/^-I(.+)$/) { push @tar_ignore, "--exclude=$1"; + } elsif (m/^-I$/) { + unless ($tar_ignore_default_pattern_done) { + push @tar_ignore, + map { "--exclude=$_" } @tar_ignore_default_pattern; + # Prevent adding multiple times + $tar_ignore_default_pattern_done = 1; + } } elsif (m/^-V(\w[-:0-9A-Za-z]*)[=:]/) { $substvar{$1}= "$'"; } elsif (m/^-T/) { -- 2.39.5