Sfoglia il codice sorgente

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 anni fa
parent
commit
3378e8fa43

+ 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.
   * 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).

+ 5 - 0
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)".

+ 3 - 0
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

+ 1 - 0
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;
 }

+ 14 - 11
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;
+	}
     }
 }