The following commit has been merged in the master branch:
commit a727752bf9efeeaf0f06f78371c6d9f4085db4c3
Author: Raphaël Hertzog <[email protected]>
Date: Fri Mar 5 11:04:59 2010 +0100
dpkg-source: do not fallback to other source formats
When the prerequesites of the current source format are not met,
simply error out instead of trying to fallback to other source formats.
diff --git a/debian/changelog b/debian/changelog
index 9ea652e..46a9c7b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -65,6 +65,8 @@ dpkg (1.15.6) UNRELEASED; urgency=low
dselect.
* The rewritten Dpkg::Checksums deals properly with filenames with
spaces. Closes: #572030
+ * dpkg-source does no longer fallback to other source formats if the
+ requested one is not usable. Closes: #557459
[ Guillem Jover ]
* Handle argument parsing in dpkg-checkbuilddeps and dpkg-scanpackages
diff --git a/man/dpkg-source.1 b/man/dpkg-source.1
index 0312828..86db209 100644
--- a/man/dpkg-source.1
+++ b/man/dpkg-source.1
@@ -56,10 +56,10 @@ Depending on the source package format used to build the
package,
additional parameters might be accepted.
\fBdpkg\-source\fP will build the source package with the first format
-that works from this ordered list:
-the format(s) indicated with the \fI\-\-format\fP command-line option(s),
+found in this ordered list:
+the format indicated with the \fI\-\-format\fP command-line option,
the format indicated in \fBdebian/source/format\fP,
-"1.0", "3.0 (quilt)", "3.0 (native)". See section
+"1.0". See section
\fBSOURCE PACKAGE FORMATS\fP for an extensive description of the various
source package formats.
@@ -67,8 +67,7 @@ source package formats.
.RI "\fB\-\-print\-format\fP " directory
Print the source format that would be used to build the source package if
\fBdpkg\-source \-b \fIdirectory\fR was called (in the same conditions and
-with the same parameters). In particular it's important that the upstream
-tarball (if any) can be found in the current directory.
+with the same parameters).
.TP
.BR \-h ", " \-\-help
@@ -99,8 +98,7 @@ from a special line near the bottom of the changelog or
failing that
defaults to the debian standard format.
.TP
.BI \-\-format= value
-Try first the given format for building the source package. If used
-multiple times, they are tried in order. It does
+Use the given format for building the source package. It does
override any format given in \fBdebian/source/format\fP.
.TP
.BI \-V name = value
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index 4c3dbc9..307ce2c 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -11,7 +11,7 @@
# Copyright © 2005 Brendan O'Dea <[email protected]>
# Copyright © 2006-2008 Frank Lichtenheld <[email protected]>
# Copyright © 2006-2009 Guillem Jover <[email protected]>
-# Copyright © 2008-2009 Raphaël Hertzog <[email protected]>
+# Copyright © 2008-2010 Raphaël Hertzog <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -53,7 +53,7 @@ my $controlfile;
my $changelogfile;
my $changelogformat;
-my @build_formats = ("1.0", "3.0 (quilt)", "3.0 (native)");
+my $build_format;
my %options = (
# Compression related
compression => compression_get_default(),
@@ -77,7 +77,6 @@ my $tar_ignore_default_pattern_done;
my @options;
my @cmdline_options;
-my @cmdline_formats;
while (@ARGV && $ARGV[0] =~ m/^-/) {
$_ = shift(@ARGV);
if (m/^-b$/) {
@@ -120,7 +119,7 @@ if (defined($options{'opmode'}) &&
while (@options) {
$_ = shift(@options);
if (m/^--format=(.*)$/) {
- push @cmdline_formats, $1;
+ $build_format = $1 unless defined $build_format;
} elsif (m/^-(?:Z|-compression=)(.*)$/) {
my $compression = $1;
$options{'compression'} = $compression;
@@ -292,32 +291,32 @@ if ($options{'opmode'} =~ /^(-b|--print-format)$/) {
$fields->{'Binary'} =~ s/(.{0,980}), ?/$1,\n/g;
}
- # Generate list of formats to try
- my @try_formats = (@cmdline_formats);
- if (-e "$dir/debian/source/format") {
- open(FORMAT, "<", "$dir/debian/source/format") ||
- syserr(_g("cannot read %s"), "$dir/debian/source/format");
- my $format = <FORMAT>;
- chomp($format);
- close(FORMAT);
- push @try_formats, $format;
- }
- push @try_formats, @build_formats;
- # Try all suggested formats until one is acceptable
- foreach my $format (@try_formats) {
- $fields->{'Format'} = $format;
- $srcpkg->upgrade_object_type(); # Fails if format is unsupported
- # Parse command line options
- $srcpkg->init_options();
- $srcpkg->parse_cmdline_options(@cmdline_options);
- my ($res, $msg) = $srcpkg->can_build($dir);
- last if $res;
- info(_g("source format `%s' discarded: %s"), $format, $msg);
+ # Select the format to use
+ if (not defined $build_format) {
+ if (-e "$dir/debian/source/format") {
+ open(FORMAT, "<", "$dir/debian/source/format") ||
+ syserr(_g("cannot read %s"), "$dir/debian/source/format");
+ $build_format = <FORMAT>;
+ chomp($build_format);
+ close(FORMAT);
+ } else {
+ $build_format = "1.0";
+ }
}
+ $fields->{'Format'} = $build_format;
+ $srcpkg->upgrade_object_type(); # Fails if format is unsupported
+ # Parse command line options
+ $srcpkg->init_options();
+ $srcpkg->parse_cmdline_options(@cmdline_options);
+
if ($options{'opmode'} eq "--print-format") {
print $fields->{'Format'} . "\n";
exit(0);
}
+
+ # Verify pre-requesites are met
+ my ($res, $msg) = $srcpkg->can_build($dir);
+ error(_g("can't build with source format '%s': %s"), $build_format, $msg)
unless $res;
info(_g("using source format `%s'"), $fields->{'Format'});
run_vendor_hook("before-source-build", $srcpkg);
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]