On Fri, 15 May 2020 23:53:09 -0700
Matt Turner <[email protected]> wrote:

> clst_* prefixed variables are created by setup_environment(), which
> these variables are not. Also, prefixing variable names with 'my' is
> an anti-pattern.
> 
> Rename the functions that create these variables at the same time.
> 
> Signed-off-by: Matt Turner <[email protected]>
> ---


Hmmmmm, I added the clst_ prefix to try and get a handle on the
variables exported by the python as part of the cleanup.  So, I can only
surmize that myfeatures was originally exported by the python code at
one point.

If that is the case this one is no longer exported, then go for it...
I also don't like the my prefix tagged variables.



>  targets/netboot/pkg.sh              |  2 +-
>  targets/stage1/chroot.sh            |  4 ++--
>  targets/stage2/chroot.sh            |  2 +-
>  targets/support/chroot-functions.sh | 34
> ++++++++++++++--------------- targets/support/kmerge.sh           |
> 4 ++-- 5 files changed, 23 insertions(+), 23 deletions(-)
> 
> diff --git a/targets/netboot/pkg.sh b/targets/netboot/pkg.sh
> index 29da7134..2ec27062 100755
> --- a/targets/netboot/pkg.sh
> +++ b/targets/netboot/pkg.sh
> @@ -4,7 +4,7 @@ source /tmp/chroot-functions.sh
>  
>  update_env_settings
>  
> -setup_myfeatures
> +setup_features
>  
>  show_debug
>  
> diff --git a/targets/stage1/chroot.sh b/targets/stage1/chroot.sh
> index 9c7ef6ca..a42afd19 100755
> --- a/targets/stage1/chroot.sh
> +++ b/targets/stage1/chroot.sh
> @@ -9,7 +9,7 @@ export clst_buildpkgs="$(/tmp/build.py)"
>  [ -n "${clst_BINDIST}" ] && BINDIST="bindist"
>  BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)"
>  
> -FEATURES="${clst_myfeatures} nodoc noman noinfo -news"
> +FEATURES="${features} nodoc noman noinfo -news"
>  
>  ## Sanity check profile
>  if [ -z "${clst_buildpkgs}" ]
> @@ -39,7 +39,7 @@ if [ -n "${clst_update_seed}" ]; then
>       fi
>  
>       # reset emerge options for the target
> -     clst_update_seed=no setup_myemergeopts
> +     clst_update_seed=no setup_emerge_opts
>  else
>       echo "Skipping seed stage update..."
>  fi
> diff --git a/targets/stage2/chroot.sh b/targets/stage2/chroot.sh
> index bf98d328..e472fe16 100755
> --- a/targets/stage2/chroot.sh
> +++ b/targets/stage2/chroot.sh
> @@ -3,7 +3,7 @@
>  source /tmp/chroot-functions.sh
>  
>  # Setup the environment
> -export FEATURES="${clst_myfeatures} nodoc noman noinfo -news"
> +export FEATURES="${features} nodoc noman noinfo -news"
>  export CONFIG_PROTECT="-* /etc/locale.gen"
>  
>  echo "$locales" > /etc/locale.gen
> diff --git a/targets/support/chroot-functions.sh
> b/targets/support/chroot-functions.sh index 993dc209..2eb90117 100755
> --- a/targets/support/chroot-functions.sh
> +++ b/targets/support/chroot-functions.sh
> @@ -76,19 +76,19 @@ get_libdir() {
>       echo ${var}
>  }
>  
> -setup_myfeatures(){
> -     setup_myemergeopts
> -     export clst_myfeatures="-news binpkg-multi-instance
> clean-logs parallel-install"
> -     export FEATURES="${clst_myfeatures}"
> +setup_features() {
> +     setup_emerge_opts
> +     export features="-news binpkg-multi-instance clean-logs
> parallel-install"
> +     export FEATURES="${features}"
>       if [ -n "${clst_CCACHE}" ]
>       then
> -             export clst_myfeatures="${clst_myfeatures} ccache"
> +             export features="${features} ccache"
>               clst_root_path=/ run_merge --oneshot --noreplace
> dev-util/ccache || exit 1 fi
>  
>       if [ -n "${clst_DISTCC}" ]
>       then
> -             export clst_myfeatures="${clst_myfeatures} distcc"
> +             export features="${features} distcc"
>               export DISTCC_HOSTS="${clst_distcc_hosts}"
>               [ -e ${clst_make_conf} ] && \
>                       echo 'USE="${USE} -avahi -gtk -gnome"' >>
> ${clst_make_conf} @@ -133,26 +133,26 @@ setup_myfeatures(){
>               export PATH="/usr/lib/icecc/bin:${PATH}"
>               export PREROOTPATH="/usr/lib/icecc/bin"
>       fi
> -     export FEATURES="${clst_myfeatures}"
> +     export FEATURES="${features}"
>  }
>  
> -setup_myemergeopts(){
> +setup_emerge_opts() {
>       if [[ "${clst_VERBOSE}" == "true" ]]
>       then
> -             clst_myemergeopts="--verbose"
> +             emerge_opts="--verbose"
>               bootstrap_opts="${bootstrap_opts} -v"
>       else
> -             clst_myemergeopts="--quiet"
> +             emerge_opts="--quiet"
>               bootstrap_opts="${bootstrap_opts} -q"
>       fi
>       if [ -n "${clst_FETCH}" ]
>       then
>               export bootstrap_opts="${bootstrap_opts} -f"
> -             export clst_myemergeopts="${clst_myemergeopts} -f"
> +             export emerge_opts="${emerge_opts} -f"
>       # if we have PKGCACHE, and either update_seed is empty or
> 'no', make and use binpkgs elif [ -n "${clst_PKGCACHE}" ] && [ -z
> "${clst_update_seed}" -o "${clst_update_seed}" = "no" ] then
> -             export clst_myemergeopts="${clst_myemergeopts}
> --usepkg --buildpkg --binpkg-respect-use=y --newuse"
> +             export emerge_opts="${emerge_opts} --usepkg
> --buildpkg --binpkg-respect-use=y --newuse" export
> bootstrap_opts="${bootstrap_opts} -r" fi
>  }
> @@ -274,13 +274,13 @@ run_merge() {
>  
>       if [[ "${clst_VERBOSE}" == "true" ]]
>       then
> -             echo "ROOT=${ROOT} emerge ${clst_myemergeopts} -pt
> $@" || exit 1
> -             emerge ${clst_myemergeopts} -pt $@ || exit 3
> +             echo "ROOT=${ROOT} emerge ${emerge_opts} -pt $@" ||
> exit 1
> +             emerge ${emerge_opts} -pt $@ || exit 3
>       fi
>  
> -     echo "emerge ${clst_myemergeopts} $@" || exit 1
> +     echo "emerge ${emerge_opts} $@" || exit 1
>  
> -     emerge ${clst_myemergeopts} $@ || exit 1
> +     emerge ${emerge_opts} $@ || exit 1
>  }
>  
>  show_debug() {
> @@ -323,7 +323,7 @@ run_default_funcs() {
>       if [ "${RUN_DEFAULT_FUNCS}" != "no" ]
>       then
>               update_env_settings
> -             setup_myfeatures
> +             setup_features
>               show_debug
>       fi
>  }
> diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
> index 7a00059a..8a15fc04 100755
> --- a/targets/support/kmerge.sh
> +++ b/targets/support/kmerge.sh
> @@ -212,7 +212,7 @@ then
>  
>       # install dependencies of kernel sources ahead of time in
> case # package.provided generated below causes them not to be
> (re)installed
> -     PKGDIR=${PKGDIR} clst_myemergeopts="--quiet --usepkg
> --buildpkg --binpkg-respect-use=y --update --newuse --onlydeps"
> run_merge "${clst_ksource}" || exit 1
> +     PKGDIR=${PKGDIR} emerge_opts="--quiet --usepkg --buildpkg
> --binpkg-respect-use=y --update --newuse --onlydeps" run_merge
> "${clst_ksource}" || exit 1 # Create the kerncache directory if it
> doesn't exists mkdir -p /tmp/kerncache/${clst_kname}
> @@ -236,7 +236,7 @@ then
>  
>       [ -L /usr/src/linux ] && rm -f /usr/src/linux
>  
> -     PKGDIR=${PKGDIR} clst_myemergeopts="--quiet --update
> --newuse" run_merge "${clst_ksource}" || exit 1
> +     PKGDIR=${PKGDIR} emerge_opts="--quiet --update --newuse"
> run_merge "${clst_ksource}" || exit 1 
>       SOURCESDIR="/tmp/kerncache/${clst_kname}/sources"
>       if [ -L /usr/src/linux ]


Reply via email to