Gentoo Archives: gentoo-catalyst

From: Brian Dolbec <dolsen@g.o>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] [PATCH 1/9] targets: Remove clst_my* prefix
Date: Sat, 16 May 2020 19:01:14
Message-Id: 20200516120107.47bbf15c@storm
In Reply to: [gentoo-catalyst] [PATCH 1/9] targets: Remove clst_my* prefix by Matt Turner
1 On Fri, 15 May 2020 23:53:09 -0700
2 Matt Turner <mattst88@g.o> wrote:
3
4 > clst_* prefixed variables are created by setup_environment(), which
5 > these variables are not. Also, prefixing variable names with 'my' is
6 > an anti-pattern.
7 >
8 > Rename the functions that create these variables at the same time.
9 >
10 > Signed-off-by: Matt Turner <mattst88@g.o>
11 > ---
12
13
14 Hmmmmm, I added the clst_ prefix to try and get a handle on the
15 variables exported by the python as part of the cleanup. So, I can only
16 surmize that myfeatures was originally exported by the python code at
17 one point.
18
19 If that is the case this one is no longer exported, then go for it...
20 I also don't like the my prefix tagged variables.
21
22
23
24 > targets/netboot/pkg.sh | 2 +-
25 > targets/stage1/chroot.sh | 4 ++--
26 > targets/stage2/chroot.sh | 2 +-
27 > targets/support/chroot-functions.sh | 34
28 > ++++++++++++++--------------- targets/support/kmerge.sh |
29 > 4 ++-- 5 files changed, 23 insertions(+), 23 deletions(-)
30 >
31 > diff --git a/targets/netboot/pkg.sh b/targets/netboot/pkg.sh
32 > index 29da7134..2ec27062 100755
33 > --- a/targets/netboot/pkg.sh
34 > +++ b/targets/netboot/pkg.sh
35 > @@ -4,7 +4,7 @@ source /tmp/chroot-functions.sh
36 >
37 > update_env_settings
38 >
39 > -setup_myfeatures
40 > +setup_features
41 >
42 > show_debug
43 >
44 > diff --git a/targets/stage1/chroot.sh b/targets/stage1/chroot.sh
45 > index 9c7ef6ca..a42afd19 100755
46 > --- a/targets/stage1/chroot.sh
47 > +++ b/targets/stage1/chroot.sh
48 > @@ -9,7 +9,7 @@ export clst_buildpkgs="$(/tmp/build.py)"
49 > [ -n "${clst_BINDIST}" ] && BINDIST="bindist"
50 > BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)"
51 >
52 > -FEATURES="${clst_myfeatures} nodoc noman noinfo -news"
53 > +FEATURES="${features} nodoc noman noinfo -news"
54 >
55 > ## Sanity check profile
56 > if [ -z "${clst_buildpkgs}" ]
57 > @@ -39,7 +39,7 @@ if [ -n "${clst_update_seed}" ]; then
58 > fi
59 >
60 > # reset emerge options for the target
61 > - clst_update_seed=no setup_myemergeopts
62 > + clst_update_seed=no setup_emerge_opts
63 > else
64 > echo "Skipping seed stage update..."
65 > fi
66 > diff --git a/targets/stage2/chroot.sh b/targets/stage2/chroot.sh
67 > index bf98d328..e472fe16 100755
68 > --- a/targets/stage2/chroot.sh
69 > +++ b/targets/stage2/chroot.sh
70 > @@ -3,7 +3,7 @@
71 > source /tmp/chroot-functions.sh
72 >
73 > # Setup the environment
74 > -export FEATURES="${clst_myfeatures} nodoc noman noinfo -news"
75 > +export FEATURES="${features} nodoc noman noinfo -news"
76 > export CONFIG_PROTECT="-* /etc/locale.gen"
77 >
78 > echo "$locales" > /etc/locale.gen
79 > diff --git a/targets/support/chroot-functions.sh
80 > b/targets/support/chroot-functions.sh index 993dc209..2eb90117 100755
81 > --- a/targets/support/chroot-functions.sh
82 > +++ b/targets/support/chroot-functions.sh
83 > @@ -76,19 +76,19 @@ get_libdir() {
84 > echo ${var}
85 > }
86 >
87 > -setup_myfeatures(){
88 > - setup_myemergeopts
89 > - export clst_myfeatures="-news binpkg-multi-instance
90 > clean-logs parallel-install"
91 > - export FEATURES="${clst_myfeatures}"
92 > +setup_features() {
93 > + setup_emerge_opts
94 > + export features="-news binpkg-multi-instance clean-logs
95 > parallel-install"
96 > + export FEATURES="${features}"
97 > if [ -n "${clst_CCACHE}" ]
98 > then
99 > - export clst_myfeatures="${clst_myfeatures} ccache"
100 > + export features="${features} ccache"
101 > clst_root_path=/ run_merge --oneshot --noreplace
102 > dev-util/ccache || exit 1 fi
103 >
104 > if [ -n "${clst_DISTCC}" ]
105 > then
106 > - export clst_myfeatures="${clst_myfeatures} distcc"
107 > + export features="${features} distcc"
108 > export DISTCC_HOSTS="${clst_distcc_hosts}"
109 > [ -e ${clst_make_conf} ] && \
110 > echo 'USE="${USE} -avahi -gtk -gnome"' >>
111 > ${clst_make_conf} @@ -133,26 +133,26 @@ setup_myfeatures(){
112 > export PATH="/usr/lib/icecc/bin:${PATH}"
113 > export PREROOTPATH="/usr/lib/icecc/bin"
114 > fi
115 > - export FEATURES="${clst_myfeatures}"
116 > + export FEATURES="${features}"
117 > }
118 >
119 > -setup_myemergeopts(){
120 > +setup_emerge_opts() {
121 > if [[ "${clst_VERBOSE}" == "true" ]]
122 > then
123 > - clst_myemergeopts="--verbose"
124 > + emerge_opts="--verbose"
125 > bootstrap_opts="${bootstrap_opts} -v"
126 > else
127 > - clst_myemergeopts="--quiet"
128 > + emerge_opts="--quiet"
129 > bootstrap_opts="${bootstrap_opts} -q"
130 > fi
131 > if [ -n "${clst_FETCH}" ]
132 > then
133 > export bootstrap_opts="${bootstrap_opts} -f"
134 > - export clst_myemergeopts="${clst_myemergeopts} -f"
135 > + export emerge_opts="${emerge_opts} -f"
136 > # if we have PKGCACHE, and either update_seed is empty or
137 > 'no', make and use binpkgs elif [ -n "${clst_PKGCACHE}" ] && [ -z
138 > "${clst_update_seed}" -o "${clst_update_seed}" = "no" ] then
139 > - export clst_myemergeopts="${clst_myemergeopts}
140 > --usepkg --buildpkg --binpkg-respect-use=y --newuse"
141 > + export emerge_opts="${emerge_opts} --usepkg
142 > --buildpkg --binpkg-respect-use=y --newuse" export
143 > bootstrap_opts="${bootstrap_opts} -r" fi
144 > }
145 > @@ -274,13 +274,13 @@ run_merge() {
146 >
147 > if [[ "${clst_VERBOSE}" == "true" ]]
148 > then
149 > - echo "ROOT=${ROOT} emerge ${clst_myemergeopts} -pt
150 > $@" || exit 1
151 > - emerge ${clst_myemergeopts} -pt $@ || exit 3
152 > + echo "ROOT=${ROOT} emerge ${emerge_opts} -pt $@" ||
153 > exit 1
154 > + emerge ${emerge_opts} -pt $@ || exit 3
155 > fi
156 >
157 > - echo "emerge ${clst_myemergeopts} $@" || exit 1
158 > + echo "emerge ${emerge_opts} $@" || exit 1
159 >
160 > - emerge ${clst_myemergeopts} $@ || exit 1
161 > + emerge ${emerge_opts} $@ || exit 1
162 > }
163 >
164 > show_debug() {
165 > @@ -323,7 +323,7 @@ run_default_funcs() {
166 > if [ "${RUN_DEFAULT_FUNCS}" != "no" ]
167 > then
168 > update_env_settings
169 > - setup_myfeatures
170 > + setup_features
171 > show_debug
172 > fi
173 > }
174 > diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
175 > index 7a00059a..8a15fc04 100755
176 > --- a/targets/support/kmerge.sh
177 > +++ b/targets/support/kmerge.sh
178 > @@ -212,7 +212,7 @@ then
179 >
180 > # install dependencies of kernel sources ahead of time in
181 > case # package.provided generated below causes them not to be
182 > (re)installed
183 > - PKGDIR=${PKGDIR} clst_myemergeopts="--quiet --usepkg
184 > --buildpkg --binpkg-respect-use=y --update --newuse --onlydeps"
185 > run_merge "${clst_ksource}" || exit 1
186 > + PKGDIR=${PKGDIR} emerge_opts="--quiet --usepkg --buildpkg
187 > --binpkg-respect-use=y --update --newuse --onlydeps" run_merge
188 > "${clst_ksource}" || exit 1 # Create the kerncache directory if it
189 > doesn't exists mkdir -p /tmp/kerncache/${clst_kname}
190 > @@ -236,7 +236,7 @@ then
191 >
192 > [ -L /usr/src/linux ] && rm -f /usr/src/linux
193 >
194 > - PKGDIR=${PKGDIR} clst_myemergeopts="--quiet --update
195 > --newuse" run_merge "${clst_ksource}" || exit 1
196 > + PKGDIR=${PKGDIR} emerge_opts="--quiet --update --newuse"
197 > run_merge "${clst_ksource}" || exit 1
198 > SOURCESDIR="/tmp/kerncache/${clst_kname}/sources"
199 > if [ -L /usr/src/linux ]