commit:     eef609335a51e9a04038e91a34ee694a866ec2ca
Author:     Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo 
<DOT> org>
AuthorDate: Sat Feb  4 21:43:01 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Feb  6 02:12:02 2017 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=eef60933

Add initial support for portage_prefix.

Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> 
gentoo.org>

 catalyst/base/stagebase.py          | 10 ++++++++--
 targets/stage1/stage1-controller.sh |  3 +++
 targets/stage2/stage2-controller.sh |  3 +++
 targets/stage3/stage3-controller.sh |  3 +++
 targets/support/functions.sh        | 16 ++++++++++++++++
 5 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 8d00fa1..2fd8925 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -36,8 +36,10 @@ class StageBase(TargetBase, ClearBase, GenBase):
                        "rel_type","profile","snapshot","source_subpath"])
 
                self.valid_values.extend(["version_stamp","target","subarch",
-                       
"rel_type","profile","snapshot","source_subpath","portage_confdir",
-                       
"cflags","cxxflags","fcflags","fflags","ldflags","asflags","cbuild","hostuse","portage_overlay",
+                       "rel_type","profile","snapshot","source_subpath",
+                       "portage_confdir","portage_prefix","portage_overlay",
+                       
"cflags","cxxflags","fcflags","fflags","ldflags","asflags",
+                       "cbuild","hostuse","catalyst_use",
                        
"distcc_hosts","makeopts","pkgcache_path","kerncache_path",
                        "compression_mode", "decompression_mode"])
 
@@ -601,6 +603,10 @@ class StageBase(TargetBase, ClearBase, GenBase):
                        log.info('portage_overlay directories are set to: %s',
                                ' '.join(self.settings['portage_overlay']))
 
+#      def set_portage_prefix(self):
+#              if "portage_prefix" in self.settings:
+#                      self.settings["portage_prefix"]=
+
        def set_overlay(self):
                if self.settings["spec_prefix"]+"/overlay" in self.settings:
                        if 
isinstance(self.settings[self.settings['spec_prefix']+'/overlay'], str):

diff --git a/targets/stage1/stage1-controller.sh 
b/targets/stage1/stage1-controller.sh
index ac813de..798d679 100755
--- a/targets/stage1/stage1-controller.sh
+++ b/targets/stage1/stage1-controller.sh
@@ -16,6 +16,8 @@ case "$1" in
                # Setup make.conf and make.profile link in "ROOT in chroot":
                copy_to_chroot "${clst_chroot_path}${clst_make_conf}" 
"${clst_root_path}${clst_port_conf}"
 
+               prepare_portage
+
                # Enter chroot, execute our build script
                exec_in_chroot \
                        "${clst_shdir}/${clst_target}/${clst_target}-chroot.sh" 
\
@@ -23,6 +25,7 @@ case "$1" in
        ;;
 
        preclean)
+               clear_portage
                exec_in_chroot 
"${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh" || exit 1
        ;;
 

diff --git a/targets/stage2/stage2-controller.sh 
b/targets/stage2/stage2-controller.sh
index 25e5120..41bd43b 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 df1479e..eaa40b3 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/support/functions.sh b/targets/support/functions.sh
index cca2fd8..eded8b7 100755
--- a/targets/support/functions.sh
+++ b/targets/support/functions.sh
@@ -16,6 +16,22 @@ delete_from_chroot(){
        fi
 }
 
+prepare_portage() {
+
+       echo "CATALYST_USE=\"${clst_CATALYST_USE}\"" >> ${clst_make_conf}
+       sed -i -e "/USE=\"/s/\${CATALYST_USE} " ${clst_make_conf}
+}
+
+clear_portage() {
+       # Clean-up USE again
+       sed -i "/USE=\"/s/\${CATALYST_USE} //" ${clst_make_conf}
+       sed -i "/CATALYST_USE/d" ${clist_make_conf}
+
+       if [ -n "${clst_portage_prefix}" ]; then
+               rm -R "${clst_chroot_path}/etc/portage/${clst_portage_prefix}"
+       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

Reply via email to