This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Add revision number to gcc version?
- From: "H. J. Lu" <hjl at lucon dot org>
- To: David Daney <ddaney at avtrex dot com>
- Cc: Mike Stump <mrs at apple dot com>, gcc at gcc dot gnu dot org
- Date: Thu, 15 Dec 2005 15:24:39 -0800
- Subject: Re: Add revision number to gcc version?
- References: <20051114171441.GA12412@lucon.org> <787EE306-43A7-4D88-B458-E39420CED0D7@apple.com> <20051114220547.GA16652@lucon.org> <20051215221609.GA25537@lucon.org> <43A1F57A.50903@avtrex.com>
On Thu, Dec 15, 2005 at 03:00:10PM -0800, David Daney wrote:
> H. J. Lu wrote:
> >On Mon, Nov 14, 2005 at 02:05:47PM -0800, H. J. Lu wrote:
> >
> >>On Mon, Nov 14, 2005 at 12:52:49PM -0800, Mike Stump wrote:
> >>
> >>>On Nov 14, 2005, at 9:14 AM, H. J. Lu wrote:
> >>>
> >>>>Can we change it to something like
> >>>>
> >>>>gcc (GCC) 4.1.0 20051113 (revision 106863) (experimental)
> >>>
> >>>Doesn't work, unless you also have the branch name. Further, the
> >>>substitutions that svn can do, doesn't allow for the above, and they
> >>>don't want to `fix' svn to do it (see the FAQ). (I think I'd like it
> >>>too.)
> >>
> >
> >I am enclosing 2 patches:
> >
> >1. contrib/gcc_update creates gcc/REVISION with branch name and
> >revision number.
> >2. If gcc/REVISION exists, it will be used in gcc/version.c.
> >
> >With those 2 patches, I got
> >
> >[hjl@gnu-13 gcc]$ ./xgcc --version
> >xgcc (GCC) 4.1.0 (gcc-4_1-branch revision 108596) 20051215 (prerelease)
>
> I like this, but what if you also did an svn status to see if there were
> any modifications WRT the branch/revision and then add either 'clean' or
> 'modified' to the information.
>
> So you would get (gcc-4_1-branch revision 108596 modified) or
> (gcc-4_1-branch revision 108596 clean)
>
Like this?
H.J.
----
2005-12-15 H.J. Lu <hongjiu.lu@intel.com>
* gcc_update: Create gcc/REVISION with branch name and revision
number.
Index: contrib/gcc_update
===================================================================
--- contrib/gcc_update (revision 108596)
+++ contrib/gcc_update (working copy)
@@ -250,8 +250,25 @@
exit 1
fi
+rm -f info.$$ LAST_UPDATED gcc/REVISION
+
+svn info > info.$$
+revision=`grep Revision: info.$$ | awk '{ print $2 }'`
+branch=`grep URL: info.$$ | sed -e "s,.*/,,g"`
{
date
- echo "`TZ=UTC date` (revision `svnversion .`)"
+ echo "`TZ=UTC date` (revision $revision)"
} > LAST_UPDATED
+
+rm -f info.$$
+
+changed=`svn status | grep "^[ACDGMRX\!\~]" | grep -v " contrib/"`
+if [ -n "$changed" ]; then
+ changed="modified"
+else
+ changed="clean"
+fi
+
+echo "($branch revision $revision $changed)" > gcc/REVISION
+
touch_files_reexec