Hi.

Apologies but I "mixed" my mailing lists when I sent this message earlier today.
Regards,

Jorge Manuel B. S. Vicetto
Gentoo Developer

---------- Forwarded message ----------
Date: Sun,  5 Jun 2016 11:29:13 +0000
From: "Jorge Manuel B. S. Vicetto (jmbsvicetto)" <[email protected]>
To: [email protected], [email protected]
Cc: "Jorge Manuel B. S. Vicetto (jmbsvicetto)" <[email protected]>
Subject: [PATCH] Fix USE not "sticking" between stage runs and allow set USE
    flags just for building - CATALYST_USE. This should fix bug 473332 and avoid
     the current issue of catalyst-3 stages being built without BINDIST. These
    changes don't allow setting USE flags for stage 1,
    2 and 3 and don't touch other stages (TODO).

Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto) <[email protected]>
---
 catalyst/base/stagebase.py        | 13 ++++++++++++-
 catalyst/targets/grp.py           |  7 -------
 catalyst/targets/livecd_stage1.py | 14 +++++---------
 targets/stage1/stage1-chroot.sh   |  9 +++++++--
 targets/stage2/stage2-chroot.sh   | 19 ++++++-------------
 targets/stage3/stage3-chroot.sh   | 10 ++++++++++
 6 files changed, 40 insertions(+), 32 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 6695ac4..de0fce4 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -173,6 +173,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
                self.set_controller_file()
                self.set_default_action_sequence()
                self.set_use()
+               self.set_catalyst_use()
                self.set_cleanables()
                self.set_iso_volume_id()
                self.set_build_kernel_vars()
@@ -547,9 +548,19 @@ class StageBase(TargetBase, ClearBase, GenBase):
                if isinstance(self.settings['use'], str):
                        self.settings["use"]=self.settings["use"].split()

+       def set_catalyst_use(self):
+               if self.settings["spec_prefix"]+"/catalyst_use" in 
self.settings:
+                       self.settings["catalyst_use"]=\
+                               
self.settings[self.settings["spec_prefix"]+"/catalyst_use"]
+                       del 
self.settings[self.settings["spec_prefix"]+"/catalyst_use"]
+               if "catalyst_use" not in self.settings:
+                       self.settings["catalyst_use"]=""
+               if isinstance(self.settings['catalyst_use'], str):
+                       
self.settings["catalyst_use"]=self.settings["catalyst_use"].split()
+
                # Force bindist when options ask for it
                if "BINDIST" in self.settings:
-                       self.settings["use"].append("bindist")
+                       self.settings["catalyst_use"].append("bindist")

        def set_stage_path(self):
                
self.settings["stage_path"]=normpath(self.settings["chroot_path"])
diff --git a/catalyst/targets/grp.py b/catalyst/targets/grp.py
index 049bc55..d47654d 100644
--- a/catalyst/targets/grp.py
+++ b/catalyst/targets/grp.py
@@ -52,13 +52,6 @@ class grp(StageBase):
                                raise CatalystError("GRP build aborting due to 
error.",
                                        print_traceback=True)

-       def set_use(self):
-               StageBase.set_use(self)
-               if "use" in self.settings:
-                       self.settings["use"].append("bindist")
-               else:
-                       self.settings["use"]=["bindist"]
-
        def set_mounts(self):
                self.mounts.append("/tmp/grp")
                self.mountmap["/tmp/grp"]=self.settings["target_path"]
diff --git a/catalyst/targets/livecd_stage1.py 
b/catalyst/targets/livecd_stage1.py
index eea4312..659eb43 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -29,16 +29,12 @@ class livecd_stage1(StageBase):
        def set_spec_prefix(self):
                self.settings["spec_prefix"]="livecd"

-       def set_use(self):
-               StageBase.set_use(self)
-               if "use" in self.settings:
-                       self.settings["use"].append("livecd")
-                       if "BINDIST" in self.settings:
-                               self.settings["use"].append("bindist")
+       def set_catalyst_use(self):
+               StageBase.set_catalyst_use(self)
+               if "catalyst_use" in self.settings:
+                       self.settings["catalyst_use"].append("livecd")
                else:
-                       self.settings["use"]=["livecd"]
-                       if "BINDIST" in self.settings:
-                               self.settings["use"].append("bindist")
+                       self.settings["catalyst_use"]=["livecd"]

        def set_packages(self):
                StageBase.set_packages(self)
diff --git a/targets/stage1/stage1-chroot.sh b/targets/stage1/stage1-chroot.sh
index fbda84b..291614b 100755
--- a/targets/stage1/stage1-chroot.sh
+++ b/targets/stage1/stage1-chroot.sh
@@ -53,7 +53,8 @@ sed -i "/USE=\"${USE} -build\"/d" ${clst_make_conf}

 # Now, we install our packages
 if [ -e ${clst_make_conf} ]; then
-       echo "USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"" >> 
${clst_make_conf}
+       echo "CATALYST_USE=\"-* build ${clst_CATALYST_USE}\"" >> 
${clst_make_conf}
+       echo "USE=\"${CATALYST_USE} ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"" >> 
${clst_make_conf}
        for useexpand in ${clst_HOSTUSEEXPAND}; do
                x="clst_${useexpand}"
                echo "${useexpand}=\"${!x}\"" \
@@ -62,8 +63,12 @@ if [ -e ${clst_make_conf} ]; then
 fi

 run_merge "--oneshot ${clst_buildpkgs}"
-sed -i "/USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"/d" \
+sed -i "/USE=\"/s/\${CATALYST_USE} //" \
        ${clst_make_conf}
+sed -i "/CATALYST_USE/d" \
+       ${clist_make_conf}
+
+# Why are we removing these? Don't we need them for final make.conf?
 for useexpand in ${clst_HOSTUSEEXPAND}; do
        x="clst_${useexpand}"
        sed -i "/${useexpand}=\"${!x}\"/d" \
diff --git a/targets/stage2/stage2-chroot.sh b/targets/stage2/stage2-chroot.sh
index 38dfea3..1667ffd 100755
--- a/targets/stage2/stage2-chroot.sh
+++ b/targets/stage2/stage2-chroot.sh
@@ -5,21 +5,14 @@ source /tmp/chroot-functions.sh
 # Setup the environment
 export FEATURES="${clst_myfeatures} nodoc noman noinfo -news"

-# Set bindist USE flag if clst_BINDIST is set
-# The bindist functions have been taken from support/chroot-functions.sh
-if [ -e "${clst_make_conf}" ] && [ -n "${clst_BINDIST}" ]; then
-       if grep -q ^USE "${clst_make_conf}"; then
-               echo "USE=\"\${USE} bindist\"" >> "${clst_make_conf}"
-       else
-               echo "USE=\"bindist\"" >> "${clst_make_conf}"
-       fi
-fi
-
-
+echo "CATALYST_USE=\"${clst_CATALYST_USE}\"" >> ${clst_make_conf}
+sed -i -e "/USE=\"/s/\${CATALYST_USE} " ${clst_make_conf}

 ## START BUILD
 ${clst_repo_basedir}/${clst_repo_name}/scripts/bootstrap.sh ${bootstrap_opts} 
|| exit 1

 # Clean-up USE again
-sed -i "/USE=\"\${USE} bindist\"/d" "${clst_make_conf}"
-sed -i "/USE=\"bindist\"/d" "${clst_make_conf}"
+sed -i "/USE=\"/s/\${CATALYST_USE} //" \
+       ${clst_make_conf}
+sed -i "/CATALYST_USE/d" \
+       ${clist_make_conf}
diff --git a/targets/stage3/stage3-chroot.sh b/targets/stage3/stage3-chroot.sh
index 6cf9106..d010d5e 100755
--- a/targets/stage3/stage3-chroot.sh
+++ b/targets/stage3/stage3-chroot.sh
@@ -2,7 +2,17 @@

 source /tmp/chroot-functions.sh

+echo "CATALYST_USE=\"${clst_CATALYST_USE}\"" >> ${clst_make_conf}
+sed -i -e "/USE=\"/s/\${CATALYST_USE} " ${clst_make_conf}
+
 ## START BUILD
 setup_pkgmgr

 run_merge "-e @system"
+
+# Clean-up USE again
+sed -i "/USE=\"/s/\${CATALYST_USE} //" \
+       ${clst_make_conf}
+sed -i "/CATALYST_USE/d" \
+       ${clist_make_conf}
+
--
2.8.2


Reply via email to