+2008-05-28 Raphael Hertzog <hertzog@debian.org>
+
+ * 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 <hertzog@debian.org>
* scripts/Dpkg/Source/Package/V3/quilt.pm: Factorize calls to
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
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.
.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.
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);
my $tar_ignore_default_pattern_done;
my @cmdline_options;
+my @cmdline_formats;
while (@ARGV && $ARGV[0] =~ m/^-/) {
$_ = shift(@ARGV);
if (m/^-b$/) {
} 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;
$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);