Gilles Filippini a écrit , Le -10/01/-28163 20:59:
> Trying not to include .gitignore into my source package using a
> debian/source/local-options file with:
>  extend-diff-ignore = '\.gitignore'
> 
> It doesn't work:
>  $ DIST=sid git-buildpackage --git-builder="git-pbuilder" --git-ignore-new
>  (...)
>   dpkg-source -i(?:^|/)\.git(attributes)?(?:$|/.*$) -I.git -b 
> xf86-video-glamo-0.0.0+20100630.git16af3c00
>  dpkg-source: info: using options from 
> xf86-video-glamo-0.0.0+20100630.git16af3c00/debian/source/local-options: 
> --extend-diff-ignore=\.gitignore
>  dpkg-source: warning: no source format specified in debian/source/format, 
> see dpkg-source(1)
>  dpkg-source: info: using source format `1.0'
>  dpkg-source: info: building xf86-video-glamo using existing 
> xf86-video-glamo_0.0.0+20100630.git16af3c00.orig.tar.gz
>  dpkg-source: info: building xf86-video-glamo in 
> xf86-video-glamo_0.0.0+20100630.git16af3c00-3.diff.gz
>  dpkg-source: warning: the diff modifies the following upstream files: 
>   .gitignore
>  dpkg-source: info: use the '3.0 (quilt)' format to have separate and 
> documented changes to upstream files, see dpkg-source(1)
>  dpkg-source: info: building xf86-video-glamo in 
> xf86-video-glamo_0.0.0+20100630.git16af3c00-3.dsc
>   dpkg-genchanges -S 
> >../xf86-video-glamo_0.0.0+20100630.git16af3c00-3_source.changes
> 
> It doesn't work from the command line either:
>  $ rm xf86-video-glamo-0.0.0+20100630.git16af3c00/debian/source/local-options 
>  $ dpkg-source -i'(?:^|/)\.git(attributes)?(?:$|/.*$)' 
> --extend-diff-ignore='\.gitignore' -I.git -b 
> xf86-video-glamo-0.0.0+20100630.git16af3c00/
>  dpkg-source: avertissement: aucun format source indiqué dans 
> debian/source/format, voir dpkg-source(1)
>  dpkg-source: info: utilisation du format source « 1.0 »
>  dpkg-source: info: construction de xf86-video-glamo à partir de 
> xf86-video-glamo_0.0.0+20100630.git16af3c00.orig.tar.gz
>  dpkg-source: info: construction de xf86-video-glamo dans 
> xf86-video-glamo_0.0.0+20100630.git16af3c00-3.diff.gz
>  dpkg-source: avertissement: le fichier de différences modifie les fichiers 
> amont suivants : 
>   .gitignore
>  dpkg-source: info: choisissez le format « 3.0 (quilt) » pour utiliser des 
> modifications séparées et documentées dans les sources amont, voir 
> dpkg-source(1)
>  dpkg-source: info: construction de xf86-video-glamo dans 
> xf86-video-glamo_0.0.0+20100630.git16af3c00-3.dsc
> 
> But forcing everything into one diff-ignore regex does work:
>  $ dpkg-source -i'(?:^|/)\.git(attributes)?(?:$|/.*$)|\.gitignore' -I.git -b 
> xf86-video-glamo-0.0.0+20100630.git16af3c00/
>  dpkg-source: avertissement: aucun format source indiqué dans 
> debian/source/format, voir dpkg-source(1)
>  dpkg-source: info: utilisation du format source « 1.0 »
>  dpkg-source: info: construction de xf86-video-glamo à partir de 
> xf86-video-glamo_0.0.0+20100630.git16af3c00.orig.tar.gz
>  dpkg-source: info: construction de xf86-video-glamo dans 
> xf86-video-glamo_0.0.0+20100630.git16af3c00-3.diff.gz
>  dpkg-source: info: construction de xf86-video-glamo dans 
> xf86-video-glamo_0.0.0+20100630.git16af3c00-3.dsc

The attached patch appears to solve my problem, with
--extend-diff-ignore specified either from the command line or from a
debian/source/[local-]options file.

Rationals are:
* options from the command line should be interpreted first
* then should come options from debian/source/options
* and finally options from debian/source/local-options
* --extend-diff-ignore should actually extend diff-ignore instead of the
default diff-ignore regex.

Please consider including it.

Thanks,

_g.
--- /usr/bin/dpkg-source	2011-04-16 03:54:49.000000000 +0200
+++ ./dpkg-source	2011-05-06 01:41:43.000000000 +0200
@@ -113,7 +113,7 @@
 	"options" => qr/^--(?:format=|unapply-patches$|abort-on-upstream-changes$)/,
 	"local-options" => qr/^--format=/,
     };
-    foreach my $filename ("local-options", "options") {
+    foreach my $filename ("options", "local-options") {
 	my $conf = Dpkg::Conf->new();
 	my $optfile = File::Spec->catfile($dir, "debian", "source", $filename);
 	next unless -f $optfile;
@@ -122,7 +122,7 @@
 	if (@$conf) {
 	    info(_g("using options from %s: %s"), $optfile, join(" ", @$conf))
 		unless $options{'opmode'} eq "--print-format";
-	    unshift @options, @$conf;
+	    push @options, @$conf;
 	}
     }
 }
@@ -157,7 +157,11 @@
     } elsif (m/^-(?:i|-diff-ignore(?:$|=))(.*)$/) {
         $options{'diff_ignore_regexp'} = $1 ? $1 : $Dpkg::Source::Package::diff_ignore_default_regexp;
     } elsif (m/^--extend-diff-ignore=(.+)$/) {
-	$Dpkg::Source::Package::diff_ignore_default_regexp .= "|$1";
+        if ($options{'diff_ignore_regexp'}) {
+            $options{'diff_ignore_regexp'} .= "|$1";
+        } else {
+            $options{'diff_ignore_regexp'} = $Dpkg::Source::Package::diff_ignore_default_regexp . "|$1";
+        }
     } elsif (m/^-(?:I|-tar-ignore=)(.+)$/) {
         push @{$options{'tar_ignore'}}, $1;
     } elsif (m/^-(?:I|-tar-ignore)$/) {

Reply via email to