From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 0EAA5138BED for ; Tue, 6 Oct 2015 17:57:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B029BE0872; Tue, 6 Oct 2015 17:56:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4B042E0870 for ; Tue, 6 Oct 2015 17:56:59 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 123BA34076D for ; Tue, 6 Oct 2015 17:56:57 +0000 (UTC) From: Mike Frysinger To: gentoo-catalyst@lists.gentoo.org Subject: [gentoo-catalyst] [PATCH 2/2] arch: add helper for working w/setarch Date: Tue, 6 Oct 2015 13:56:54 -0400 Message-Id: <1444154214-3572-2-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 2.5.2 In-Reply-To: <1444154214-3572-1-git-send-email-vapier@gentoo.org> References: <1444154214-3572-1-git-send-email-vapier@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org X-Archives-Salt: c0763f3b-1c95-4abd-86dd-3073063ebd67 X-Archives-Hash: e8bd2e5e4c85816248b6854a260263db 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. --- catalyst/arch/powerpc.py | 5 +---- catalyst/arch/sparc.py | 5 +---- catalyst/arch/x86.py | 5 +---- catalyst/builder.py | 7 +++++++ 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/catalyst/arch/powerpc.py b/catalyst/arch/powerpc.py index 0c4861f..d799544 100644 --- a/catalyst/arch/powerpc.py +++ b/catalyst/arch/powerpc.py @@ -10,10 +10,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 39f50ca..1c4a803 100644 --- a/catalyst/arch/sparc.py +++ b/catalyst/arch/sparc.py @@ -9,10 +9,7 @@ class generic_sparc(builder.generic): 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 0d6a9ad..a4b2089 100644 --- a/catalyst/arch/x86.py +++ b/catalyst/arch/x86.py @@ -9,10 +9,7 @@ class generic_x86(builder.generic): 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 adaea90..7380cac 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 -- 2.5.2