diff options
author | 2015-10-06 13:55:04 -0400 | |
---|---|---|
committer | 2015-10-06 13:55:04 -0400 | |
commit | 710593e8a0f48213ed53057ca025486378d6e862 (patch) | |
tree | 420c6f9c16cd93f6033a0571de2a9b8011d9fa7e /catalyst | |
parent | arch: hoist default CHROOT setting up (diff) | |
download | catalyst-710593e8a0f48213ed53057ca025486378d6e862.tar.gz catalyst-710593e8a0f48213ed53057ca025486378d6e862.tar.bz2 catalyst-710593e8a0f48213ed53057ca025486378d6e862.zip |
arch: add helper for working w/setarch
The util-linux package has included setarch now for years, so there's
no need to check for the old linux32 program names.
Add a helper for setting up the chroot variable to the right target
that the arch wants. This can expand in the future for other arch
combos.
Diffstat (limited to 'catalyst')
-rw-r--r-- | catalyst/arch/powerpc.py | 8 | ||||
-rw-r--r-- | catalyst/arch/sparc.py | 8 | ||||
-rw-r--r-- | catalyst/arch/x86.py | 8 | ||||
-rw-r--r-- | catalyst/builder.py | 7 |
4 files changed, 10 insertions, 21 deletions
diff --git a/catalyst/arch/powerpc.py b/catalyst/arch/powerpc.py index 0c4861f0..7f4194e0 100644 --- a/catalyst/arch/powerpc.py +++ b/catalyst/arch/powerpc.py @@ -1,8 +1,5 @@ -import os - from catalyst import builder -from catalyst.support import CatalystError class generic_ppc(builder.generic): "abstract base class for all 32-bit powerpc builders" @@ -10,10 +7,7 @@ class generic_ppc(builder.generic): builder.generic.__init__(self,myspec) self.settings["CHOST"]="powerpc-unknown-linux-gnu" if self.settings["buildarch"]=="ppc64": - if not os.path.exists("/bin/linux32") and not os.path.exists("/usr/bin/linux32"): - raise CatalystError("required executable linux32 not found " - "(\"emerge setarch\" to fix.)", print_traceback=True) - self.settings["CHROOT"]="linux32 chroot" + self.setarch('linux32') self.settings["crosscompile"] = False class generic_ppc64(builder.generic): diff --git a/catalyst/arch/sparc.py b/catalyst/arch/sparc.py index 39f50cae..174d0a98 100644 --- a/catalyst/arch/sparc.py +++ b/catalyst/arch/sparc.py @@ -1,18 +1,12 @@ -import os - from catalyst import builder -from catalyst.support import CatalystError class generic_sparc(builder.generic): "abstract base class for all sparc builders" def __init__(self,myspec): builder.generic.__init__(self,myspec) if self.settings["buildarch"]=="sparc64": - if not os.path.exists("/bin/linux32") and not os.path.exists("/usr/bin/linux32"): - raise CatalystError("required executable linux32 not found " - "(\"emerge setarch\" to fix.)", print_traceback=True) - self.settings["CHROOT"]="linux32 chroot" + self.setarch('linux32') self.settings["crosscompile"] = False class generic_sparc64(builder.generic): diff --git a/catalyst/arch/x86.py b/catalyst/arch/x86.py index 0d6a9ad3..118d5ce5 100644 --- a/catalyst/arch/x86.py +++ b/catalyst/arch/x86.py @@ -1,18 +1,12 @@ -import os - from catalyst import builder -from catalyst.support import CatalystError class generic_x86(builder.generic): "abstract base class for all x86 builders" def __init__(self,myspec): builder.generic.__init__(self,myspec) if self.settings["buildarch"]=="amd64": - if not os.path.exists("/bin/linux32") and not os.path.exists("/usr/bin/linux32"): - raise CatalystError("required executable linux32 not found " - "(\"emerge setarch\" to fix.)", print_traceback=True) - self.settings["CHROOT"]="linux32 chroot" + self.setarch('linux32') self.settings["crosscompile"] = False class arch_x86(generic_x86): diff --git a/catalyst/builder.py b/catalyst/builder.py index adaea90f..7380cac8 100644 --- a/catalyst/builder.py +++ b/catalyst/builder.py @@ -4,6 +4,13 @@ class generic(object): self.settings=myspec self.settings.setdefault('CHROOT', 'chroot') + def setarch(self, arch): + """Set the chroot wrapper to run through `setarch |arch|` + + Useful for building x86-on-amd64 and such. + """ + self.settings['CHROOT'] = 'setarch %s %s' % (arch, self.settings['CHROOT']) + def mount_safety_check(self): """ Make sure that no bind mounts exist in chrootdir (to use before |