1 |
commit: 7d55d5609676afb32c612fbdad56d4d3b49e8f84 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Nov 29 17:15:41 2017 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 29 17:15:41 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=7d55d560 |
7 |
|
8 |
WIP: Add an updates step to stage3 just before the pre-clean step |
9 |
|
10 |
Can be used to correct an issue with the stage that hats the precean step. |
11 |
|
12 |
catalyst/base/stagebase.py | 16 ++++++++++++++++ |
13 |
catalyst/targets/stage3.py | 9 +++++++++ |
14 |
targets/stage3/stage3-controller.sh | 4 ++++ |
15 |
targets/stage3/stage3-updates.sh | 10 ++++++++++ |
16 |
4 files changed, 39 insertions(+) |
17 |
|
18 |
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py |
19 |
index 7a41973c..63a577a0 100644 |
20 |
--- a/catalyst/base/stagebase.py |
21 |
+++ b/catalyst/base/stagebase.py |
22 |
@@ -882,6 +882,22 @@ class StageBase(TargetBase, ClearBase, GenBase): |
23 |
if "snapcache" in self.settings["options"]: |
24 |
self.snapcache_lock.unlock() |
25 |
|
26 |
+ def update_stage(self): |
27 |
+ if "autoresume" in self.settings["options"] \ |
28 |
+ and self.resume.is_enabled("update_stage"): |
29 |
+ log.notice('Resume point detected, skipping update_stage operation...') |
30 |
+ else: |
31 |
+ if self.settings["update_stage_command"]: |
32 |
+ try: |
33 |
+ if os.path.exists(self.settings["controller_file"]): |
34 |
+ cmd([self.settings['controller_file'], 'update_stage'], |
35 |
+ env=self.env) |
36 |
+ self.resume.enable("update_stage") |
37 |
+ |
38 |
+ except: |
39 |
+ self.unbind() |
40 |
+ raise CatalystError("Build failed, could not execute update_stage") |
41 |
+ |
42 |
def config_profile_link(self): |
43 |
if "autoresume" in self.settings["options"] \ |
44 |
and self.resume.is_enabled("config_profile_link"): |
45 |
|
46 |
diff --git a/catalyst/targets/stage3.py b/catalyst/targets/stage3.py |
47 |
index f0831932..1120349f 100644 |
48 |
--- a/catalyst/targets/stage3.py |
49 |
+++ b/catalyst/targets/stage3.py |
50 |
@@ -14,6 +14,7 @@ class stage3(StageBase): |
51 |
def __init__(self,spec,addlargs): |
52 |
self.required_values=[] |
53 |
self.valid_values=[] |
54 |
+ self.valid_values.extend(["update_stage_command"]) |
55 |
StageBase.__init__(self,spec,addlargs) |
56 |
|
57 |
def set_portage_overlay(self): |
58 |
@@ -24,5 +25,13 @@ class stage3(StageBase): |
59 |
"If you break it, you buy it. Don't complain to us about it.\n" |
60 |
"Don't say we did not warn you.") |
61 |
|
62 |
+ def set_action_sequence(self): |
63 |
+ """Set basic stage1, 2, 3 action sequences""" |
64 |
+ self.settings["action_sequence"] = ["unpack", "unpack_snapshot", |
65 |
+ "setup_confdir", "portage_overlay", |
66 |
+ "base_dirs", "bind", "chroot_setup", "setup_environment", |
67 |
+ "run_local", "update_stage", "preclean", "unbind", "clean"] |
68 |
+ self.set_completion_action_sequences() |
69 |
+ |
70 |
def set_cleanables(self): |
71 |
StageBase.set_cleanables(self) |
72 |
|
73 |
diff --git a/targets/stage3/stage3-controller.sh b/targets/stage3/stage3-controller.sh |
74 |
index df1479ea..ff958d67 100755 |
75 |
--- a/targets/stage3/stage3-controller.sh |
76 |
+++ b/targets/stage3/stage3-controller.sh |
77 |
@@ -15,6 +15,10 @@ case $1 in |
78 |
exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-chroot.sh |
79 |
;; |
80 |
|
81 |
+ update_stage) |
82 |
+ exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-updates.sh |
83 |
+ ;; |
84 |
+ |
85 |
preclean) |
86 |
exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh |
87 |
;; |
88 |
|
89 |
diff --git a/targets/stage3/stage3-updates.sh b/targets/stage3/stage3-updates.sh |
90 |
new file mode 100644 |
91 |
index 00000000..1b376de5 |
92 |
--- /dev/null |
93 |
+++ b/targets/stage3/stage3-updates.sh |
94 |
@@ -0,0 +1,10 @@ |
95 |
+#!/bin/bash |
96 |
+ |
97 |
+# Update stage3 (rebuilds, etc. needed to fix emerge complaints) |
98 |
+if [ -n "${clst_update_stage_command}" ]; then |
99 |
+ echo "Updating stage..." |
100 |
+ ${clst_update_stage_command} |
101 |
+else |
102 |
+ echo "Skipping seed stage update..." |
103 |
+fi |
104 |
+ |