The following commit has been merged in the master branch:
commit b636de1a3e9b1e131c055c2c0e8bcd1097736925
Author: Raphaël Hertzog <[email protected]>
Date: Sun Aug 16 15:16:58 2009 +0200
dpkg-scansources: implement --extra-override
diff --git a/debian/changelog b/debian/changelog
index 964b841..a5c6f73 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -51,6 +51,7 @@ dpkg (1.15.4) UNRELEASED; urgency=low
be installed due to a conflicting file instead of quoting the master link.
* Add support for extra override file in dpkg-scanpackages. Thanks to Robert
Millan for the patch. Closes: #537559
+ * Add support for extra override file in dpkg-scansources.
* Update sample in dpkg-gensymbols(1) to give an accurate listing of
64 bit arches. Thanks to Julien Cristau for the patch. Closes: #540382
* Create /etc/cron.daily/dpkg to handle the backup of
diff --git a/man/dpkg-scansources.1 b/man/dpkg-scansources.1
index f4b3bfb..4e58428 100644
--- a/man/dpkg-scansources.1
+++ b/man/dpkg-scansources.1
@@ -46,6 +46,10 @@ sources).
.IP "\fB\-n\fR, \fB\-\-no\-sort\fR" 4
Don't sort the index records. Normally they are sorted by source package
name.
+.TP
+.IP "\fB\-e\fR, \fB\-\-extra\-override\fR \fIfile\fP" 4
+Scan \fIfile\fP to find supplementary overrides. Each line contains 3
+space separated fields: package name, field name to override, new field value.
.IP "\fB\-s\fR, \fB\-\-source\-override\fR \fIfile\fR" 4
Use \fIfile\fR as the source override file. The default is the name of the
override file you specified with \fI.src\fR appended.
diff --git a/scripts/dpkg-scansources.pl b/scripts/dpkg-scansources.pl
index a0bffad..cd0c437 100755
--- a/scripts/dpkg-scansources.pl
+++ b/scripts/dpkg-scansources.pl
@@ -48,6 +48,7 @@ sub O_PRIORITY () { 0 }
sub O_SECTION () { 1 }
sub O_MAINT_FROM () { 2 } # undef for non-specific, else listref
sub O_MAINT_TO () { 3 } # undef if there's no maint override
+my %Extra_Override;
my %Priority = (
'extra' => 1,
@@ -62,12 +63,14 @@ my %Priority = (
my $Debug = 0;
my $No_sort = 0;
my $Src_override = undef;
+my $Extra_override_file = undef;
my @Option_spec = (
'debug!' => \$Debug,
'help!' => \&usage,
'no-sort|n' => \$No_sort,
'source-override|s=s' => \$Src_override,
+ 'extra-override|e=s' => \$Extra_override_file,
'version' => \&version,
);
@@ -86,6 +89,8 @@ sub usage {
Options:
-n, --no-sort don't sort by package before outputting.
+ -e, --extra-override <file>
+ use extra override file.
-s, --source-override <file>
use file for additional source overrides, default
is regular override file with .src appended.
@@ -221,6 +226,23 @@ sub load_src_override {
close SRC_OVERRIDE or syserr(_g("error closing source override file"));
}
+sub load_override_extra
+{
+ my $extra_override = shift;
+ open(OVERRIDE, "<", $extra_override) or
+ syserr(_g("Couldn't open override file %s"), $extra_override);
+
+ while (<OVERRIDE>) {
+ s/\#.*//;
+ s/\s+$//;
+ next unless $_;
+
+ my ($p, $field, $value) = split(/\s+/, $_, 3);
+ $Extra_Override{$p}{$field} = $value;
+ }
+ close(OVERRIDE);
+}
+
# Given PREFIX and DSC-FILE, process the file and returns the fields.
sub process_dsc {
@@ -280,6 +302,14 @@ sub process_dsc {
}
}
+ # Process extra override
+ if (exists $Extra_Override{$source}) {
+ my ($field, $value);
+ while(($field, $value) = each %{$Extra_Override{$source}}) {
+ $fields->{$field} = $value;
+ }
+ }
+
# A directory field will be inserted just before the files field.
my $dir;
$dir = ($file =~ s-(.*)/--) ? $1 : '';
@@ -323,6 +353,7 @@ sub main {
load_override $override if defined $override;
load_src_override $Src_override, $override;
+ load_extra_override $Extra_override_file if defined $Extra_override_file;
open FIND, "find \Q$dir\E -follow -name '*.dsc' -print |"
or syserr(_g("can't fork"));
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]