The following commit has been merged in the master branch:
commit a17570383cdac5d13cff4c0e0469f22a8594ee23
Author: Raphaël Hertzog <[email protected]>
Date:   Sun Feb 21 11:04:02 2010 +0100

    dpkg-gencontrol, dpkg-genchanges, dpkg-source: support multiple -T options
    
    It allows to read substitution variables from multiple files.

diff --git a/debian/changelog b/debian/changelog
index dbe6724..33ff3bf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -46,6 +46,9 @@ dpkg (1.15.6) UNRELEASED; urgency=low
   * dpkg-buildpackage now supports options --source-option=<opt> and
     --changes-option=<opt> to forward arbitrary options to dpkg-source and
     dpkg-genchanges respectively. Closes: #566230
+  * The -T option of dpkg-{source,gencontrol,genchanges} can now be used
+    multiple times to read substitution variables from multiple files.
+    Closes: #363323
 
   [ Guillem Jover ]
   * Handle argument parsing in dpkg-checkbuilddeps and dpkg-scanpackages
diff --git a/man/dpkg-genchanges.1 b/man/dpkg-genchanges.1
index 55dfc93..b4f8511 100644
--- a/man/dpkg-genchanges.1
+++ b/man/dpkg-genchanges.1
@@ -81,7 +81,9 @@ the default is
 .BR debian/substvars .
 No variable substitution is done on any of the fields that are output,
 however the special variable \fIFormat\fR will override the field of the
-same name.
+same name. This option can be used multiple times to read substitution
+variables from multiple files.
+
 .TP
 .BI \-D field = value
 Override or add an output control file field.
diff --git a/man/dpkg-gencontrol.1 b/man/dpkg-gencontrol.1
index 31e39be..e13b556 100644
--- a/man/dpkg-gencontrol.1
+++ b/man/dpkg-gencontrol.1
@@ -48,6 +48,8 @@ Read substitution variables in
 .IR substvarsfile ;
 the default is
 .BR debian/substvars .
+This option can be used multiple times to read substitution variables from
+multiple files.
 .TP
 .BI \-D field = value
 Override or add an output control file field.
diff --git a/man/dpkg-source.1 b/man/dpkg-source.1
index dd03e6c..42f0ab0 100644
--- a/man/dpkg-source.1
+++ b/man/dpkg-source.1
@@ -110,7 +110,8 @@ See \fBdeb\-substvars\fP(5) for a discussion of output 
substitution.
 .BI \-T substvarsfile
 Read substitution variables in
 .IR substvarsfile ;
-the default is to not read any file.
+the default is to not read any file. This option can be used multiple
+times to read substitution variables from multiple files.
 .TP
 .BI \-D field = value
 Override or add an output control file field.
diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl
index 5493a95..4b4226f 100755
--- a/scripts/dpkg-genchanges.pl
+++ b/scripts/dpkg-genchanges.pl
@@ -40,7 +40,6 @@ my $controlfile = 'debian/control';
 my $changelogfile = 'debian/changelog';
 my $changelogformat;
 my $fileslistfile = 'debian/files';
-my $varlistfile = 'debian/substvars';
 my $uploadfilesdir = '..';
 my $sourcestyle = 'i';
 my $quiet = 0;
@@ -75,6 +74,7 @@ my $forcemaint;
 my $forcechangedby;
 my $since;
 
+my $substvars_loaded = 0;
 my $substvars = Dpkg::Substvars->new();
 $substvars->set("Format", $changes_format);
 
@@ -169,7 +169,8 @@ while (@ARGV) {
     } elsif (m/^-v(.*)$/) {
        $since = $1;
     } elsif (m/^-T(.*)$/) {
-       $varlistfile = $1;
+       $substvars->load($1) if -e $1;
+       $substvars_loaded = 1;
     } elsif (m/^-m(.*)$/s) {
        $forcemaint = $1;
     } elsif (m/^-e(.*)$/s) {
@@ -210,7 +211,7 @@ my $control = Dpkg::Control::Info->new($controlfile);
 my $fields = Dpkg::Control->new(type => CTRL_FILE_CHANGES);
 $substvars->set_version_substvars($changelog->{"Version"});
 $substvars->set_arch_substvars();
-$substvars->load($varlistfile) if -e $varlistfile;
+$substvars->load("debian/substvars") if -e "debian/substvars" and not 
$substvars_loaded;
 
 if (defined($prev_changelog) and
     version_compare_relation($changelog->{"Version"}, REL_LT,
diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl
index 5ef79f1..7d61bd0 100755
--- a/scripts/dpkg-gencontrol.pl
+++ b/scripts/dpkg-gencontrol.pl
@@ -39,7 +39,6 @@ my $controlfile = 'debian/control';
 my $changelogfile = 'debian/changelog';
 my $changelogformat;
 my $fileslistfile = 'debian/files';
-my $varlistfile = 'debian/substvars';
 my $packagebuilddir = 'debian/tmp';
 
 my $sourceversion;
@@ -50,6 +49,7 @@ my %remove;
 my %override;
 my $oppackage;
 my $substvars = Dpkg::Substvars->new();
+my $substvars_loaded = 0;
 
 
 sub version {
@@ -118,8 +118,9 @@ while (@ARGV) {
     } elsif (m/^-V(\w[-:0-9A-Za-z]*)[=:]/) {
         $substvars->set($1, $');
        $substvars->no_warn($1);
-    } elsif (m/^-T/) {
-        $varlistfile= $';
+    } elsif (m/^-T(.*)$/) {
+       $substvars->load($1) if -e $1;
+       $substvars_loaded = 1;
     } elsif (m/^-n/) {
         $forcefilename= $';
     } elsif (m/^-(h|-help)$/) {
@@ -139,7 +140,7 @@ $options{"changelogformat"} = $changelogformat if 
$changelogformat;
 my $changelog = changelog_parse(%options);
 $substvars->set_version_substvars($changelog->{"Version"});
 $substvars->set_arch_substvars();
-$substvars->load($varlistfile) if -e $varlistfile;
+$substvars->load("debian/substvars") if -e "debian/substvars" and not 
$substvars_loaded;
 $substvars->set("binary:Version", $forceversion) if defined $forceversion;
 my $control = Dpkg::Control::Info->new($controlfile);
 my $fields = Dpkg::Control->new(type => CTRL_PKG_DEB);
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index 1c01511..16745ef 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -49,7 +49,6 @@ use File::Spec;
 
 textdomain("dpkg-dev");
 
-my $varlistfile;
 my $controlfile;
 my $changelogfile;
 my $changelogformat;
@@ -164,7 +163,7 @@ while (@options) {
     } elsif (m/^-V(\w[-:0-9A-Za-z]*)[=:](.*)$/s) {
         $substvars->set($1, $2);
     } elsif (m/^-T(.*)$/) {
-        $varlistfile = $1;
+       $substvars->load($1) if -e $1;
     } elsif (m/^-(h|-help)$/) {
         usage();
         exit(0);
@@ -325,7 +324,6 @@ if ($options{'opmode'} =~ /^(-b|--print-format)$/) {
     # Write the .dsc
     my $dscname = $srcpkg->get_basename(1) . ".dsc";
     info(_g("building %s in %s"), $sourcepackage, $dscname);
-    $substvars->load($varlistfile) if $varlistfile && -e $varlistfile;
     $srcpkg->write_dsc(filename => $dscname,
                       remove => \%remove,
                       override => \%override,

-- 
dpkg's main repository


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

Reply via email to