Gentoo Archives: gentoo-catalyst

From: "Jorge Manuel B. S. Vicetto" <jmbsvicetto@g.o>
To: gentoo-catalyst@l.g.o
Subject: [gentoo-catalyst] [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 with (fwd)
Date: Sun, 05 Jun 2016 20:00:41
Message-Id: alpine.LNX.2.00.1606051959380.22943@woodpecker.gentoo.org
1 Hi.
2
3 Apologies but I "mixed" my mailing lists when I sent this message earlier
4 today.
5 Regards,
6
7 Jorge Manuel B. S. Vicetto
8 Gentoo Developer
9
10 ---------- Forwarded message ----------
11 Date: Sun, 5 Jun 2016 11:29:13 +0000
12 From: "Jorge Manuel B. S. Vicetto (jmbsvicetto)" <jmbsvicetto@g.o>
13 To: gentoo-releng@l.g.o, releng@g.o
14 Cc: "Jorge Manuel B. S. Vicetto (jmbsvicetto)" <jmbsvicetto@g.o>
15 Subject: [PATCH] Fix USE not "sticking" between stage runs and allow set USE
16 flags just for building - CATALYST_USE. This should fix bug 473332 and avoid
17 the current issue of catalyst-3 stages being built without BINDIST. These
18 changes don't allow setting USE flags for stage 1,
19 2 and 3 and don't touch other stages (TODO).
20
21 Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto@g.o>
22 ---
23 catalyst/base/stagebase.py | 13 ++++++++++++-
24 catalyst/targets/grp.py | 7 -------
25 catalyst/targets/livecd_stage1.py | 14 +++++---------
26 targets/stage1/stage1-chroot.sh | 9 +++++++--
27 targets/stage2/stage2-chroot.sh | 19 ++++++-------------
28 targets/stage3/stage3-chroot.sh | 10 ++++++++++
29 6 files changed, 40 insertions(+), 32 deletions(-)
30
31 diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
32 index 6695ac4..de0fce4 100644
33 --- a/catalyst/base/stagebase.py
34 +++ b/catalyst/base/stagebase.py
35 @@ -173,6 +173,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
36 self.set_controller_file()
37 self.set_default_action_sequence()
38 self.set_use()
39 + self.set_catalyst_use()
40 self.set_cleanables()
41 self.set_iso_volume_id()
42 self.set_build_kernel_vars()
43 @@ -547,9 +548,19 @@ class StageBase(TargetBase, ClearBase, GenBase):
44 if isinstance(self.settings['use'], str):
45 self.settings["use"]=self.settings["use"].split()
46
47 + def set_catalyst_use(self):
48 + if self.settings["spec_prefix"]+"/catalyst_use" in self.settings:
49 + self.settings["catalyst_use"]=\
50 + self.settings[self.settings["spec_prefix"]+"/catalyst_use"]
51 + del self.settings[self.settings["spec_prefix"]+"/catalyst_use"]
52 + if "catalyst_use" not in self.settings:
53 + self.settings["catalyst_use"]=""
54 + if isinstance(self.settings['catalyst_use'], str):
55 + self.settings["catalyst_use"]=self.settings["catalyst_use"].split()
56 +
57 # Force bindist when options ask for it
58 if "BINDIST" in self.settings:
59 - self.settings["use"].append("bindist")
60 + self.settings["catalyst_use"].append("bindist")
61
62 def set_stage_path(self):
63 self.settings["stage_path"]=normpath(self.settings["chroot_path"])
64 diff --git a/catalyst/targets/grp.py b/catalyst/targets/grp.py
65 index 049bc55..d47654d 100644
66 --- a/catalyst/targets/grp.py
67 +++ b/catalyst/targets/grp.py
68 @@ -52,13 +52,6 @@ class grp(StageBase):
69 raise CatalystError("GRP build aborting due to error.",
70 print_traceback=True)
71
72 - def set_use(self):
73 - StageBase.set_use(self)
74 - if "use" in self.settings:
75 - self.settings["use"].append("bindist")
76 - else:
77 - self.settings["use"]=["bindist"]
78 -
79 def set_mounts(self):
80 self.mounts.append("/tmp/grp")
81 self.mountmap["/tmp/grp"]=self.settings["target_path"]
82 diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
83 index eea4312..659eb43 100644
84 --- a/catalyst/targets/livecd_stage1.py
85 +++ b/catalyst/targets/livecd_stage1.py
86 @@ -29,16 +29,12 @@ class livecd_stage1(StageBase):
87 def set_spec_prefix(self):
88 self.settings["spec_prefix"]="livecd"
89
90 - def set_use(self):
91 - StageBase.set_use(self)
92 - if "use" in self.settings:
93 - self.settings["use"].append("livecd")
94 - if "BINDIST" in self.settings:
95 - self.settings["use"].append("bindist")
96 + def set_catalyst_use(self):
97 + StageBase.set_catalyst_use(self)
98 + if "catalyst_use" in self.settings:
99 + self.settings["catalyst_use"].append("livecd")
100 else:
101 - self.settings["use"]=["livecd"]
102 - if "BINDIST" in self.settings:
103 - self.settings["use"].append("bindist")
104 + self.settings["catalyst_use"]=["livecd"]
105
106 def set_packages(self):
107 StageBase.set_packages(self)
108 diff --git a/targets/stage1/stage1-chroot.sh b/targets/stage1/stage1-chroot.sh
109 index fbda84b..291614b 100755
110 --- a/targets/stage1/stage1-chroot.sh
111 +++ b/targets/stage1/stage1-chroot.sh
112 @@ -53,7 +53,8 @@ sed -i "/USE=\"${USE} -build\"/d" ${clst_make_conf}
113
114 # Now, we install our packages
115 if [ -e ${clst_make_conf} ]; then
116 - echo "USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"" >> ${clst_make_conf}
117 + echo "CATALYST_USE=\"-* build ${clst_CATALYST_USE}\"" >> ${clst_make_conf}
118 + echo "USE=\"${CATALYST_USE} ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"" >> ${clst_make_conf}
119 for useexpand in ${clst_HOSTUSEEXPAND}; do
120 x="clst_${useexpand}"
121 echo "${useexpand}=\"${!x}\"" \
122 @@ -62,8 +63,12 @@ if [ -e ${clst_make_conf} ]; then
123 fi
124
125 run_merge "--oneshot ${clst_buildpkgs}"
126 -sed -i "/USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"/d" \
127 +sed -i "/USE=\"/s/\${CATALYST_USE} //" \
128 ${clst_make_conf}
129 +sed -i "/CATALYST_USE/d" \
130 + ${clist_make_conf}
131 +
132 +# Why are we removing these? Don't we need them for final make.conf?
133 for useexpand in ${clst_HOSTUSEEXPAND}; do
134 x="clst_${useexpand}"
135 sed -i "/${useexpand}=\"${!x}\"/d" \
136 diff --git a/targets/stage2/stage2-chroot.sh b/targets/stage2/stage2-chroot.sh
137 index 38dfea3..1667ffd 100755
138 --- a/targets/stage2/stage2-chroot.sh
139 +++ b/targets/stage2/stage2-chroot.sh
140 @@ -5,21 +5,14 @@ source /tmp/chroot-functions.sh
141 # Setup the environment
142 export FEATURES="${clst_myfeatures} nodoc noman noinfo -news"
143
144 -# Set bindist USE flag if clst_BINDIST is set
145 -# The bindist functions have been taken from support/chroot-functions.sh
146 -if [ -e "${clst_make_conf}" ] && [ -n "${clst_BINDIST}" ]; then
147 - if grep -q ^USE "${clst_make_conf}"; then
148 - echo "USE=\"\${USE} bindist\"" >> "${clst_make_conf}"
149 - else
150 - echo "USE=\"bindist\"" >> "${clst_make_conf}"
151 - fi
152 -fi
153 -
154 -
155 +echo "CATALYST_USE=\"${clst_CATALYST_USE}\"" >> ${clst_make_conf}
156 +sed -i -e "/USE=\"/s/\${CATALYST_USE} " ${clst_make_conf}
157
158 ## START BUILD
159 ${clst_repo_basedir}/${clst_repo_name}/scripts/bootstrap.sh ${bootstrap_opts} || exit 1
160
161 # Clean-up USE again
162 -sed -i "/USE=\"\${USE} bindist\"/d" "${clst_make_conf}"
163 -sed -i "/USE=\"bindist\"/d" "${clst_make_conf}"
164 +sed -i "/USE=\"/s/\${CATALYST_USE} //" \
165 + ${clst_make_conf}
166 +sed -i "/CATALYST_USE/d" \
167 + ${clist_make_conf}
168 diff --git a/targets/stage3/stage3-chroot.sh b/targets/stage3/stage3-chroot.sh
169 index 6cf9106..d010d5e 100755
170 --- a/targets/stage3/stage3-chroot.sh
171 +++ b/targets/stage3/stage3-chroot.sh
172 @@ -2,7 +2,17 @@
173
174 source /tmp/chroot-functions.sh
175
176 +echo "CATALYST_USE=\"${clst_CATALYST_USE}\"" >> ${clst_make_conf}
177 +sed -i -e "/USE=\"/s/\${CATALYST_USE} " ${clst_make_conf}
178 +
179 ## START BUILD
180 setup_pkgmgr
181
182 run_merge "-e @system"
183 +
184 +# Clean-up USE again
185 +sed -i "/USE=\"/s/\${CATALYST_USE} //" \
186 + ${clst_make_conf}
187 +sed -i "/CATALYST_USE/d" \
188 + ${clist_make_conf}
189 +
190 --
191 2.8.2

Replies