1 |
commit: 52b7235e399444247adf3d9c24a20dd57db50f20 |
2 |
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 4 16:34:54 2020 +0000 |
4 |
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 4 20:18:17 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=52b7235e |
7 |
|
8 |
Allow "interpreter" parameter as space-separated list of files |
9 |
|
10 |
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org> |
11 |
|
12 |
catalyst/base/stagebase.py | 44 +++++++++++++++++++++++++++++--------------- |
13 |
1 file changed, 29 insertions(+), 15 deletions(-) |
14 |
|
15 |
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py |
16 |
index afeda722..0cf3495a 100644 |
17 |
--- a/catalyst/base/stagebase.py |
18 |
+++ b/catalyst/base/stagebase.py |
19 |
@@ -1061,21 +1061,28 @@ class StageBase(TargetBase, ClearBase, GenBase): |
20 |
|
21 |
shutil.copy('/etc/resolv.conf', self.settings['chroot_path'] + '/etc/') |
22 |
|
23 |
- # Copy over the binary interpreter (qemu), if applicable; note that it's given |
24 |
- # as full path and goes to the same place in the chroot |
25 |
+ # Copy over the binary interpreter(s) (qemu), if applicable; note that they are given |
26 |
+ # as space-separated list of full paths and go to the same place in the chroot |
27 |
if "interpreter" in self.settings: |
28 |
- if not os.path.exists(self.settings["interpreter"]): |
29 |
- raise CatalystError( |
30 |
- "Can't find interpreter " + self.settings["interpreter"], |
31 |
- print_traceback=True) |
32 |
|
33 |
- log.notice('Copying binary interpreter %s into chroot', self.settings['interpreter']) |
34 |
+ if isinstance(self.settings["interpreter"], str): |
35 |
+ myints = [self.settings["interpreter"]] |
36 |
+ else: |
37 |
+ myints = self.settings["interpreter"] |
38 |
+ |
39 |
+ for myi in myints: |
40 |
+ if not os.path.exists(myi): |
41 |
+ raise CatalystError( |
42 |
+ "Can't find interpreter " + myi, |
43 |
+ print_traceback=True) |
44 |
|
45 |
- if os.path.exists(self.settings['chroot_path'] + '/' + self.settings['interpreter']): |
46 |
- os.rename(self.settings['chroot_path'] + '/' + self.settings['interpreter'], self.settings['chroot_path'] + '/' + self.settings['interpreter'] + '.catalyst') |
47 |
+ log.notice('Copying binary interpreter %s into chroot', myi) |
48 |
|
49 |
- shutil.copy(self.settings['interpreter'], |
50 |
- self.settings['chroot_path'] + '/' + self.settings['interpreter']) |
51 |
+ if os.path.exists(self.settings['chroot_path'] + '/' + myi): |
52 |
+ os.rename(self.settings['chroot_path'] + '/' + myi, self.settings['chroot_path'] + '/' + myi + '.catalyst') |
53 |
+ |
54 |
+ shutil.copy(myi, |
55 |
+ self.settings['chroot_path'] + '/' + myi) |
56 |
|
57 |
# Copy over the envscript, if applicable |
58 |
if "envscript" in self.settings: |
59 |
@@ -1242,12 +1249,19 @@ class StageBase(TargetBase, ClearBase, GenBase): |
60 |
if os.path.exists(hosts_file + '.catalyst'): |
61 |
os.rename(hosts_file + '.catalyst', hosts_file) |
62 |
|
63 |
- # optionally clean up binary interpreter |
64 |
+ # optionally clean up binary interpreter(s) |
65 |
if "interpreter" in self.settings: |
66 |
- if os.path.exists(self.settings['chroot_path'] + '/' + self.settings['interpreter'] + '.catalyst'): |
67 |
- os.rename(self.settings['chroot_path'] + '/' + self.settings['interpreter'] + '.catalyst', self.settings['chroot_path'] + '/' + self.settings['interpreter']) |
68 |
+ |
69 |
+ if isinstance(self.settings["interpreter"], str): |
70 |
+ myints = [self.settings["interpreter"]] |
71 |
else: |
72 |
- os.remove(self.settings['chroot_path'] + '/' + self.settings['interpreter']) |
73 |
+ myints = self.settings["interpreter"] |
74 |
+ |
75 |
+ for myi in myints: |
76 |
+ if os.path.exists(self.settings['chroot_path'] + '/' + myi + '.catalyst'): |
77 |
+ os.rename(self.settings['chroot_path'] + '/' + myi + '.catalyst', self.settings['chroot_path'] + '/' + myi) |
78 |
+ else: |
79 |
+ os.remove(self.settings['chroot_path'] + '/' + myi) |
80 |
|
81 |
# optionally clean up portage configs |
82 |
if ("portage_prefix" in self.settings and |