[buildd-tools-devel] Bug#808290: sbuild: sbuild-update gives "Can't locate object method "throw"" when passing an unknown chroot name
Johannes Schauer
josch at debian.org
Thu Dec 24 10:40:29 UTC 2015
Control: severity -1 normal
Control: tag -1 + patch
Hi,
On Fri, 18 Dec 2015 12:39:00 +0100 Ansgar Burchardt <ansgar at debian.org> wrote:
> sbuild-update throws an unfriendly error message when called with an
> unknown chroot:
>
> # sbuild-update -ugd unknown
> Can't locate object method "throw" via package "Sbuild::Exception::Build" (perhaps you forgot to load "Sbuild::Exception::Build"?) at /usr/share/perl5/Sbuild/ChrootInfo.pm line 140.
whoops! Thanks for noticing this! The following patch fixes the problem:
diff --git a/lib/Sbuild/ChrootInfo.pm b/lib/Sbuild/ChrootInfo.pm
index 4b219f4..4c1ee90 100644
--- a/lib/Sbuild/ChrootInfo.pm
+++ b/lib/Sbuild/ChrootInfo.pm
@@ -104,8 +104,8 @@ sub find {
if ($namespace ne 'chroot') {
$chroot = $self->find('chroot', $distribution, $chroot, $arch);
} else {
- Sbuild::Exception::Build->throw(error => "Chroot namespace $namespace not found\n",
- failstage => "find-chroot");
+ $self->log_error("Chroot namespace $namespace not found\n");
+ return undef;
}
}
@@ -137,8 +137,8 @@ sub find {
if ($namespace ne 'chroot') {
$chroot = $self->find('chroot', $distribution, $chroot, $arch);
} else {
- Sbuild::Exception::Build->throw(error => "Chroot for distribution $distribution, architecture $arch not found\n",
- failstage => "find-chroot");
+ $self->log_error("Chroot for distribution $distribution, architecture $arch not found\n");
+ return undef;
}
}
diff --git a/lib/Sbuild/Utility.pm b/lib/Sbuild/Utility.pm
index 5ebd004..3137bd6 100644
--- a/lib/Sbuild/Utility.pm
+++ b/lib/Sbuild/Utility.pm
@@ -99,6 +99,11 @@ sub setup ($$$) {
undef, # TODO: Add --chroot option
$conf->get('BUILD_ARCH'));
+ if (!defined $session) {
+ print STDERR "Error creating chroot info\n";
+ return undef;
+ }
+
$session->set('Log Stream', \*STDOUT);
my $chroot_defaults = $session->get('Defaults');
Thanks!
cheers, josch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: signature
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20151224/535dcbae/attachment.sig>
More information about the Buildd-tools-devel
mailing list