public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Add revision number to gcc version?
@ 2005-11-14 17:14 H. J. Lu
  2005-11-14 20:52 ` Mike Stump
  0 siblings, 1 reply; 26+ messages in thread
From: H. J. Lu @ 2005-11-14 17:14 UTC (permalink / raw)
  To: gcc

The current "gcc --version" prints out

gcc (GCC) 4.1.0 20051113 (experimental)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

Can we change it to something like

gcc (GCC) 4.1.0 20051113 (revision 106863) (experimental)

or

gcc (GCC) 4.1.0 revision 106863 (experimental)


H.J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-11-14 17:14 Add revision number to gcc version? H. J. Lu
@ 2005-11-14 20:52 ` Mike Stump
  2005-11-14 22:05   ` H. J. Lu
  0 siblings, 1 reply; 26+ messages in thread
From: Mike Stump @ 2005-11-14 20:52 UTC (permalink / raw)
  To: H. J. Lu; +Cc: gcc

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.)

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-11-14 20:52 ` Mike Stump
@ 2005-11-14 22:05   ` H. J. Lu
  2005-12-15 22:44     ` H. J. Lu
  0 siblings, 1 reply; 26+ messages in thread
From: H. J. Lu @ 2005-11-14 22:05 UTC (permalink / raw)
  To: Mike Stump; +Cc: gcc

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 was thinking to add a few lines like

rm -f info.$$

svn info > info.$$
revision=`grep Revision: info.$$ | awk '{ print $2 }'`
branch=`grep URL: info.$$ | sed -e "s,.*/,,g"`
{
  echo branch: $branch
  echo revision: $revision
}

rm -f info.$$

to contrib/gcc_update to put branch and revision into files so that
they can be used for gcc version.


H.J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-11-14 22:05   ` H. J. Lu
@ 2005-12-15 22:44     ` H. J. Lu
  2005-12-15 23:32       ` David Daney
  0 siblings, 1 reply; 26+ messages in thread
From: H. J. Lu @ 2005-12-15 22:44 UTC (permalink / raw)
  To: Mike Stump; +Cc: gcc

[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]

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)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

and

[hjl@gnu-13 gcc]$ ./xgcc --version
xgcc (GCC) 4.2.0 (trunk revision 108596) 20051215 (experimental)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.


H.J.

[-- Attachment #2: gcc-update-rev-1.patch --]
[-- Type: text/plain, Size: 690 bytes --]

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,18 @@
     exit 1
 fi
 
+rm -f info.$$
+
+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.$$
+
+echo "($branch revision $revision)" > gcc/REVISION
+
 touch_files_reexec

[-- Attachment #3: gcc-rev-1.patch --]
[-- Type: text/plain, Size: 2469 bytes --]

2005-12-15  H.J. Lu  <hongjiu.lu@intel.com>

	* Makefile.in (REVISION): New.
	(REVISION_c): New.
	(REVISION_s): New.
	(version.o): Also depend on $(REVISION). Add
	-DREVISION=$(REVISION_s).

	* version.c (version_string): Add REVISION.

--- gcc/Makefile.in.rev	2005-12-13 12:08:07.000000000 -0800
+++ gcc/Makefile.in	2005-12-15 13:45:05.000000000 -0800
@@ -708,11 +708,18 @@ TM_H      = $(GTM_H) insn-constants.h in
 BASEVER     := $(srcdir)/BASE-VER  # 4.x.y
 DEVPHASE    := $(srcdir)/DEV-PHASE # experimental, prerelease, ""
 DATESTAMP   := $(srcdir)/DATESTAMP # YYYYMMDD or empty
+REVISION    := $(srcdir)/REVISION  # (BRANCH revision XXXXXX)
 
 BASEVER_c   := $(shell cat $(BASEVER))
 DEVPHASE_c  := $(shell cat $(DEVPHASE))
 DATESTAMP_c := $(shell cat $(DATESTAMP))
 
+ifeq (,$(wildcard $(REVISION)))
+REVISION    :=
+else
+REVISION_c  := $(shell cat $(REVISION))
+endif
+
 version     := $(BASEVER_c)
 
 # For use in version.c - double quoted strings, with appropriate
@@ -724,6 +731,12 @@ BASEVER_s   := "\"$(BASEVER_c)\""
 DEVPHASE_s  := "\"$(if $(DEVPHASE_c), ($(DEVPHASE_c)))\""
 DATESTAMP_s := "\"$(if $(DEVPHASE_c), $(DATESTAMP_c))\""
 
+ifdef REVISION_c
+REVISION_s  := "\"$(if $(DEVPHASE_c), $(REVISION_c))\""
+else
+REVISION_s  :=
+endif
+
 # Shorthand variables for dependency lists.
 TARGET_H = $(TM_H) target.h insn-modes.h
 MACHMODE_H = machmode.h mode-classes.def insn-modes.h
@@ -1724,9 +1737,10 @@ options.o: options.c $(CONFIG_H) $(SYSTE
 
 dumpvers: dumpvers.c
 
-version.o: version.c version.h $(DATESTAMP) $(BASEVER) $(DEVPHASE)
+version.o: version.c version.h $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE)
 	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
 	-DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
+	-DREVISION=$(REVISION_s) \
 	-DDEVPHASE=$(DEVPHASE_s) -c $(srcdir)/version.c $(OUTPUT_OPTION)
 
 gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
--- gcc/version.c.rev	2005-11-04 14:14:18.000000000 -0800
+++ gcc/version.c	2005-12-15 13:28:03.000000000 -0800
@@ -20,6 +20,7 @@
 const char bug_report_url[] = "<URL:http://gcc.gnu.org/bugs.html>";
 
 /* The complete version string, assembled from several pieces.
-   BASEVER, DATESTAMP, and DEVPHASE are defined by the Makefile.  */
+   BASEVER, REVISION, DATESTAMP, and DEVPHASE are defined by the
+   Makefile.  */
 
-const char version_string[] = BASEVER DATESTAMP DEVPHASE VERSUFFIX;
+const char version_string[] = BASEVER REVISION DATESTAMP DEVPHASE VERSUFFIX;

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-15 23:32       ` David Daney
@ 2005-12-15 23:32         ` H. J. Lu
  2005-12-16  0:09           ` David Daney
  2005-12-16  0:22         ` Daniel Jacobowitz
  2005-12-16  8:31         ` Ben Elliston
  2 siblings, 1 reply; 26+ messages in thread
From: H. J. Lu @ 2005-12-15 23:32 UTC (permalink / raw)
  To: David Daney; +Cc: Mike Stump, gcc

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-15 22:44     ` H. J. Lu
@ 2005-12-15 23:32       ` David Daney
  2005-12-15 23:32         ` H. J. Lu
                           ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: David Daney @ 2005-12-15 23:32 UTC (permalink / raw)
  To: H. J. Lu; +Cc: Mike Stump, gcc

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)

David Daney.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-15 23:32         ` H. J. Lu
@ 2005-12-16  0:09           ` David Daney
  0 siblings, 0 replies; 26+ messages in thread
From: David Daney @ 2005-12-16  0:09 UTC (permalink / raw)
  To: H. J. Lu; +Cc: Mike Stump, gcc

H. J. Lu wrote:
> 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?
> 

It is plausible that it does what I had in mind.  I have not tested it 
though.

I say test it and post it to gcc-patches@

David Daney.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-15 23:32       ` David Daney
  2005-12-15 23:32         ` H. J. Lu
@ 2005-12-16  0:22         ` Daniel Jacobowitz
  2005-12-16  0:31           ` David Daney
  2005-12-16 16:10           ` H. J. Lu
  2005-12-16  8:31         ` Ben Elliston
  2 siblings, 2 replies; 26+ messages in thread
From: Daniel Jacobowitz @ 2005-12-16  0:22 UTC (permalink / raw)
  To: David Daney; +Cc: H. J. Lu, Mike Stump, gcc

On Thu, Dec 15, 2005 at 03:00:10PM -0800, David Daney wrote:
> 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)

I think we already had this discussion and decided that svn status took
too long in many cases.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-16  0:22         ` Daniel Jacobowitz
@ 2005-12-16  0:31           ` David Daney
  2005-12-16  2:23             ` H. J. Lu
  2005-12-16 16:10           ` H. J. Lu
  1 sibling, 1 reply; 26+ messages in thread
From: David Daney @ 2005-12-16  0:31 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: H. J. Lu, Mike Stump, gcc

Daniel Jacobowitz wrote:
> On Thu, Dec 15, 2005 at 03:00:10PM -0800, David Daney wrote:
> 
>>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)
> 
> 
> I think we already had this discussion and decided that svn status took
> too long in many cases.
> 

Maybe have a configure option to disable svn status and return 'unknown' 
if you disable the svn status part.

It is unfortunate that svn status is so slow, as I think this would be 
useful information to know.

FWIW:

[daney@dl2 gcc]$ time svn status -q
M      libjava/java/util/GregorianCalendar.java
M      libjava/java/util/Calendar.java

real    0m9.361s
user    0m2.023s
sys     0m1.198s
[daney@dl2 gcc]$ time find . -name dave -ls

real    0m0.857s
user    0m0.223s
sys     0m0.536s


If the buffer cache does not contain the needed blocks, it is 
significantly slower.

David Daney

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-16  0:31           ` David Daney
@ 2005-12-16  2:23             ` H. J. Lu
  2005-12-16  2:35               ` David Daney
  0 siblings, 1 reply; 26+ messages in thread
From: H. J. Lu @ 2005-12-16  2:23 UTC (permalink / raw)
  To: David Daney; +Cc: Daniel Jacobowitz, Mike Stump, gcc

On Thu, Dec 15, 2005 at 04:09:41PM -0800, David Daney wrote:
> Daniel Jacobowitz wrote:
> >On Thu, Dec 15, 2005 at 03:00:10PM -0800, David Daney wrote:
> >
> >>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)
> >
> >
> >I think we already had this discussion and decided that svn status took
> >too long in many cases.
> >
> 
> Maybe have a configure option to disable svn status and return 'unknown' 
> if you disable the svn status part.

Did you mean something like

./contrib/gcc_update --disable-svn-status

I can certainly do that.

> 
> It is unfortunate that svn status is so slow, as I think this would be 
> useful information to know.
> 

This is the test result of my first patch:

http://gcc.gnu.org/ml/gcc-testresults/2005-12/msg00865.html


H.J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-16  2:23             ` H. J. Lu
@ 2005-12-16  2:35               ` David Daney
  2005-12-16  3:44                 ` H. J. Lu
  0 siblings, 1 reply; 26+ messages in thread
From: David Daney @ 2005-12-16  2:35 UTC (permalink / raw)
  To: H. J. Lu; +Cc: Daniel Jacobowitz, Mike Stump, gcc

H. J. Lu wrote:
> On Thu, Dec 15, 2005 at 04:09:41PM -0800, David Daney wrote:
> 
>>Daniel Jacobowitz wrote:
>>
>>>On Thu, Dec 15, 2005 at 03:00:10PM -0800, David Daney wrote:
>>>
>>>
>>>>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)
>>>
>>>
>>>I think we already had this discussion and decided that svn status took
>>>too long in many cases.
>>>
>>
>>Maybe have a configure option to disable svn status and return 'unknown' 
>>if you disable the svn status part.
> 
> 
> Did you mean something like
> 
> ./contrib/gcc_update --disable-svn-status
> 
> I can certainly do that.
> 
> 

No I meant from the top level configure.  Something like this:

../gcc/configure --disable-svn-status-in-gcc-version-string 
--other-configure-parameters

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-16  2:35               ` David Daney
@ 2005-12-16  3:44                 ` H. J. Lu
  0 siblings, 0 replies; 26+ messages in thread
From: H. J. Lu @ 2005-12-16  3:44 UTC (permalink / raw)
  To: David Daney; +Cc: Daniel Jacobowitz, Mike Stump, gcc

On Thu, Dec 15, 2005 at 06:03:25PM -0800, David Daney wrote:
> H. J. Lu wrote:
> >On Thu, Dec 15, 2005 at 04:09:41PM -0800, David Daney wrote:
> >
> >>Daniel Jacobowitz wrote:
> >>
> >>>On Thu, Dec 15, 2005 at 03:00:10PM -0800, David Daney wrote:
> >>>
> >>>
> >>>>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)
> >>>
> >>>
> >>>I think we already had this discussion and decided that svn status took
> >>>too long in many cases.
> >>>
> >>
> >>Maybe have a configure option to disable svn status and return 'unknown' 
> >>if you disable the svn status part.
> >
> >
> >Did you mean something like
> >
> >./contrib/gcc_update --disable-svn-status
> >
> >I can certainly do that.
> >
> >
> 
> No I meant from the top level configure.  Something like this:
> 
> ../gcc/configure --disable-svn-status-in-gcc-version-string 
> --other-configure-parameters

"svn status" is invoked from ./contrib/gcc_update. It has nothing to
do with gcc/configure. My patches have 2 parts:

1. ./contrib/gcc_update puts svn information in gcc/REVISION.
2. ./gcc/Makefile.in uses gcc/REVISION if it exists since gcc/REVISION
may not exist if gcc source isn't updated with ./contrib/gcc_update.



H.J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-15 23:32       ` David Daney
  2005-12-15 23:32         ` H. J. Lu
  2005-12-16  0:22         ` Daniel Jacobowitz
@ 2005-12-16  8:31         ` Ben Elliston
  2005-12-16  8:36           ` H. J. Lu
  2 siblings, 1 reply; 26+ messages in thread
From: Ben Elliston @ 2005-12-16  8:31 UTC (permalink / raw)
  To: David Daney; +Cc: H. J. Lu, Mike Stump, gcc

> 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.

I think this is a good idea (and don't mind the idea of `svn status'
being run from gcc_update to do so), but I wonder if it's necessary to
continue to include the date in the version.c file?

I presume the main reason that the date was placed in version.c in the
first place was that we had no other way to place an overall
identifier on the tree revision with CVS.  However, SVN now gives us
one.  Including the date now just makes the version string unwieldly,
IMHO.

Ben

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-16  8:31         ` Ben Elliston
@ 2005-12-16  8:36           ` H. J. Lu
  2005-12-19 13:41             ` Richard Earnshaw
  0 siblings, 1 reply; 26+ messages in thread
From: H. J. Lu @ 2005-12-16  8:36 UTC (permalink / raw)
  To: Ben Elliston; +Cc: David Daney, Mike Stump, gcc

On Fri, Dec 16, 2005 at 03:58:05PM +1100, Ben Elliston wrote:
> > 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.
> 
> I think this is a good idea (and don't mind the idea of `svn status'
> being run from gcc_update to do so), but I wonder if it's necessary to
> continue to include the date in the version.c file?
> 
> I presume the main reason that the date was placed in version.c in the
> first place was that we had no other way to place an overall
> identifier on the tree revision with CVS.  However, SVN now gives us
> one.  Including the date now just makes the version string unwieldly,
> IMHO.

In my patch, gcc/REVISION is created by gcc_update. If you don't use
gcc_update, gcc/REVISION may not be there.

In any case, when we agree on what to put in gcc/REVISION, I can
provide a new patch.

H.J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-16  0:22         ` Daniel Jacobowitz
  2005-12-16  0:31           ` David Daney
@ 2005-12-16 16:10           ` H. J. Lu
  1 sibling, 0 replies; 26+ messages in thread
From: H. J. Lu @ 2005-12-16 16:10 UTC (permalink / raw)
  To: David Daney, Mike Stump, gcc

On Thu, Dec 15, 2005 at 06:35:29PM -0500, Daniel Jacobowitz wrote:
> On Thu, Dec 15, 2005 at 03:00:10PM -0800, David Daney wrote:
> > 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)
> 
> I think we already had this discussion and decided that svn status took
> too long in many cases.

I think running "svn status" in ./configure may slow down configure
a lot. Also, you may not always be able to run  "svn status" in
./configure since a gcc tree may not be checked out with svn. However,
running "svn status" in ./contrib/gcc_update may not be that
noticeable.



H.J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-16  8:36           ` H. J. Lu
@ 2005-12-19 13:41             ` Richard Earnshaw
  2005-12-19 15:28               ` H. J. Lu
  0 siblings, 1 reply; 26+ messages in thread
From: Richard Earnshaw @ 2005-12-19 13:41 UTC (permalink / raw)
  To: H. J. Lu; +Cc: Ben Elliston, David Daney, Mike Stump, gcc

On Fri, 2005-12-16 at 05:02, H. J. Lu wrote:

> 
> In my patch, gcc/REVISION is created by gcc_update. If you don't use
> gcc_update, gcc/REVISION may not be there.
> 
> In any case, when we agree on what to put in gcc/REVISION, I can
> provide a new patch.

Maybe we should just set up the commit filters so that a new version of
REVISION is committed with each check-in.  That way it will work with
every check-out method, and what's more we get the date/time of the
commit rather than the date/time of the checkout.

R.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-19 13:41             ` Richard Earnshaw
@ 2005-12-19 15:28               ` H. J. Lu
  2005-12-19 23:19                 ` Jim Blandy
  0 siblings, 1 reply; 26+ messages in thread
From: H. J. Lu @ 2005-12-19 15:28 UTC (permalink / raw)
  To: Richard Earnshaw; +Cc: Ben Elliston, David Daney, Mike Stump, gcc

On Mon, Dec 19, 2005 at 01:26:18PM +0000, Richard Earnshaw wrote:
> On Fri, 2005-12-16 at 05:02, H. J. Lu wrote:
> 
> > 
> > In my patch, gcc/REVISION is created by gcc_update. If you don't use
> > gcc_update, gcc/REVISION may not be there.
> > 
> > In any case, when we agree on what to put in gcc/REVISION, I can
> > provide a new patch.
> 
> Maybe we should just set up the commit filters so that a new version of
> REVISION is committed with each check-in.  That way it will work with
> every check-out method, and what's more we get the date/time of the
> commit rather than the date/time of the checkout.

What do you put in REVISION? Can you ask svn for revision number before
check-in? If not, do you need 2 check-ins to update REVISION for each
check-in?


H.J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-19 15:28               ` H. J. Lu
@ 2005-12-19 23:19                 ` Jim Blandy
  2005-12-20  1:34                   ` Mike Stump
  2005-12-20  7:02                   ` H. J. Lu
  0 siblings, 2 replies; 26+ messages in thread
From: Jim Blandy @ 2005-12-19 23:19 UTC (permalink / raw)
  To: H. J. Lu; +Cc: Richard Earnshaw, Ben Elliston, David Daney, Mike Stump, gcc

Subversion provides an "opt-in" version of keyword substitution, and
provides a $Revision$ keyword.  It might take a little scriptery to
get that into the form GCC wants.

http://svnbook.red-bean.com/nightly/en/svn.advanced.props.html#svn.advanced.props.special.keywords

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-19 23:19                 ` Jim Blandy
@ 2005-12-20  1:34                   ` Mike Stump
  2005-12-20  2:33                     ` Jim Blandy
  2005-12-20  7:02                   ` H. J. Lu
  1 sibling, 1 reply; 26+ messages in thread
From: Mike Stump @ 2005-12-20  1:34 UTC (permalink / raw)
  To: Jim Blandy; +Cc: H. J. Lu, Richard Earnshaw, Ben Elliston, David Daney, gcc

On Dec 19, 2005, at 2:56 PM, Jim Blandy wrote:
> Subversion provides an "opt-in" version of keyword substitution, and
> provides a $Revision$ keyword.

But it doesn't do what people really want it to by design.  :-(

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-20  1:34                   ` Mike Stump
@ 2005-12-20  2:33                     ` Jim Blandy
  2005-12-20  3:39                       ` Mike Stump
  0 siblings, 1 reply; 26+ messages in thread
From: Jim Blandy @ 2005-12-20  2:33 UTC (permalink / raw)
  To: Mike Stump; +Cc: H. J. Lu, Richard Earnshaw, Ben Elliston, David Daney, gcc

On 12/19/05, Mike Stump <mrs@apple.com> wrote:
> On Dec 19, 2005, at 2:56 PM, Jim Blandy wrote:
> > Subversion provides an "opt-in" version of keyword substitution, and
> > provides a $Revision$ keyword.
>
> But it doesn't do what people really want it to by design.  :-(

And that would be?

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-20  2:33                     ` Jim Blandy
@ 2005-12-20  3:39                       ` Mike Stump
  2005-12-20  7:05                         ` H. J. Lu
  2005-12-20 10:10                         ` Jim Blandy
  0 siblings, 2 replies; 26+ messages in thread
From: Mike Stump @ 2005-12-20  3:39 UTC (permalink / raw)
  To: Jim Blandy; +Cc: H. J. Lu, Richard Earnshaw, Ben Elliston, David Daney, gcc

On Dec 19, 2005, at 5:34 PM, Jim Blandy wrote:
> On 12/19/05, Mike Stump <mrs@apple.com> wrote:
>> But it doesn't do what people really want it to by design.  :-(
>
> And that would be?

http://subversion.tigris.org/faq.html#version-value-in-source

I would like something, that substitutes automatically, works on svn  
co and svn up and can be used to obtain the exact sources I was  
playing with, given say a hard coded url and branch name.  I can  
promise to only co or up the whole tree and to not have any  
modifications in the tree.  Ideally, I'd like this to be stable, so  
that the number doesn't increment if there are no actual changes in  
my tree, though, this last point isn't critical.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-19 23:19                 ` Jim Blandy
  2005-12-20  1:34                   ` Mike Stump
@ 2005-12-20  7:02                   ` H. J. Lu
  1 sibling, 0 replies; 26+ messages in thread
From: H. J. Lu @ 2005-12-20  7:02 UTC (permalink / raw)
  To: Jim Blandy; +Cc: Richard Earnshaw, Ben Elliston, David Daney, Mike Stump, gcc

On Mon, Dec 19, 2005 at 02:56:43PM -0800, Jim Blandy wrote:
> Subversion provides an "opt-in" version of keyword substitution, and
> provides a $Revision$ keyword.  It might take a little scriptery to
> get that into the form GCC wants.
> 
> http://svnbook.red-bean.com/nightly/en/svn.advanced.props.html#svn.advanced.props.special.keywords

Assuming we put

---
revision $Revision$
---

in gcc/REVISION. How will it be updated?


H.J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-20  3:39                       ` Mike Stump
@ 2005-12-20  7:05                         ` H. J. Lu
  2005-12-20 10:10                         ` Jim Blandy
  1 sibling, 0 replies; 26+ messages in thread
From: H. J. Lu @ 2005-12-20  7:05 UTC (permalink / raw)
  To: Mike Stump; +Cc: Jim Blandy, Richard Earnshaw, Ben Elliston, David Daney, gcc

On Mon, Dec 19, 2005 at 06:04:46PM -0800, Mike Stump wrote:
> On Dec 19, 2005, at 5:34 PM, Jim Blandy wrote:
> >On 12/19/05, Mike Stump <mrs@apple.com> wrote:
> >>But it doesn't do what people really want it to by design.  :-(
> >
> >And that would be?
> 
> http://subversion.tigris.org/faq.html#version-value-in-source
> 
> I would like something, that substitutes automatically, works on svn  
> co and svn up and can be used to obtain the exact sources I was  
> playing with, given say a hard coded url and branch name.  I can  
> promise to only co or up the whole tree and to not have any  
> modifications in the tree.  Ideally, I'd like this to be stable, so  
> that the number doesn't increment if there are no actual changes in  
> my tree, though, this last point isn't critical.

I don't see how the current svn supports updating a single file with
the current revision number for each checkin.


H.J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-20  3:39                       ` Mike Stump
  2005-12-20  7:05                         ` H. J. Lu
@ 2005-12-20 10:10                         ` Jim Blandy
  1 sibling, 0 replies; 26+ messages in thread
From: Jim Blandy @ 2005-12-20 10:10 UTC (permalink / raw)
  To: Mike Stump; +Cc: H. J. Lu, Richard Earnshaw, Ben Elliston, David Daney, gcc

Okay, I see.  Yes, there really ought to be an easy way to provide
enough information to reproduce the tree, and $Revision$ isn't it.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
  2005-12-16 12:34 Volker Reichelt
@ 2005-12-16 17:57 ` H. J. Lu
  0 siblings, 0 replies; 26+ messages in thread
From: H. J. Lu @ 2005-12-16 17:57 UTC (permalink / raw)
  To: Volker Reichelt; +Cc: gcc

[-- Attachment #1: Type: text/plain, Size: 1959 bytes --]

On Fri, Dec 16, 2005 at 12:07:54PM +0100, Volker Reichelt wrote:
> > 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)
> 
> [snip]
> 
> > xgcc (GCC) 4.2.0 (trunk revision 108596) 20051215 (experimental)
> 
> IMHO we should change the current naming system as little as possible
> for those who run scripts to extract the information from the compiler
> automatically. (Maybe I'm the only one, but I do.)
> 
> Therefore I'd like to suggest to add the new stuff at the end and
> with brackets instead of parentheses to make that information easily
> extractable as well.
> 
> xgcc (GCC) 4.1.0 20051215 (prerelease) [gcc-4_1-branch revision 108596]
> xgcc (GCC) 4.2.0 20051215 (experimental) [trunk revision 108596]
> 
> Somebody on this thread also suggested to skip the date and only use
> the revision number. I don't think that this is a good idea, because
> 
> 1.) there are scripts out there that rely on the date
>     (OK, maybe I'm the only one)
> 2.) if we ever change the revision control system again,
>     these numbers are probably obsolete
> 3.) the date carries a lot of information for humans (oh, this snapshot
>     is already two month old, I should get a new one) without having
>     to consult a database (for those who only download snapshots).
>     And this info is available offline, too.
> 

Here are the new patches. I got

[hjl@gnu gcc-4.1]$ ./build-i686-linux/gcc/stage1/xgcc --version
xgcc (GCC) 4.1.0 20051216 (prerelease) [gcc-4_1-branch revision 108649 clean]
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.



H.J.

[-- Attachment #2: gcc-update-rev-4.patch --]
[-- Type: text/plain, Size: 874 bytes --]

2005-12-16  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 108649)
+++ 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

[-- Attachment #3: gcc-rev-2.patch --]
[-- Type: text/plain, Size: 2469 bytes --]

2005-12-16  H.J. Lu  <hongjiu.lu@intel.com>

	* Makefile.in (REVISION): New.
	(REVISION_c): New.
	(REVISION_s): New.
	(version.o): Also depend on $(REVISION). Add
	-DREVISION=$(REVISION_s).

	* version.c (version_string): Add REVISION.

--- gcc/Makefile.in.rev	2005-12-04 07:17:09.000000000 -0800
+++ gcc/Makefile.in	2005-12-16 07:49:52.000000000 -0800
@@ -703,11 +703,18 @@ TM_H      = $(GTM_H) insn-constants.h in
 BASEVER     := $(srcdir)/BASE-VER  # 4.x.y
 DEVPHASE    := $(srcdir)/DEV-PHASE # experimental, prerelease, ""
 DATESTAMP   := $(srcdir)/DATESTAMP # YYYYMMDD or empty
+REVISION    := $(srcdir)/REVISION  # [BRANCH revision XXXXXX]
 
 BASEVER_c   := $(shell cat $(BASEVER))
 DEVPHASE_c  := $(shell cat $(DEVPHASE))
 DATESTAMP_c := $(shell cat $(DATESTAMP))
 
+ifeq (,$(wildcard $(REVISION)))
+REVISION    :=
+else
+REVISION_c  := $(shell cat $(REVISION))
+endif
+
 version     := $(BASEVER_c)
 
 # For use in version.c - double quoted strings, with appropriate
@@ -719,6 +726,12 @@ BASEVER_s   := "\"$(BASEVER_c)\""
 DEVPHASE_s  := "\"$(if $(DEVPHASE_c), ($(DEVPHASE_c)))\""
 DATESTAMP_s := "\"$(if $(DEVPHASE_c), $(DATESTAMP_c))\""
 
+ifdef REVISION_c
+REVISION_s  := "\"$(if $(DEVPHASE_c), $(REVISION_c))\""
+else
+REVISION_s  :=
+endif
+
 # Shorthand variables for dependency lists.
 TARGET_H = $(TM_H) target.h insn-modes.h
 MACHMODE_H = machmode.h mode-classes.def insn-modes.h
@@ -1681,9 +1694,10 @@ options.o: options.c $(CONFIG_H) $(SYSTE
 
 dumpvers: dumpvers.c
 
-version.o: version.c version.h $(DATESTAMP) $(BASEVER) $(DEVPHASE)
+version.o: version.c version.h $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE)
 	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
 	-DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
+	-DREVISION=$(REVISION_s) \
 	-DDEVPHASE=$(DEVPHASE_s) -c $(srcdir)/version.c $(OUTPUT_OPTION)
 
 gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
--- gcc/version.c.rev	2005-11-04 14:14:18.000000000 -0800
+++ gcc/version.c	2005-12-16 07:51:30.000000000 -0800
@@ -20,6 +20,7 @@
 const char bug_report_url[] = "<URL:http://gcc.gnu.org/bugs.html>";
 
 /* The complete version string, assembled from several pieces.
-   BASEVER, DATESTAMP, and DEVPHASE are defined by the Makefile.  */
+   BASEVER, REVISION, DATESTAMP, and DEVPHASE are defined by the
+   Makefile.  */
 
-const char version_string[] = BASEVER DATESTAMP DEVPHASE VERSUFFIX;
+const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION VERSUFFIX;

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: Add revision number to gcc version?
@ 2005-12-16 12:34 Volker Reichelt
  2005-12-16 17:57 ` H. J. Lu
  0 siblings, 1 reply; 26+ messages in thread
From: Volker Reichelt @ 2005-12-16 12:34 UTC (permalink / raw)
  To: hjl, gcc

> 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)

[snip]

> xgcc (GCC) 4.2.0 (trunk revision 108596) 20051215 (experimental)

IMHO we should change the current naming system as little as possible
for those who run scripts to extract the information from the compiler
automatically. (Maybe I'm the only one, but I do.)

Therefore I'd like to suggest to add the new stuff at the end and
with brackets instead of parentheses to make that information easily
extractable as well.

xgcc (GCC) 4.1.0 20051215 (prerelease) [gcc-4_1-branch revision 108596]
xgcc (GCC) 4.2.0 20051215 (experimental) [trunk revision 108596]

Somebody on this thread also suggested to skip the date and only use
the revision number. I don't think that this is a good idea, because

1.) there are scripts out there that rely on the date
    (OK, maybe I'm the only one)
2.) if we ever change the revision control system again,
    these numbers are probably obsolete
3.) the date carries a lot of information for humans (oh, this snapshot
    is already two month old, I should get a new one) without having
    to consult a database (for those who only download snapshots).
    And this info is available offline, too.

Regards,
Volker


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2005-12-20  9:40 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-14 17:14 Add revision number to gcc version? H. J. Lu
2005-11-14 20:52 ` Mike Stump
2005-11-14 22:05   ` H. J. Lu
2005-12-15 22:44     ` H. J. Lu
2005-12-15 23:32       ` David Daney
2005-12-15 23:32         ` H. J. Lu
2005-12-16  0:09           ` David Daney
2005-12-16  0:22         ` Daniel Jacobowitz
2005-12-16  0:31           ` David Daney
2005-12-16  2:23             ` H. J. Lu
2005-12-16  2:35               ` David Daney
2005-12-16  3:44                 ` H. J. Lu
2005-12-16 16:10           ` H. J. Lu
2005-12-16  8:31         ` Ben Elliston
2005-12-16  8:36           ` H. J. Lu
2005-12-19 13:41             ` Richard Earnshaw
2005-12-19 15:28               ` H. J. Lu
2005-12-19 23:19                 ` Jim Blandy
2005-12-20  1:34                   ` Mike Stump
2005-12-20  2:33                     ` Jim Blandy
2005-12-20  3:39                       ` Mike Stump
2005-12-20  7:05                         ` H. J. Lu
2005-12-20 10:10                         ` Jim Blandy
2005-12-20  7:02                   ` H. J. Lu
2005-12-16 12:34 Volker Reichelt
2005-12-16 17:57 ` H. J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).