Ralf Wildenhues wrote:
> * Peter O'Gorman wrote on Tue, Apr 15, 2008 at 07:40:54AM CEST:
> 
>> Could do a count of ChangeLog* files, and use that as the first digit, I
>> suppose. Not tonight though, need some sleep :)
> 
> Sounds like a possible plan.

I looked again, and at first counted all the lines in all the
changelogs, but then it seemed better to count only what looked like dates.

Ok?

Peter
-- 
Peter O'Gorman
http://pogma.com
>From 1faad4199ac85a135f8455a10497aa1825f8c736 Mon Sep 17 00:00:00 2001
From: Peter O'Gorman <[EMAIL PROTECTED]>
Date: Tue, 15 Apr 2008 09:35:38 -0500
Subject: [PATCH] Allow bootstrap from git repository.

	* Makefile.am: Pass srcdir as an argument to mkstamp and expect
	only 2 fields in mkstamps output.
	* clcommit.m4sh: Ditto.
	* configure.ac: Ditto.
	* libltdl/config/mkstamp: return a revision and date based on
	the number of lines which look like dates in all the ChangeLog*
	files in the directory we got as arg 1.
---
 ChangeLog              |   11 +++++++++++
 Makefile.am            |    4 ++--
 clcommit.m4sh          |    2 +-
 configure.ac           |    2 +-
 libltdl/config/mkstamp |   31 +++++++++++++++++++++----------
 5 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b4fac02..97dc1d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-04-14  Peter O'Gorman  <[EMAIL PROTECTED]>
+
+	Allow bootstrap from git repository.
+	* Makefile.am: Pass srcdir as an argument to mkstamp and expect
+	only 2 fields in mkstamps output.
+	* clcommit.m4sh: Ditto.
+	* configure.ac: Ditto.
+	* libltdl/config/mkstamp: return a revision and date based on
+	the number of lines which look like dates in all the ChangeLog*
+	files in the directory we got as arg 1.
+
 2008-04-11  Eric Blake  <[EMAIL PROTECTED]>
 
 	Fix usage of setmode without declaration on cygwin.
diff --git a/Makefile.am b/Makefile.am
index 0168a41..480b647 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -50,9 +50,9 @@ lt__cd		= CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 
 MKSTAMP = $(SHELL) $(srcdir)/$(auxdir)/mkstamp
 
-timestamp = set dummy `$(MKSTAMP) < $(srcdir)/ChangeLog`; shift; \
+timestamp = set dummy `$(MKSTAMP) $(srcdir)`; shift; \
 	case $(VERSION) in \
-	  *[acegikmoqsuwy]) TIMESTAMP=" $$1 $$2 $$3" ;; \
+	  *[acegikmoqsuwy]) TIMESTAMP=" $$1 $$2" ;; \
 	  *) TIMESTAMP="" ;; \
 	esac
 
diff --git a/clcommit.m4sh b/clcommit.m4sh
index 3439dae..7fe9d2d 100644
--- a/clcommit.m4sh
+++ b/clcommit.m4sh
@@ -444,7 +444,7 @@ func_mailnotify ()
       test -f CVS/Root &&
           echo "CVSROOT:	`$SED -e 's,.*:,,g' CVS/Root`"
       test -f $MKSTAMP &&
-          echo "TIMESTAMP:	`$SHELL $MKSTAMP < ./ChangeLog`"
+          echo "TIMESTAMP:	`$SHELL $MKSTAMP .`"
       test -f CVS/Repository &&
           echo "Module name:	`cat CVS/Repository`"
       test -f CVS/Tag &&
diff --git a/configure.ac b/configure.ac
index 6f49016..4660a67 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,7 +103,7 @@ AC_SUBST([LASTRELEASE])
 # This is a sanity check so we can see which version is used in bug reports.
 # It is assumed that we only want to see the date extension for cvs libtool
 # versions (i.e. "odd" letters) and not actual alpha releases.
-TIMESTAMP=`${CONFIG_SHELL} ${ac_aux_dir}/mkstamp < ${srcdir}/ChangeLog`
+TIMESTAMP=`${CONFIG_SHELL} ${ac_aux_dir}/mkstamp ${srcdir}`
 package_revision=`( set $TIMESTAMP; echo $1; )`
 case $lt_alpha in
   [[bdfhjlnprtvxz]])
diff --git a/libltdl/config/mkstamp b/libltdl/config/mkstamp
index 8d8e7d8..d11599a 100755
--- a/libltdl/config/mkstamp
+++ b/libltdl/config/mkstamp
@@ -23,15 +23,26 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 ####
 
-# This script expects to find a line containing both Revision and Date
-# tags, and it edits this line so that it looks like ` $rev $date'
+# This script takes a directory as an argument and generates a
+# revision and date based upon the ChangeLog files in that directory.
 
-# Command-line arguments are passed down to sed; additional -e cmd
-# arguments are acceptable.  Input is from from stdin.  The original
-# version of this script accepted input from a named file or stdin.
+# Generate a revision that looks similar to CVS revision by using 1.
+# then the number of lines in the ChangeLogs starting with dates (an
+# approximation of the number of commits) + 1000. 
+# For those pulling from the savannah git repository it should be
+# possible to go from this revision number to the git revision fairly
+# easily. The number will also always increase.
 
-tr -d "\015" | sed -e '
-	s%.*\$''Revision: \([^$]*\) \$.*\$''Date: \([^$]*\) \$.*% \1 \2%
-	t end
-	d
-	: end' ${1+"$@"}
+awk 'BEGIN {
+	cocount=0;
+}
+/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]  / {
+        if (cocount== 0) {
+                datestr=$1
+        }
+	cocount++;
+}
+END {
+	cocount = cocount + 1000;
+        print "1." cocount " " datestr;
+}' $1/ChangeLog $1/ChangeLog.*
-- 
1.5.3.7

Reply via email to