public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/arch/
Date: Thu,  8 Oct 2015 17:19:08 +0000 (UTC)	[thread overview]
Message-ID: <1444154104.710593e8a0f48213ed53057ca025486378d6e862.vapier@gentoo> (raw)

commit:     710593e8a0f48213ed53057ca025486378d6e862
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  6 17:55:04 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Oct  6 17:55:04 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=710593e8

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.

 catalyst/arch/powerpc.py | 8 +-------
 catalyst/arch/sparc.py   | 8 +-------
 catalyst/arch/x86.py     | 8 +-------
 catalyst/builder.py      | 7 +++++++
 4 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/catalyst/arch/powerpc.py b/catalyst/arch/powerpc.py
index 0c4861f..7f4194e 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 39f50ca..174d0a9 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 0d6a9ad..118d5ce 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 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


             reply	other threads:[~2015-10-08 17:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-08 17:19 Mike Frysinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-10-08 17:19 [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/arch/ Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444154104.710593e8a0f48213ed53057ca025486378d6e862.vapier@gentoo \
    --to=vapier@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox