Re: [gentoo-dev] toolchain.eclass more friendly about ada/gnat

2019-11-23 Thread Sergei Trofimovich
On Sat, 23 Nov 2019 09:16:42 +0100
Alfredo Tupone  wrote:

> I would like to have comments about the followinf changes.
> I "fear" the shopts nullglob a little
> 
> diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
> index a3081c38bac1..aca10b4f37ed 100644
> --- a/eclass/toolchain.eclass
> +++ b/eclass/toolchain.eclass
> @@ -1817,33 +1817,37 @@ toolchain_src_install() {
>   fi
>  
>   dodir /etc/env.d/gcc
>   create_gcc_env_entry
>   create_revdep_rebuild_entry
>  
>   # Setup the gcc_env_entry for hardened gcc 4 with minispecs
>   want_minispecs && copy_minispecs_gcc_specs
>  
>   # Make sure we dont have stuff lying around that
>   # can nuke multiple versions of gcc
>   gcc_slot_java
>  
>   dodir /usr/bin
>   cd "${D}"${BINPATH}
> +
> + shopt nullglob
> + local gnat_extra_bins="gnat*"
> +
>   # Ugh: we really need to auto-detect this list.
>   #  It's constantly out of date.
> - for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
> + for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo 
> ${gnat_extra_bins} ; do

You can also drop 'shopt nullglob'/'local gnat_extra_bins="gnat*"' and use 
'gnat*' directly:
for x in ... gnat* ; do
All the code below if guarded by [[ -f ${x} ]] anyway.

>   # For some reason, g77 gets made instead of ${CTARGET}-g77...
>   # this should take care of that
>   if [[ -f ${x} ]] ; then
>   # In case they're hardlinks, clear out the target first
>   # otherwise the mv below will complain.
>   rm -f ${CTARGET}-${x}
>   mv ${x} ${CTARGET}-${x}
>   fi
>  
>   if [[ -f ${CTARGET}-${x} ]] ; then
>   if ! is_crosscompile ; then
>   ln -sf ${CTARGET}-${x} ${x}
>   dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
>   /usr/bin/${x}-${GCC_CONFIG_VER}
>   fi
> 

-- 

  Sergei



[gentoo-dev] toolchain.eclass more friendly about ada/gnat

2019-11-23 Thread Alfredo Tupone
I would like to have comments about the followinf changes.
I "fear" the shopts nullglob a little

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index a3081c38bac1..aca10b4f37ed 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1817,33 +1817,37 @@ toolchain_src_install() {
fi
 
dodir /etc/env.d/gcc
create_gcc_env_entry
create_revdep_rebuild_entry
 
# Setup the gcc_env_entry for hardened gcc 4 with minispecs
want_minispecs && copy_minispecs_gcc_specs
 
# Make sure we dont have stuff lying around that
# can nuke multiple versions of gcc
gcc_slot_java
 
dodir /usr/bin
cd "${D}"${BINPATH}
+
+   shopt nullglob
+   local gnat_extra_bins="gnat*"
+
# Ugh: we really need to auto-detect this list.
#  It's constantly out of date.
-   for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
+   for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo 
${gnat_extra_bins} ; do
# For some reason, g77 gets made instead of ${CTARGET}-g77...
# this should take care of that
if [[ -f ${x} ]] ; then
# In case they're hardlinks, clear out the target first
# otherwise the mv below will complain.
rm -f ${CTARGET}-${x}
mv ${x} ${CTARGET}-${x}
fi
 
if [[ -f ${CTARGET}-${x} ]] ; then
if ! is_crosscompile ; then
ln -sf ${CTARGET}-${x} ${x}
dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
/usr/bin/${x}-${GCC_CONFIG_VER}
fi