* Sun 2007-09-23 Frank Lichtenheld <djpig AT debian.org> INBOX > >> Here is patch to make -I behave like -i, that is to supply default option >> of given standalone. >> +my $diff_I_opt_default_regexp = " >> +--exclude=.[#~]* > ... > > It would probably be better to add the --exclude after the fact since > that is just redundant here and will bloat the usage message. Also > the variable is wrongly named since -I has nothing to do with the > diff...
Below new patch according to comment. Jari man/dpkg-source.1 | 12 +++++++-- scripts/dpkg-source.pl | 57 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/man/dpkg-source.1 b/man/dpkg-source.1 index e83156f..faaf238 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 83f63aa..7f9e10b 100755 --- a/scripts/dpkg-source.pl +++ b/scripts/dpkg-source.pl @@ -34,6 +34,42 @@ my $diff_ignore_default_regexp = ' \.shelf|_MTN|\.bzr(?:\.backup|tags)?)(?:$|/.*$) '; +my $ignore_tar_default_regexp = " +.[#~]* +*[#~] +'{arch}' +.a +.arch-ids +.arch-inventory +.bzr +.bzr.backup +.bzr.tags +.bzrignore +.cvsignore +.deps +.git +.gitignore +.hg +.la +.o +.shelf +.so +.svn +.swp +CVS +DEADJOE +RCS +_MTN +_darcs +"; + +# Remove possible leading and trailing whitespace +$ignore_tar_default_regexp =~ s/\A\s+//; +$ignore_tar_default_regexp =~ s/\s+\Z//; + +# Remove possible comment lines; remove newllines to spaces +$ignore_tar_default_regexp =~ s/#*\s*[\r\n]+/ /gm; + # Take out comments and newlines $diff_ignore_default_regexp =~ s/^#.*$//mg; $diff_ignore_default_regexp =~ s/\n//sg; @@ -107,6 +143,9 @@ later for copying conditions. There is NO warranty. } sub usage { + + (my $tmp = $ignore_tar_default_regexp) =~ s/(?:\A|\s+)(\S+)/ -I$1/g; + printf _g( "Usage: %s [<option> ...] <command> @@ -129,7 +168,8 @@ Build options: -q quiet operation, do not print warnings. -i[<regexp>] filter out files to ignore diffs of (defaults to: '%s'). - -I<filename> filter out files when building tarballs. + -I[<pattern>] 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 +187,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, + $tmp; } sub handleformat { @@ -158,6 +200,7 @@ sub handleformat { my $opmode; +my $ignore_tar_default_regexp_done; while (@ARGV && $ARGV[0] =~ m/^-/) { $_=shift(@ARGV); @@ -183,6 +226,16 @@ 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 ($ignore_tar_default_regexp_done) + { + my $tmp = $ignore_tar_default_regexp; + $tmp =~ s/(?:\A|\s+)(\S+)/ --exclude=$1/g; + push @tar_ignore, split /\s+/, $tmp; + + # Prevent adding multiple times + $ignore_tar_default_regexp_done = 1; + } } elsif (m/^-V(\w[-:0-9A-Za-z]*)[=:]/) { $substvar{$1}= "$'"; } elsif (m/^-T/) { -- Welcome to FOSS revolution: we fix and modify until it shines -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]