Gentoo Archives: gentoo-catalyst

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

Replies