1 |
This is preparation for the next patch, which will run the build |
2 |
sequence in a separate mount namespace. |
3 |
|
4 |
Signed-off-by: Matt Turner <mattst88@g.o> |
5 |
--- |
6 |
catalyst/base/stagebase.py | 40 ++++++++++++++++++++++---------------- |
7 |
1 file changed, 23 insertions(+), 17 deletions(-) |
8 |
|
9 |
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py |
10 |
index 75c84baa..06ec8727 100644 |
11 |
--- a/catalyst/base/stagebase.py |
12 |
+++ b/catalyst/base/stagebase.py |
13 |
@@ -1362,6 +1362,22 @@ class StageBase(TargetBase, ClearBase, GenBase): |
14 |
|
15 |
log.debug('setup_environment(); env = %r', self.env) |
16 |
|
17 |
+ def run_sequence(self, sequence): |
18 |
+ for func in sequence: |
19 |
+ log.notice('--- Running action sequence: %s', func) |
20 |
+ sys.stdout.flush() |
21 |
+ try: |
22 |
+ getattr(self, func)() |
23 |
+ except LockInUse: |
24 |
+ log.error('Unable to aquire the lock...') |
25 |
+ return False |
26 |
+ except Exception: |
27 |
+ log.error('Exception running action sequence %s', |
28 |
+ func, exc_info=True) |
29 |
+ return False |
30 |
+ |
31 |
+ return True |
32 |
+ |
33 |
def run(self): |
34 |
self.chroot_lock.write_lock() |
35 |
|
36 |
@@ -1386,26 +1402,16 @@ class StageBase(TargetBase, ClearBase, GenBase): |
37 |
log.info('StageBase: run() purge') |
38 |
self.purge() |
39 |
|
40 |
- failure = False |
41 |
- for x in self.prepare_sequence + self.build_sequence + self.finish_sequence: |
42 |
- log.notice('--- Running action sequence: %s', x) |
43 |
- sys.stdout.flush() |
44 |
- try: |
45 |
- getattr(self, x)() |
46 |
- except LockInUse: |
47 |
- log.error('Unable to aquire the lock...') |
48 |
- failure = True |
49 |
- break |
50 |
- except Exception: |
51 |
- log.error('Exception running action sequence %s', |
52 |
- x, exc_info=True) |
53 |
- failure = True |
54 |
- break |
55 |
+ if not self.run_sequence(self.prepare_sequence): |
56 |
+ return False |
57 |
|
58 |
- if failure: |
59 |
- log.notice('Cleaning up... Running unbind()') |
60 |
+ if not self.run_sequence(self.build_sequence): |
61 |
self.unbind() |
62 |
return False |
63 |
+ |
64 |
+ if not self.run_sequence(self.finish_sequence): |
65 |
+ return False |
66 |
+ |
67 |
return True |
68 |
|
69 |
def unmerge(self): |
70 |
-- |
71 |
2.26.2 |