The following commit has been merged in the lenny branch:
commit 6f2c6d4470d18cf47f6f7c05511865bdceeb71e6
Author: Raphael Hertzog <[EMAIL PROTECTED]>
Date: Wed May 28 21:06:40 2008 +0200
dpkg-source: make sure the source package format is respected
* scripts/Dpkg/Source/Package.pm (extract): If we extract a
source package that uses a non-standard source package format (!= 1.0)
then we create debian/source/format to remember it.
* scripts/dpkg-source.pl: Use debian/source/format as a new source
of format to try when building the package. Prioritize it lower than
command line and debian/control but higher than the default build
formats.
* man/dpkg-source.1: Document the above changes.
diff --git a/ChangeLog b/ChangeLog
index 8b1b099..cb2d289 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2008-05-28 Raphael Hertzog <[EMAIL PROTECTED]>
+ * scripts/Dpkg/Source/Package.pm (extract): If we extract a
+ source package that uses a non-standard (!= 1.0) source package
+ then we create debian/source/format to remember it.
+ * scripts/dpkg-source.pl: Use debian/source/format as a new source
+ of format to try when building the package. Prioritize it lower than
+ command line and debian/control but higher than the default build
+ formats.
+ * man/dpkg-source.1: Document the above changes.
+
+2008-05-28 Raphael Hertzog <[EMAIL PROTECTED]>
+
* scripts/Dpkg/Source/Package/V3/quilt.pm: Factorize calls to
quilt in a new run_quilt() function. And check only once
if quilt is available while setting the default value of
diff --git a/man/dpkg-source.1 b/man/dpkg-source.1
index f016a5f..98758ae 100644
--- a/man/dpkg-source.1
+++ b/man/dpkg-source.1
@@ -41,6 +41,12 @@ files will be 0777 and plain files will be 0666, both
modified by the
extractors' umask; if the parent directory is setgid then the
extracted directories will be too, and all the files and directories
will inherit its group ownership.
+
+If the source package uses a non-standard format (currently this means all
+formats except "1.0"), its name will be stored in
+\fBdebian/source/format\fP so that the following builds of the source
+package use the same format by default.
+
.TP
.RI "\fB\-b\fP " directory " [" format-specific-parameters ]
Build a source package. The first non-option argument is taken as the
@@ -53,6 +59,7 @@ additional parameters might be accepted.
that works from this ordered list:
the format indicated in the \fIFormat\fP field of \fBdebian/control\fP,
the format(s) indicated with the \fI\-\-format\fP command-line option(s),
+the format indicated in \fBdebian/source/format\fP,
"1.0", "3.0 (native)". See below for an extensive description of
various source package formats.
@@ -86,9 +93,9 @@ defaults to the debian standard format.
.TP
.BI \-\-format= value
Try first the given format for building the source package. If used
-multiple times, the last value is tried first and the first one is
-tried last just before trying the default formats. It doesn't override
-any explicit \fIFormat\fP field in \fBdebian/control\fP.
+multiple times, they are tried in order. It doesn't override
+any explicit \fIFormat\fP field in \fBdebian/control\fP but it does
+override any format given in \fBdebian/source/format\fP.
.TP
.BI \-V name = value
\fBDeprecated\fP. Set an output substitution variable.
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index f086e85..9ca9643 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -325,6 +325,16 @@ sub extract {
die $@;
}
+ # Store format if non-standard so that next build keeps the same format
+ if ($self->{'fields'}{'Format'} ne "1.0") {
+ my $srcdir = File::Spec->catdir($newdirectory, "debian", "source");
+ my $format_file = File::Spec->catfile($srcdir, "format");
+ mkdir($srcdir) unless -e $srcdir;
+ open(FORMAT, ">", $format_file) || syserr(_g("can't write %s"),
$format_file);
+ print FORMAT $self->{'fields'}{'Format'} . "\n";
+ close(FORMAT);
+ }
+
# Make sure debian/rules is executable
my $rules = File::Spec->catfile($newdirectory, "debian", "rules");
my @s = lstat($rules);
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index b841ef0..4907e25 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -52,6 +52,7 @@ my $substvars = Dpkg::Substvars->new();
my $tar_ignore_default_pattern_done;
my @cmdline_options;
+my @cmdline_formats;
while (@ARGV && $ARGV[0] =~ m/^-/) {
$_ = shift(@ARGV);
if (m/^-b$/) {
@@ -59,7 +60,7 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
} elsif (m/^-x$/) {
setopmode('extract');
} elsif (m/^--format=(.*)$/) {
- unshift @build_formats, $1;
+ push @cmdline_formats, $1;
} elsif (m/^-Z/) {
my $compression = $POSTMATCH;
$options{'compression'} = $compression;
@@ -247,9 +248,21 @@ if ($options{'opmode'} eq 'build') {
$fields->{'Binary'} = join(', ', @binarypackages);
- unshift @build_formats, $fields->{'Format'} if exists $fields->{'Format'};
+ # Generate list of formats to try
+ my @try_formats;
+ push @try_formats, $fields->{'Format'} if exists $fields->{'Format'};
+ push @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 (@build_formats) {
+ foreach my $format (@try_formats) {
$fields->{'Format'} = $format;
$srcpkg->upgrade_object_type(); # Fails if format is unsupported
my ($res, $msg) = $srcpkg->can_build($dir);
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]