[Buildd-tools-devel] Re: Bug#300145: sbuild: Should use distribution from changelog, not unstable by default
Michael Banck
mbanck@debian.org
Fri, 25 Mar 2005 22:17:06 +0100
tags 300145 +patch
thanks
On Fri, Mar 18, 2005 at 12:03:24AM +0100, Michael Banck wrote:
> sbuild overrides the distribution with 'unstable' by default if nothing
> else is specified. However, as an end-user tool, sbuild should honor
> the distribution as used in the changelog by default.
The following patch does this. Unless the user explicitely specifies
the distribution via -d $dist (in which case
$main::override_distribution gets set), sbuild does not override the
Distribution field in .changes.
I tested this with a source package for experimental, and Distribution
is unstable when -d unstable, and experimental otherwise.
Any objections to applying this?
Michael
--- /home/mbanck/src/cvs/sbuild/sbuild 2005-01-25 11:45:59.000000000 +0100
+++ sbuild 2005-03-25 19:34:51.612533856 +0100
@@ -99,6 +97,7 @@
$main::chroot_dir = "";
$main::chroot_build_dir = "";
$main::chroot_apt_options = "";
+$main::override_distribution = 0;
$main::new_dpkg = 0;
check_dpkg_version();
@@ -137,6 +136,7 @@
$main::distribution = "stable" if $main::distribution eq "s";
$main::distribution = "testing" if $main::distribution eq "t";
$main::distribution = "unstable" if $main::distribution eq "u";
+ $main::override_distribution = 1;
}
elsif (/^-p/ || /^--purge/) {
if (/^-p(.)/ || /^--purge=(.)/) {
@@ -861,7 +859,7 @@
open( F, "<$main::chroot_build_dir$changes" );
if (open( F2, ">$changes.new" )) {
while( <F> ) {
- if (/^Distribution:\s*(.*)\s*$/) {
+ if (/^Distribution:\s*(.*)\s*$/ and $main::override_distribution) {
print PLOG "Distribution: $main::distribution\n";
print F2 "Distribution: $main::distribution\n";
}