commit:     b7e588333cbafa3a35a223614a960eed78464b79
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 20 00:24:30 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 20 00:25:23 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=b7e58833

Add "interpreter" parameter for qemu-user build support

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/base/stagebase.py | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 776e1a71..0ddd359f 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -41,7 +41,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
                        "cflags", "cxxflags", "fcflags", "fflags", "ldflags", 
"asflags",
                        "common_flags", "cbuild", "hostuse", "catalyst_use",
                        "distcc_hosts", "makeopts", "pkgcache_path", 
"kerncache_path",
-                       "compression_mode", "decompression_mode"])
+                       "compression_mode", "decompression_mode", 
"interpreter"])
 
                self.set_valid_build_kernel_vars(addlargs)
                TargetBase.__init__(self, myspec, addlargs)
@@ -1061,6 +1061,22 @@ 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
+                       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 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')
+
+                               shutil.copy(self.settings['interpreter'],
+                                       self.settings['chroot_path'] + '/' + 
self.settings['interpreter'])
+
                        # Copy over the envscript, if applicable
                        if "envscript" in self.settings:
                                if not 
os.path.exists(self.settings["envscript"]):
@@ -1226,6 +1242,13 @@ class StageBase(TargetBase, ClearBase, GenBase):
                if os.path.exists(hosts_file + '.catalyst'):
                        os.rename(hosts_file + '.catalyst', hosts_file)
 
+               # optionally clean up binary interpreter
+               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'])
+                       else:
+                               os.remove(self.settings['chroot_path'] + '/' + 
self.settings['interpreter'])
+
                # optionally clean up portage configs
                if ("portage_prefix" in self.settings and
                        "sticky-config" not in self.settings["options"]):

Reply via email to