瀏覽代碼

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.
Raphaël Hertzog 16 年之前
父節點
當前提交
3378e8fa43
共有 5 個文件被更改,包括 25 次插入11 次删除
  1. 2 0
      debian/changelog
  2. 5 0
      man/dpkg-source.1
  3. 3 0
      scripts/Dpkg/Source/Package.pm
  4. 1 0
      scripts/Dpkg/Source/Package/V1.pm
  5. 14 11
      scripts/dpkg-source.pl

+ 2 - 0
debian/changelog

@@ -10,6 +10,8 @@ dpkg (1.15.6.2) UNRELEASED; urgency=low
   * Add .gitattributes to list of files ignored by dpkg-source.
   * Add .gitattributes to list of files ignored by dpkg-source.
   * Document most common warnings and errors of dpkg-source in its manual
   * Document most common warnings and errors of dpkg-source in its manual
     page.
     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 ]
   [ Updated dpkg translations ]
   * German (Sven Joachim).
   * German (Sven Joachim).

+ 5 - 0
man/dpkg-source.1

@@ -594,6 +594,11 @@ Here's an example of such a file:
 .P
 .P
 Note: \fBformat\fR options are not accepted in this file, you should
 Note: \fBformat\fR options are not accepted in this file, you should
 use \fBdebian/source/format\fR instead.
 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
 .SS debian/source/patch-header
 Free form text that is put on top of the automatic patch generated
 Free form text that is put on top of the automatic patch generated
 in formats "2.0" or "3.0 (quilt)".
 in formats "2.0" or "3.0 (quilt)".

+ 3 - 0
scripts/Dpkg/Source/Package.pm

@@ -44,6 +44,8 @@ our $diff_ignore_default_regexp = '
 (?:^|/)\..*\.sw.$|
 (?:^|/)\..*\.sw.$|
 # Ignore baz-style junk files or directories
 # 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)
 # File-names that should be ignored (never directories)
 (?:^|/)(?:DEADJOE|\.arch-inventory|\.(?:bzr|cvs|hg|git)ignore)$|
 (?:^|/)(?:DEADJOE|\.arch-inventory|\.(?:bzr|cvs|hg|git)ignore)$|
 # File or directory names that should be ignored
 # File or directory names that should be ignored
@@ -86,6 +88,7 @@ RCS
 _MTN
 _MTN
 _darcs
 _darcs
 {arch}
 {arch}
+debian/source/local-options
 );
 );
 
 
 # Object methods
 # Object methods

+ 1 - 0
scripts/Dpkg/Source/Package/V1.pm

@@ -43,6 +43,7 @@ sub init_options {
     my ($self) = @_;
     my ($self) = @_;
     # Don't call $self->SUPER::init_options() on purpose, V1.0 has no
     # Don't call $self->SUPER::init_options() on purpose, V1.0 has no
     # ignore by default
     # ignore by default
+    $self->{'options'}{'diff_ignore_regexp'} = '(?:^|/)debian/source/local-options$';
     $self->{'options'}{'sourcestyle'} ||= 'X';
     $self->{'options'}{'sourcestyle'} ||= 'X';
     $self->{'options'}{'skip_debianization'} ||= 0;
     $self->{'options'}{'skip_debianization'} ||= 0;
 }
 }

+ 14 - 11
scripts/dpkg-source.pl

@@ -102,17 +102,20 @@ if (defined($options{'opmode'}) &&
     if (not -d $dir) {
     if (not -d $dir) {
 	error(_g("directory argument %s is not a directory"), $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;
+	}
     }
     }
 }
 }