1 |
commit: ef6b486a75530a4f1940c981103f7ab27b24f544 |
2 |
Author: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Mar 11 00:43:29 2017 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 22 01:16:21 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=ef6b486a |
7 |
|
8 |
Add prepare_portage and clear_portage to functions.sh and to the controller.sh file for stages 2, 3 and 4. |
9 |
|
10 |
Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo.org> |
11 |
|
12 |
targets/stage2/stage2-controller.sh | 3 +++ |
13 |
targets/stage3/stage3-controller.sh | 3 +++ |
14 |
targets/stage4/stage4-controller.sh | 3 +++ |
15 |
targets/support/functions.sh | 23 +++++++++++++++++++++++ |
16 |
4 files changed, 32 insertions(+) |
17 |
|
18 |
diff --git a/targets/stage2/stage2-controller.sh b/targets/stage2/stage2-controller.sh |
19 |
index 25e51208..41bd43bb 100755 |
20 |
--- a/targets/stage2/stage2-controller.sh |
21 |
+++ b/targets/stage2/stage2-controller.sh |
22 |
@@ -10,6 +10,8 @@ case $1 in |
23 |
;; |
24 |
|
25 |
run) |
26 |
+ prepare_portage |
27 |
+ |
28 |
shift |
29 |
export clst_packages="$*" |
30 |
exec_in_chroot \ |
31 |
@@ -17,6 +19,7 @@ case $1 in |
32 |
;; |
33 |
|
34 |
preclean) |
35 |
+ clear_portage |
36 |
exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh |
37 |
;; |
38 |
|
39 |
|
40 |
diff --git a/targets/stage3/stage3-controller.sh b/targets/stage3/stage3-controller.sh |
41 |
index df1479ea..eaa40b3d 100755 |
42 |
--- a/targets/stage3/stage3-controller.sh |
43 |
+++ b/targets/stage3/stage3-controller.sh |
44 |
@@ -10,12 +10,15 @@ case $1 in |
45 |
;; |
46 |
|
47 |
run) |
48 |
+ prepare_portage |
49 |
+ |
50 |
shift |
51 |
export clst_packages="$*" |
52 |
exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-chroot.sh |
53 |
;; |
54 |
|
55 |
preclean) |
56 |
+ clear_portage |
57 |
exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh |
58 |
;; |
59 |
|
60 |
|
61 |
diff --git a/targets/stage4/stage4-controller.sh b/targets/stage4/stage4-controller.sh |
62 |
index d42f302f..4c5d5a06 100755 |
63 |
--- a/targets/stage4/stage4-controller.sh |
64 |
+++ b/targets/stage4/stage4-controller.sh |
65 |
@@ -10,6 +10,8 @@ case $1 in |
66 |
;; |
67 |
|
68 |
pre-kmerge) |
69 |
+ prepare_portage |
70 |
+ |
71 |
# Sets up the build environment before any kernels are compiled |
72 |
exec_in_chroot ${clst_shdir}/support/pre-kmerge.sh |
73 |
;; |
74 |
@@ -41,6 +43,7 @@ case $1 in |
75 |
;; |
76 |
|
77 |
preclean) |
78 |
+ clear_portage |
79 |
exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh ${clst_root_path} |
80 |
;; |
81 |
|
82 |
|
83 |
diff --git a/targets/support/functions.sh b/targets/support/functions.sh |
84 |
index cca2fd82..f743d419 100755 |
85 |
--- a/targets/support/functions.sh |
86 |
+++ b/targets/support/functions.sh |
87 |
@@ -16,6 +16,29 @@ delete_from_chroot(){ |
88 |
fi |
89 |
} |
90 |
|
91 |
+prepare_portage() { |
92 |
+ |
93 |
+ echo "CATALYST_USE=\"${clst_CATALYST_USE}\"" >> ${clst_chroot_path}${clst_make_conf} |
94 |
+ sed -i -e "/^USE=\"/s//\${CATALYST_USE} ${USE} /" ${clst_chroot_path}${clst_make_conf} |
95 |
+} |
96 |
+ |
97 |
+clear_portage() { |
98 |
+ # Clean-up USE again |
99 |
+ [ -e ${clst_chroot_path}${clst_make_conf} ] && echo "Drop \$CATALYST_USE from USE on ${clst_chroot_path}${clst_make_conf}" |
100 |
+ [ -e ${clst_chroot_path}${clst_make_conf} ] && sed -i -e "/^USE=\"/s/\${CATALYST_USE} //" ${clst_chroot_path}${clst_make_conf} |
101 |
+ [ -e ${clst_chroot_path}${clst_make_conf} ] && echo "Remove \$CATALYST_USE on ${clst_chroot_path}${clst_make_conf}" |
102 |
+ [ -e ${clst_chroot_path}${clst_make_conf} ] && sed -i -e "/^CATALYST_USE/d" ${clst_chroot_path}${clist_make_conf} |
103 |
+ |
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 |