aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto@gentoo.org>2017-03-11 00:43:29 +0000
committerBrian Dolbec <dolsen@gentoo.org>2017-11-21 17:16:21 -0800
commitef6b486a75530a4f1940c981103f7ab27b24f544 (patch)
tree42d9863cdfcf21dd3e17c28fdd867bb29474dd0a
parentImprove the order of USE definition, make sure to remove USE after building p... (diff)
downloadcatalyst-ef6b486a75530a4f1940c981103f7ab27b24f544.tar.gz
catalyst-ef6b486a75530a4f1940c981103f7ab27b24f544.tar.bz2
catalyst-ef6b486a75530a4f1940c981103f7ab27b24f544.zip
Add prepare_portage and clear_portage to functions.sh and to the controller.sh file for stages 2, 3 and 4.
Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto@gentoo.org>
-rwxr-xr-xtargets/stage2/stage2-controller.sh3
-rwxr-xr-xtargets/stage3/stage3-controller.sh3
-rwxr-xr-xtargets/stage4/stage4-controller.sh3
-rwxr-xr-xtargets/support/functions.sh23
4 files changed, 32 insertions, 0 deletions
diff --git a/targets/stage2/stage2-controller.sh b/targets/stage2/stage2-controller.sh
index 25e51208..41bd43bb 100755
--- a/targets/stage2/stage2-controller.sh
+++ b/targets/stage2/stage2-controller.sh
@@ -10,6 +10,8 @@ case $1 in
;;
run)
+ prepare_portage
+
shift
export clst_packages="$*"
exec_in_chroot \
@@ -17,6 +19,7 @@ case $1 in
;;
preclean)
+ clear_portage
exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh
;;
diff --git a/targets/stage3/stage3-controller.sh b/targets/stage3/stage3-controller.sh
index df1479ea..eaa40b3d 100755
--- a/targets/stage3/stage3-controller.sh
+++ b/targets/stage3/stage3-controller.sh
@@ -10,12 +10,15 @@ case $1 in
;;
run)
+ prepare_portage
+
shift
export clst_packages="$*"
exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-chroot.sh
;;
preclean)
+ clear_portage
exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh
;;
diff --git a/targets/stage4/stage4-controller.sh b/targets/stage4/stage4-controller.sh
index d42f302f..4c5d5a06 100755
--- a/targets/stage4/stage4-controller.sh
+++ b/targets/stage4/stage4-controller.sh
@@ -10,6 +10,8 @@ case $1 in
;;
pre-kmerge)
+ prepare_portage
+
# Sets up the build environment before any kernels are compiled
exec_in_chroot ${clst_shdir}/support/pre-kmerge.sh
;;
@@ -41,6 +43,7 @@ case $1 in
;;
preclean)
+ clear_portage
exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh ${clst_root_path}
;;
diff --git a/targets/support/functions.sh b/targets/support/functions.sh
index cca2fd82..f743d419 100755
--- a/targets/support/functions.sh
+++ b/targets/support/functions.sh
@@ -16,6 +16,29 @@ delete_from_chroot(){
fi
}
+prepare_portage() {
+
+ echo "CATALYST_USE=\"${clst_CATALYST_USE}\"" >> ${clst_chroot_path}${clst_make_conf}
+ sed -i -e "/^USE=\"/s//\${CATALYST_USE} ${USE} /" ${clst_chroot_path}${clst_make_conf}
+}
+
+clear_portage() {
+ # Clean-up USE again
+ [ -e ${clst_chroot_path}${clst_make_conf} ] && echo "Drop \$CATALYST_USE from USE on ${clst_chroot_path}${clst_make_conf}"
+ [ -e ${clst_chroot_path}${clst_make_conf} ] && sed -i -e "/^USE=\"/s/\${CATALYST_USE} //" ${clst_chroot_path}${clst_make_conf}
+ [ -e ${clst_chroot_path}${clst_make_conf} ] && echo "Remove \$CATALYST_USE on ${clst_chroot_path}${clst_make_conf}"
+ [ -e ${clst_chroot_path}${clst_make_conf} ] && sed -i -e "/^CATALYST_USE/d" ${clst_chroot_path}${clist_make_conf}
+
+ if [ -n "${clst_portage_prefix}" ]; then
+ for dir in "keywords", "mask", "unmask", "use"; do
+ [ -d ${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix} ] &&
+ echo "Clear ${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix}"
+ [ -d ${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix} ] &&
+ rm -R "${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix}"
+ done
+ fi
+}
+
exec_in_chroot(){
# Takes the full path to the source file as its argument
# copies the file to the /tmp directory of the chroot