Extract the version number from NEWS if git-describe is not available.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Wed, 8 Aug 2007 23:41:06 +0000 (16:41 -0700)
committerMichael Vrable <mvrable@turin.ucsd.edu>
Wed, 8 Aug 2007 23:41:06 +0000 (16:41 -0700)
This should allow building from tarballs (not the git version), and still
correctly fill in the version number (so it can be incorporated into
generated files).

If git-describe does not return a value, the first word from the NEWS file
is taken as the version number.

Makefile
NEWS

index 0363f14..854be80 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,8 +10,8 @@ OBJS=$(SRCS:.cc=.o)
 lbs : $(OBJS)
        $(CXX) $(LDFLAGS) -o $@ $^
 
 lbs : $(OBJS)
        $(CXX) $(LDFLAGS) -o $@ $^
 
-version :
-       (git-describe || echo "Unknown") >version
+version : NEWS
+       (git-describe || (head -n1 NEWS | cut -d" " -f1)) >version
 $(OBJS) : version
 
 clean :
 $(OBJS) : version
 
 clean :
diff --git a/NEWS b/NEWS
index e7defe8..f1e2af9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,7 +11,7 @@ UNRELEASED
     - Bugfix: Print a help message instead of crashing if no files are
       specified.
 
     - Bugfix: Print a help message instead of crashing if no files are
       specified.
 
-version 0.2.2 [2007-07-27]
+0.2.2 [2007-07-27]
     - Update reference restore.pl script to handle octal/hexadecimal
       (format change introduced in 0.2).
     - Better support for mixing multiple backup schemes: the statcache
     - Update reference restore.pl script to handle octal/hexadecimal
       (format change introduced in 0.2).
     - Better support for mixing multiple backup schemes: the statcache
@@ -19,11 +19,11 @@ version 0.2.2 [2007-07-27]
       where multiple different backups (of different source directories)
       are made, all sharing the same local database directory.
 
       where multiple different backups (of different source directories)
       are made, all sharing the same local database directory.
 
-version 0.2.1 [2007-07-20]
+0.2.1 [2007-07-20]
     - Bugfix: Do not print an error when only one directory is specified
       to back up.
 
     - Bugfix: Do not print an error when only one directory is specified
       to back up.
 
-version 0.2 [2007-07-20]
+0.2 [2007-07-20]
     - SNAPSHOT FORMAT CHANGE: Metadata logs in backups can now contain
       octal and hexadecimal values.  Old restore programs may not be
       able to read these new backups.  The reference restore.pl script
     - SNAPSHOT FORMAT CHANGE: Metadata logs in backups can now contain
       octal and hexadecimal values.  Old restore programs may not be
       able to read these new backups.  The reference restore.pl script
@@ -37,5 +37,5 @@ version 0.2 [2007-07-20]
     - Device major/minor numbers are dumped for block and character
       devices.
 
     - Device major/minor numbers are dumped for block and character
       devices.
 
-version 0.1 [2007-07-14]
+0.1 [2007-07-14]
     - Initial release.
     - Initial release.