From e5862f49c9ab45f1ad177856d2ea80ed95f6d19a Mon Sep 17 00:00:00 2001 From: Emmet Hikory Date: Mon, 8 Mar 2010 18:54:54 +0900 Subject: [PATCH] * pbuilder-dist: allow any foreign chroot (may not work, but we can try) * docs/pbuilder-dist.1: update manpage to indicate general architecture --- debian/changelog | 4 +++- doc/pbuilder-dist.1 | 21 +++++++++++---------- pbuilder-dist | 14 +++++--------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/debian/changelog b/debian/changelog index b09ee0d..b28e57a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,8 +7,10 @@ ubuntu-dev-tools (0.94) UNRELEASED; urgency=low [ Emmet Hikory ] * mk-sbuild: switch to use qemu-debootstrap for foreign chroots * mk-sbuild: allow any foreign chroot (may not work, but we can try) + * pbuilder-dist: allow any foreign chroot (may not work, but we can try) + * docs/pbuilder-dist.1: update manpage to indicate general architecture - -- Emmet Hikory Mon, 08 Mar 2010 17:56:30 +0900 + -- Emmet Hikory Mon, 08 Mar 2010 18:51:19 +0900 ubuntu-dev-tools (0.93) lucid; urgency=low diff --git a/doc/pbuilder-dist.1 b/doc/pbuilder-dist.1 index bd26064..fa451bd 100644 --- a/doc/pbuilder-dist.1 +++ b/doc/pbuilder-dist.1 @@ -4,10 +4,10 @@ pbuilder\-dist, cowbuilder\-dist \- multi-distribution pbuilder/cowbuilder wrapper .SH SYNOPSIS -\fBpbuilder\-dist\fP \fIdistribution\fR [\fBi386\fP|\fBamd64\fP|\fBarmel\fP] [\fBmainonly\fP] +\fBpbuilder\-dist\fP \fIdistribution\fR [\fIarchitecture\fR] [\fBmainonly\fP] \fIoperation\fR [\fI...\fR] -\fBcowbuilder\-dist\fP \fIdistribution\fR [\fBi386\fP|\fBamd64\fP|\fBarmel\fP] [\fBmainonly\fP] +\fBcowbuilder\-dist\fP \fIdistribution\fR [\fIarchitecture\fR] [\fBmainonly\fP] \fIoperation\fR [\fI...\fR] .SH DESCRIPTION @@ -15,8 +15,8 @@ pbuilder\-dist, cowbuilder\-dist \- multi-distribution pbuilder/cowbuilder wrapp versions of Ubuntu and/or Debian. .PP It is common to symlink this script in order to give it many names in the form of -\fBpbuilder\-\fIdistribution\fP\fR (\fBpbuilder\-\fIdistribution\fR\-\fIarchitecture\fP\fR on amd64 -systems), like for example \fBpbuilder\-feisty\fP, \fBpbuilder\-sid\fP, \fBpbuilder\-gutsy\-i386\fP, etc. +\fBpbuilder\-\fIdistribution\fP\fR or \fBpbuilder\-\fIdistribution\fR\-\fIarchitecture\fP\fR, +like for example \fBpbuilder\-feisty\fP, \fBpbuilder\-sid\fP, \fBpbuilder\-gutsy\-i386\fP, etc. .PP The same applies to \fBcowbuilder\-dist\fP, which uses cowbuilder. The main difference between both is that pbuilder compresses the created chroot as a @@ -33,12 +33,13 @@ the name also contains \-\fIarchitecture\fR. \fBdistribution\fP Replace this with the codename of the version of Ubuntu or Debian you want to use. .TP -\fBi386\fP / \fBamd64\fP / \fBarmel\fP -Only available on i386 and amd64 systems. -This is optional; default is the native architecture -If \fBi386\fP is specified, an i386 environment will be used. -If \fBarmel\fP is specified, an armel environment will be used. -Note that there is no support for amd64 chroots on i386 systems +\fBarchitecture\fP +This optional parameter will attempt to construct a chroot in a foreign +architecture. For some architecture pairs (e.g. i386 on an amd64 install), +the chroot will be created natively. For others (e.g. armel on an i386 +install), qemu-static and binfmt-misc will be used. Note that some +combinations (e.g. amd64 on an i386 install) require special separate +kernel handling, and may break in unexpected ways. .TP \fBmainonly\fP If you specify \fBmainonly\fP, only packages from the main (in Debian) or diff --git a/pbuilder-dist b/pbuilder-dist index 6909764..1f13142 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -310,20 +310,16 @@ def main(): if len(parts) > 2: requested_arch = parts[2] - elif len(args) > 0 and args[0] in ('i386', 'amd64', 'armel'): + elif len(args) > 0 and args[0] in ("alpha", "amd64", "arm", "armeb", "armel", "i386", "lpia", "m68k", "mips", "mipsel", "powerpc", "ppc64", "sh4", "sh4eb", "sparc", "sparc64"): requested_arch = args.pop(0) else: requested_arch = None if requested_arch: - if requested_arch in ('i386', 'amd64') and app.system_architecture == 'amd64': - app.build_architecture = requested_arch - elif requested_arch == 'armel' and app.system_architecture in ('i386', 'amd64'): - app.build_architecture = requested_arch - args.append('--debootstrap build-arm-chroot') - else: - print 'Error: Architecture switching is not supported on your system; wrong filename.' - sys.exit(1) + app.build_architecture = requested_arch + # For some foreign architectures we need to use qemu + if requested_arch != app.system_architecture and (requested_arch, app.system_architecture) not in (("amd64", "i386"), ("amd64", "lpia"), ("arm", "armel"), ("armel", "arm"), ("i386", "lpia"), ("lpia", "i386"), ("powerpc", "ppc64"), ("ppc64", "powerpc"), ("sparc", "sparc64"), ("sparc64", "sparc")): + args.append('--debootstrap qemu-debootstrap') if 'mainonly' in sys.argv: app.extra_components = False