The following commit has been merged in the master branch:
commit 3378e8fa435abe79e9bd3cea07b02f562b906695
Author: Raphaël Hertzog <[email protected]>
Date:   Thu Apr 1 21:05:35 2010 +0200

    dpkg-source: support debian/source/local-options
    
    It's like debian/source/options but it's not stored in the generated
    source package. This is ensured by the way of being part of the default
    ignore lists (-i and -I) and being explicitely excluded for the old
    1.0 format that doesn't use the default ignore list.

diff --git a/debian/changelog b/debian/changelog
index 80d75cd..7915f81 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,8 @@ dpkg (1.15.6.2) UNRELEASED; urgency=low
   * Add .gitattributes to list of files ignored by dpkg-source.
   * Document most common warnings and errors of dpkg-source in its manual
     page.
+  * Let dpkg-source read options from debian/source/local-options as well but
+    do not include that file in the generated source package.
 
   [ Updated dpkg translations ]
   * German (Sven Joachim).
diff --git a/man/dpkg-source.1 b/man/dpkg-source.1
index b81ae9d..a7913c2 100644
--- a/man/dpkg-source.1
+++ b/man/dpkg-source.1
@@ -594,6 +594,11 @@ Here's an example of such a file:
 .P
 Note: \fBformat\fR options are not accepted in this file, you should
 use \fBdebian/source/format\fR instead.
+.SS debian/source/local-options
+Exactly like \fBdebian/source/options\fP except that the file is not
+included in the generated source package. It can be useful to store
+a preference tied to the maintainer or to the VCS repository where
+the source package is maintained.
 .SS debian/source/patch-header
 Free form text that is put on top of the automatic patch generated
 in formats "2.0" or "3.0 (quilt)".
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index c7c4554..a47af98 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -44,6 +44,8 @@ our $diff_ignore_default_regexp = '
 (?:^|/)\..*\.sw.$|
 # Ignore baz-style junk files or directories
 (?:^|/),,.*(?:$|/.*$)|
+# local-options must not be exported in the resulting source package
+(?:^|/)debian/source/local-options$|
 # File-names that should be ignored (never directories)
 (?:^|/)(?:DEADJOE|\.arch-inventory|\.(?:bzr|cvs|hg|git)ignore)$|
 # File or directory names that should be ignored
@@ -86,6 +88,7 @@ RCS
 _MTN
 _darcs
 {arch}
+debian/source/local-options
 );
 
 # Object methods
diff --git a/scripts/Dpkg/Source/Package/V1.pm 
b/scripts/Dpkg/Source/Package/V1.pm
index 1cc8a3d..ad4b826 100644
--- a/scripts/Dpkg/Source/Package/V1.pm
+++ b/scripts/Dpkg/Source/Package/V1.pm
@@ -43,6 +43,7 @@ sub init_options {
     my ($self) = @_;
     # Don't call $self->SUPER::init_options() on purpose, V1.0 has no
     # ignore by default
+    $self->{'options'}{'diff_ignore_regexp'} = 
'(?:^|/)debian/source/local-options$';
     $self->{'options'}{'sourcestyle'} ||= 'X';
     $self->{'options'}{'skip_debianization'} ||= 0;
 }
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index d290e3e..d8cfda2 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -102,17 +102,20 @@ if (defined($options{'opmode'}) &&
     if (not -d $dir) {
        error(_g("directory argument %s is not a directory"), $dir);
     }
-    my $conf = Dpkg::Conf->new();
-    my $optfile = File::Spec->catfile($dir, "debian", "source", "options");
-    $conf->load($optfile) if -f $optfile;
-    # --format options are not allowed, they would take precedence
-    # over real command line options, debian/source/format should be used
-    # instead
-    @$conf = grep { ! /^--format=/ } @$conf;
-    if (@$conf) {
-       info(_g("using options from %s: %s"), $optfile, join(" ", @$conf))
-           unless $options{'opmode'} eq "--print-format";
-       unshift @options, @$conf;
+    foreach my $filename ("local-options", "options") {
+       my $conf = Dpkg::Conf->new();
+       my $optfile = File::Spec->catfile($dir, "debian", "source", $filename);
+       next unless -f $optfile;
+       $conf->load($optfile);
+       # --format options are not allowed, they would take precedence
+       # over real command line options, debian/source/format should be used
+       # instead
+       @$conf = grep { ! /^--format=/ } @$conf;
+       if (@$conf) {
+           info(_g("using options from %s: %s"), $optfile, join(" ", @$conf))
+               unless $options{'opmode'} eq "--print-format";
+           unshift @options, @$conf;
+       }
     }
 }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to