1 |
commit: 1eb7a1208dfe34d126f0f700b62214f01042b271 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Mar 19 22:06:11 2017 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 22 01:16:22 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=1eb7a120 |
7 |
|
8 |
Unify stage cleaning |
9 |
|
10 |
Move the clear_portage() code to the python side clean(). |
11 |
Put that code behind the sticky-config option. |
12 |
|
13 |
catalyst/base/stagebase.py | 9 +++++++++ |
14 |
catalyst/fileops.py | 2 +- |
15 |
targets/stage2/stage2-controller.sh | 1 - |
16 |
targets/stage3/stage3-controller.sh | 1 - |
17 |
targets/stage4/stage4-controller.sh | 1 - |
18 |
targets/support/functions.sh | 11 ----------- |
19 |
6 files changed, 10 insertions(+), 15 deletions(-) |
20 |
|
21 |
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py |
22 |
index a7aa7f41..7a41973c 100644 |
23 |
--- a/catalyst/base/stagebase.py |
24 |
+++ b/catalyst/base/stagebase.py |
25 |
@@ -1201,6 +1201,15 @@ class StageBase(TargetBase, ClearBase, GenBase): |
26 |
if os.path.exists(hosts_file + '.catalyst'): |
27 |
os.rename(hosts_file + '.catalyst', hosts_file) |
28 |
|
29 |
+ # optionally clean up portage configs |
30 |
+ if ("portage_prefix" in self.settings and |
31 |
+ "sticky-config" not in self.settings["options"]): |
32 |
+ for _dir in "keywords", "mask", "unmask", "use": |
33 |
+ target = pjoin([self.settings['chroot_path'], |
34 |
+ "/etc/portage/package.%s" % _dir, |
35 |
+ self.settings["portage_prefix"]]) |
36 |
+ clear_path(target) |
37 |
+ |
38 |
# Remove our overlay |
39 |
if os.path.exists(self.settings["chroot_path"] + self.settings["local_overlay"]): |
40 |
clear_path(self.settings["chroot_path"] + self.settings["local_overlay"]) |
41 |
|
42 |
diff --git a/catalyst/fileops.py b/catalyst/fileops.py |
43 |
index d2bd4530..ef4ee8d1 100644 |
44 |
--- a/catalyst/fileops.py |
45 |
+++ b/catalyst/fileops.py |
46 |
@@ -71,7 +71,7 @@ def clear_dir(target, mode=0o755, chg_flags=False, remove=False, |
47 |
|
48 |
mystat = None |
49 |
if os.path.isdir(target) and not os.path.islink(target): |
50 |
- log.info('Emptying directory: %s', target) |
51 |
+ log.notice('Emptying directory: %s', target) |
52 |
# stat the dir, delete the dir, recreate the dir and set |
53 |
# the proper perms and ownership |
54 |
try: |
55 |
|
56 |
diff --git a/targets/stage2/stage2-controller.sh b/targets/stage2/stage2-controller.sh |
57 |
index 2eee79f3..25e51208 100755 |
58 |
--- a/targets/stage2/stage2-controller.sh |
59 |
+++ b/targets/stage2/stage2-controller.sh |
60 |
@@ -17,7 +17,6 @@ case $1 in |
61 |
;; |
62 |
|
63 |
preclean) |
64 |
- clear_portage |
65 |
exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh |
66 |
;; |
67 |
|
68 |
|
69 |
diff --git a/targets/stage3/stage3-controller.sh b/targets/stage3/stage3-controller.sh |
70 |
index 2d415e40..df1479ea 100755 |
71 |
--- a/targets/stage3/stage3-controller.sh |
72 |
+++ b/targets/stage3/stage3-controller.sh |
73 |
@@ -16,7 +16,6 @@ case $1 in |
74 |
;; |
75 |
|
76 |
preclean) |
77 |
- clear_portage |
78 |
exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh |
79 |
;; |
80 |
|
81 |
|
82 |
diff --git a/targets/stage4/stage4-controller.sh b/targets/stage4/stage4-controller.sh |
83 |
index 6a876c82..d42f302f 100755 |
84 |
--- a/targets/stage4/stage4-controller.sh |
85 |
+++ b/targets/stage4/stage4-controller.sh |
86 |
@@ -41,7 +41,6 @@ case $1 in |
87 |
;; |
88 |
|
89 |
preclean) |
90 |
- clear_portage |
91 |
exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh ${clst_root_path} |
92 |
;; |
93 |
|
94 |
|
95 |
diff --git a/targets/support/functions.sh b/targets/support/functions.sh |
96 |
index ac4ec6c7..cca2fd82 100755 |
97 |
--- a/targets/support/functions.sh |
98 |
+++ b/targets/support/functions.sh |
99 |
@@ -16,17 +16,6 @@ delete_from_chroot(){ |
100 |
fi |
101 |
} |
102 |
|
103 |
-clear_portage() { |
104 |
- if [ -n "${clst_portage_prefix}" ]; then |
105 |
- for dir in "keywords", "mask", "unmask", "use"; do |
106 |
- [ -d ${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix} ] && |
107 |
- echo "Clear ${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix}" |
108 |
- [ -d ${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix} ] && |
109 |
- rm -R "${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix}" |
110 |
- done |
111 |
- fi |
112 |
-} |
113 |
- |
114 |
exec_in_chroot(){ |
115 |
# Takes the full path to the source file as its argument |
116 |
# copies the file to the /tmp directory of the chroot |