On Fri, Jul 16, 2021 at 11:22:27AM +0200, Richard Biener wrote:
> > 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.
> 
> Note the new form will be more difficult to use for people not having
> the customizations
> installed.  It also will likely break when gcc-update is not invoked
> on official branches?

It will not break, on the non-official branches it will just print the
hash alone.  That is the --is-ancestor check in there...
People without the customizations can easily look it up using gcc.gnu.org,
https://gcc.gnu.org/r12-1234
works.

The advantage of the r12-1234 form is that it is short, unique and easily
comparable (what is older vs. newer) and clearly says what is official
release branch.

Alternative would be to use git gcc-descr --full form with the hash part
reduced say to 11 or 12 chars, i.e.
r12-1234-g9147affc04e1
then it works even without the customizations (can be fed directly to git)
and still has the unique and easily comparable properties, but isn't that
good on the short side anymore.  In the above script just using
                        revision=${r}-g${revision};
instead of
                        revision=$r;
would do it.  Perhaps also replace both HEAD occurences with $revision

        Jakub

Reply via email to