--- sbuild-0.60.0.orig/lib/Sbuild/ChrootInfo.pm
+++ sbuild-0.60.0/lib/Sbuild/ChrootInfo.pm
@@ -57,11 +57,12 @@
sub create {
my $self = shift;
+ my $namespace = shift;
my $distribution = shift;
my $chroot = shift;
my $arch = shift;
- my $chrootid = $self->find($distribution, $chroot, $arch);
+ my $chrootid = $self->find($namespace, $distribution, $chroot, $arch);
my $newchroot = $self->_create($chrootid);
@@ -75,12 +76,18 @@
sub find {
my $self = shift;
+ my $namespace = shift;
my $distribution = shift;
my $chroot = shift;
my $arch = shift;
- my $chroots = $self->get('Chroots');
+ # Use namespace given from $distribution if one is found
+ if ($distribution =~ /^([^:]+):/msx) {
+ $namespace = $1;
+ $distribution =~ s/^[^:]+://msx;
+ }
+ my $chroots = $self->get('Chroots');
# Don't do strict arch checking if ARCH == HOST_ARCH.
if (!defined($arch) || $arch eq "") {
@@ -91,20 +98,31 @@
my $arch_found = 0;
if (!defined $chroot) {
+ my $ns = $chroots->{$namespace};
+ if (!defined($ns)) {
+ if ($namespace ne 'chroot') {
+ $chroot = $self->find('chroot', $distribution, $chroot, $arch);
+ } else {
+ # TODO: Return error, rather than die.
+ die "Chroot namespace $namespace not found\n";
+ return undef;
+ }
+ }
+
if ($arch ne "" &&
- defined($chroots->{"${distribution}-${arch}-sbuild"})) {
- $chroot = "${distribution}-${arch}-sbuild";
+ defined($ns->{"${distribution}-${arch}-sbuild"})) {
+ $chroot = "${namespace}:${distribution}-${arch}-sbuild";
$arch_found = 1;
}
- elsif (defined($chroots->{"${distribution}-sbuild"})) {
- $chroot = "${distribution}-sbuild";
+ elsif (defined($ns->{"${distribution}-sbuild"})) {
+ $chroot = "${namespace}:${distribution}-sbuild";
}
elsif ($arch ne "" &&
- defined($chroots->{"${distribution}-${arch}"})) {
- $chroot = "${distribution}-${arch}";
+ defined($ns->{"${distribution}-${arch}"})) {
+ $chroot = "${namespace}:${distribution}-${arch}";
$arch_found = 1;
- } elsif (defined($chroots->{$distribution})) {
- $chroot = $distribution;
+ } elsif (defined($ns->{$distribution})) {
+ $chroot = "${namespace}:${distribution}";
}
if ($arch_set && !$arch_found && $arch ne "") {
@@ -115,9 +133,14 @@
}
if (!$chroot) {
- # TODO: Return error, rather than die.
- die "Chroot for distribution $distribution, architecture $arch not found\n";
- return undef;
+ # Fall back to chroot namespace.
+ if ($namespace ne 'chroot') {
+ $chroot = $self->find('chroot', $distribution, $chroot, $arch);
+ } else {
+ # TODO: Return error, rather than die.
+ die "Chroot for distribution $distribution, architecture $arch not found\n";
+ return undef;
+ }
}
return $chroot;