public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
From: dilfridge@gentoo.org
To: gentoo-catalyst@lists.gentoo.org
Cc: "Andreas K. Hüttel" <dilfridge@gentoo.org>
Subject: [gentoo-catalyst] [PATCH] Allow "interpreter" parameter as space-separated list of files
Date: Fri,  4 Sep 2020 23:23:24 +0300	[thread overview]
Message-ID: <20200904202324.31508-1-dilfridge@gentoo.org> (raw)

From: Andreas K. Hüttel <dilfridge@gentoo.org>

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
---
 catalyst/base/stagebase.py | 44 +++++++++++++++++++++++++-------------
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index afeda722..0cf3495a 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1061,21 +1061,28 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
 			shutil.copy('/etc/resolv.conf', self.settings['chroot_path'] + '/etc/')
 
-			# Copy over the binary interpreter (qemu), if applicable; note that it's given
-			# as full path and goes to the same place in the chroot
+			# Copy over the binary interpreter(s) (qemu), if applicable; note that they are given
+			# as space-separated list of full paths and go to the same place in the chroot
 			if "interpreter" in self.settings:
-				if not os.path.exists(self.settings["interpreter"]):
-					raise CatalystError(
-						"Can't find interpreter " + self.settings["interpreter"],
-						print_traceback=True)
 
-				log.notice('Copying binary interpreter %s into chroot', self.settings['interpreter'])
+				if isinstance(self.settings["interpreter"], str):
+					myints = [self.settings["interpreter"]]
+				else:
+					myints = self.settings["interpreter"]
+
+				for myi in myints:
+					if not os.path.exists(myi):
+						raise CatalystError(
+							"Can't find interpreter " + myi,
+							print_traceback=True)
 
-				if os.path.exists(self.settings['chroot_path'] + '/' + self.settings['interpreter']):
-					os.rename(self.settings['chroot_path'] + '/' + self.settings['interpreter'], self.settings['chroot_path'] + '/' + self.settings['interpreter'] + '.catalyst')
+					log.notice('Copying binary interpreter %s into chroot', myi)
 
-				shutil.copy(self.settings['interpreter'],
-					self.settings['chroot_path'] + '/' + self.settings['interpreter'])
+					if os.path.exists(self.settings['chroot_path'] + '/' + myi):
+						os.rename(self.settings['chroot_path'] + '/' + myi, self.settings['chroot_path'] + '/' + myi + '.catalyst')
+
+					shutil.copy(myi,
+						self.settings['chroot_path'] + '/' + myi)
 
 			# Copy over the envscript, if applicable
 			if "envscript" in self.settings:
@@ -1242,12 +1249,19 @@ class StageBase(TargetBase, ClearBase, GenBase):
 		if os.path.exists(hosts_file + '.catalyst'):
 			os.rename(hosts_file + '.catalyst', hosts_file)
 
-		# optionally clean up binary interpreter
+		# optionally clean up binary interpreter(s)
 		if "interpreter" in self.settings:
-			if os.path.exists(self.settings['chroot_path'] + '/' + self.settings['interpreter'] + '.catalyst'):
-				os.rename(self.settings['chroot_path'] + '/' + self.settings['interpreter'] + '.catalyst', self.settings['chroot_path'] + '/' + self.settings['interpreter'])
+
+			if isinstance(self.settings["interpreter"], str):
+				myints = [self.settings["interpreter"]]
 			else:
-				os.remove(self.settings['chroot_path'] + '/' + self.settings['interpreter'])
+				myints = self.settings["interpreter"]
+
+			for myi in myints:
+				if os.path.exists(self.settings['chroot_path'] + '/' + myi + '.catalyst'):
+					os.rename(self.settings['chroot_path'] + '/' + myi + '.catalyst', self.settings['chroot_path'] + '/' + myi)
+				else:
+					os.remove(self.settings['chroot_path'] + '/' + myi)
 
 		# optionally clean up portage configs
 		if ("portage_prefix" in self.settings and
-- 
2.26.2



                 reply	other threads:[~2020-09-04 20:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200904202324.31508-1-dilfridge@gentoo.org \
    --to=dilfridge@gentoo.org \
    --cc=gentoo-catalyst@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