Subject: Re: [PATCH] ci: detect installed gcc in Travis CI

From: SZEDER Gábor <[email-masked]>
Date: Thu, 28 Nov 2019 13:33:16 +0100

On Thu, Nov 28, 2019 at 07:03:30PM +0700, Danh Doan wrote:
> On 2019-11-27 17:48:20+0100, SZEDER Gábor <[email-masked]> wrote:
> > On Wed, Nov 27, 2019 at 11:15:55PM +0700, Doan Tran Cong Danh wrote:
> > > Travis CI has continously updated their images, including updating gcc
> > > installation.
> > > 
> > > Save us some headache by checking which version of gcc is installed in
> > > the image, and use said version to run the build.
> > > 
> > > While gcc-10 hasn't been released, yet, add it to the list to save us
> > > some headache in the future.
> > > 
> > > Signed-off-by: Doan Tran Cong Danh <[email-masked]>
> > > ---
> > >  ci/lib.sh | 24 ++++++++++++++----------
> > >  1 file changed, 14 insertions(+), 10 deletions(-)
> > > 
> > > diff --git a/ci/lib.sh b/ci/lib.sh
> > > index c8c2c38155..4040fc1a22 100755
> > > --- a/ci/lib.sh
> > > +++ b/ci/lib.sh
> > > @@ -159,12 +159,21 @@ export DEFAULT_TEST_TARGET=prove
> > >  export GIT_TEST_CLONE_2GB=YesPlease
> > >  
> > >  case "$jobname" in
> > > -linux-clang|linux-gcc)
> > > -	if [ "$jobname" = linux-gcc ]
> > > -	then
> > > -		export CC=gcc-8
> > > -	fi
> > > +*-gcc)
> > > +	for gitcc in gcc-10 gcc-9 gcc-8
> > > +	do
> > > +		if command -v $gitcc >/dev/null 2>&1
> > > +		then
> > > +			export CC=$gitcc
> > > +			break;
> > > +		fi
> > > +	done
> > 
> > This assummes that some of these gcc-<N> binaries can be found in
> > PATH, but that hasn't always been the case in the past: up until end
> > of last week Travis CI's xcode10.1 image came with GCC 8 pre-installed
> > but not linked and without GCC 9, i.e. neither 'gcc-8' nor 'gcc-9' was
> > available in PATH.  While now that image does have GCC 9 properly
> > installed, i.e. 'gcc-9' has been available in PATH for almost a week,
> > I wouldn't want to rely on that...
> 
> I thought gcc-<N> executable should be linked by `brew-install'
> itself, no?

'brew install' does not link already installed but not linked
packages, but instructs the user to run 'brew link' instead; see

  https://public-inbox.org/git/[email-masked]/