[buildd-tools-devel] Bug#559659: Bug#559659: Bug#559659: sbuild: Targets unstable even when dealing with experimental stuff

Roger Leigh rleigh at codelibre.net
Sun Dec 13 20:35:47 UTC 2009


tags 559659 + patch fixed-upstream pending
thanks

On Sun, Dec 06, 2009 at 07:06:42PM +0100, Cyril Brulebois wrote:
> Hi Roger.
> 
> Roger Leigh <rleigh at codelibre.net> (06/12/2009):
> > Currently, the reason why your uploads default to unstable is
> > because sbuild defaults to unstable unless you override it.
> 
> Yeah, I gathered that… :)
> 
> > I think the safest solution here is to simply not set it by default,
> > and require the user to always specify it (or set it in their
> > .sbuildrc).
> 
> Agreed.

Fixed on the master branch, in commit 3b5e134c.


Regards,
Roger


diff --git a/bin/sbuild b/bin/sbuild
index b6f76bb..e4bd3f9 100755
--- a/bin/sbuild
+++ b/bin/sbuild
@@ -64,6 +64,12 @@ my $current_job = undef;
 main();
 
 sub main () {
+    my $dist = $conf->get('DISTRIBUTION');
+    if (!defined($dist) || !$dist) {
+	print STDERR "No distribution defined\n";
+	exit(1);
+    }
+
     print "Selected distribution " . $conf->get('DISTRIBUTION') . "\n"
 	if $conf->get('DEBUG');
     print "Selected chroot " . $conf->get('CHROOT') . "\n"
diff --git a/etc/example.sbuildrc b/etc/example.sbuildrc
index 279deae..89aeadd 100644
--- a/etc/example.sbuildrc
+++ b/etc/example.sbuildrc
@@ -46,7 +46,12 @@
 ## SBUILD BEHAVIOUR
 ##
 
-# Default distribution
+# Default distribution.  By default, no distribution is defined, and
+# the user must specify it with the -d option.  However, a default may
+# be configured here if desired.  Users must take care not to upload
+# to the wrong distribution when this option is set, for example
+# experimental packages will be built for upload to unstable when this
+# is not what is required.
 #$distribution = 'unstable';
 
 # Default chroot (defaults to distribution[-arch][-sbuild])
diff --git a/etc/sbuild.conf b/etc/sbuild.conf
index 7b55581..a9729ee 100644
--- a/etc/sbuild.conf
+++ b/etc/sbuild.conf
@@ -79,7 +79,12 @@
 # Default architecture.  Defaults to host architecture.
 #$arch = 'powerpc';
 
-# Default distribution
+# Default distribution.  By default, no distribution is defined, and
+# the user must specify it with the -d option.  However, a default may
+# be configured here if desired.  Users must take care not to upload
+# to the wrong distribution when this option is set, for example
+# experimental packages will be built for upload to unstable when this
+# is not what is required.
 #$distribution = 'unstable';
 
 # Chroot mode.  Valid modes are 'schroot' to use schroot for chroot
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 8a0a086..f64067b 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -201,6 +201,12 @@ sub run {
 
     $self->set('Pkg Start Time', time);
 
+    my $dist = $self->get_conf('DISTRIBUTION');
+    if (!defined($dist) || !$dist) {
+	$self->log("No distribution defined\n");
+	goto cleanup_skip;
+    }
+
     if ($self->get('Invalid Source')) {
 	$self->log("Invalid source: " . $self->get('DSC') . "\n");
 	$self->log("Skipping " . $self->get('Package') . " \n");
diff --git a/lib/Sbuild/Conf.pm b/lib/Sbuild/Conf.pm
index bab48e6..0047740 100644
--- a/lib/Sbuild/Conf.pm
+++ b/lib/Sbuild/Conf.pm
@@ -602,7 +602,9 @@ sub read_config {
 
     $self->set('MAILTO',
 	       $self->get('MAILTO_HASH')->{$self->get('DISTRIBUTION')})
-	if $self->get('MAILTO_HASH')->{$self->get('DISTRIBUTION')};
+	if defined($self->get('DISTRIBUTION')) &&
+	   $self->get('DISTRIBUTION') &&
+	   $self->get('MAILTO_HASH')->{$self->get('DISTRIBUTION')};
 
     $self->set('SIGNING_OPTIONS',
 	       "-m".$self->get('MAINTAINER_NAME')."")
diff --git a/lib/Sbuild/ConfBase.pm b/lib/Sbuild/ConfBase.pm
index 9cc318a..a8a604f 100644
--- a/lib/Sbuild/ConfBase.pm
+++ b/lib/Sbuild/ConfBase.pm
@@ -81,7 +81,6 @@ sub init_allowed_keys {
 
     my %common_keys = (
 	'DISTRIBUTION'				=> {
-	    DEFAULT => 'unstable',
 	    SET => sub {
 		my $self = shift;
 		my $entry = shift;

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20091213/d8766e52/attachment.pgp>


More information about the Buildd-tools-devel mailing list