On Fri, Jul 16, 2021 at 09:06:01AM +0200, Richard Biener via Gcc-patches wrote:
> On Thu, Jul 15, 2021 at 9:12 PM Serge Belyshev
> <belys...@depni.sinp.msu.ru> wrote:
> >
> > This is to make development version string more readable, and
> > to simplify navigation through gcc-testresults.
> >
> > Currently gcc_update uses git log --pretty=tformat:%p:%t:%H to
> > generate version string, which is somewhat excessive since conversion
> > to git because commit hashes are now stable.
> >
> > Even better, gcc-git-customization.sh script provides gcc-descr alias
> > which makes prettier version string, and thus use it instead (or just
> > abbreviated commit hash when the alias is not available).
> >
> > Before: [master revision 
> > b25edf6e6fe:e035f180ebf:7094a69bd62a14dfa311eaa2fea468f221c7c9f3]
> > After: [master r12-2331]
> >
> > OK for mainline?
> 
> Can you instead open-code gcc-descr in this script?

Yeah, that will mean consistency no matter whether one has the
customizations installed or not.
And, you don't want the effect of $GCC_GIT gcc-descr but $GCC_GIT gcc-descr HEAD
(the default is $GCC_GIT gcc-descr master).
As you want to use gcc-descr without --full, I think
        revision=`$GCC_GIT log -n1 --pretty=tformat:%h`
        r=`$GCC_GIT describe --all --match 'basepoints/gcc-[0-9]*' HEAD \
           | sed -n 
's,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)-\([0-9]\+\)-g[0-9a-f]*$,r\2-\3,p;s,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)$,r\2-0,p'`;
        if test -n $r; then
                o=`$GCC_GIT config --get gcc-config.upstream`;
                rr=`echo $r | sed -n 
's,^r\([0-9]\+\)-[0-9]\+\(-g[0-9a-f]\+\)\?$,\1,p'`;
                if $GCC_GIT rev-parse --verify --quiet 
${o:-origin}/releases/gcc-$rr >/dev/null; then
                        m=releases/gcc-$rr;
                else
                        m=master;
                fi;
                if $GCC_GIT merge-base --is-ancestor HEAD ${o:-origin}/$m; then
                        revision=$r;
                fi
        fi
will do it.  Perhaps rename the r, o, rr and m temporaries.

        Jakub

Reply via email to