From 9c48d9de74a6e56625105433d46c386151c851e3 Mon Sep 17 00:00:00 2001
From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Sun, 19 Jul 2009 13:31:37 +0000
Subject: [PATCH] Makefile.am: Use 'svnversion' instead of 'svn info' to get
 the revision number.

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2850 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 smartmontools/CHANGELOG    | 4 ++++
 smartmontools/Makefile.am  | 9 +++++----
 smartmontools/configure.in | 2 +-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/smartmontools/CHANGELOG b/smartmontools/CHANGELOG
index 426341b01..4a351c249 100644
--- a/smartmontools/CHANGELOG
+++ b/smartmontools/CHANGELOG
@@ -42,6 +42,10 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [CF] Makefile.am: Use 'svnversion' instead of 'svn info' to get
+       the revision number. This also checks for mixed and modified
+       working copies.
+
   [CF] Remove CVS Id strings from '-V, --version' output.
 
   [CF] Update CONTRIBUTORS section on man pages.
diff --git a/smartmontools/Makefile.am b/smartmontools/Makefile.am
index 7d5221cd6..0367a5a08 100644
--- a/smartmontools/Makefile.am
+++ b/smartmontools/Makefile.am
@@ -281,16 +281,17 @@ if IS_SVN_BUILD
 # Get version info from SVN
 svnversion.h: CHANGELOG Makefile $(srcdir)/.svn/entries
 	echo '/* svnversion.h.  Generated by Makefile from svn info.  */' > $@
-	chg="`(cd $(srcdir) && svn status -q 2>/dev/null | sed 's,^.*$$,+,;q')`" && \
-	(cd $(srcdir) && TZ= svn info 2>/dev/null ) \
-	| sed -n 'h;s,^.* Rev: *\([^ ]*\)$$,REV  "\1'"$$chg"'",p;s,^.* Date: *\([^ ]*\) .*$$,DATE "\1",p;g;s,^.* Date: *[^ ]* *\([^ ]*\) .*$$,TIME "\1",p' \
+	(cd $(srcdir) \
+	 && svnversion 2>/dev/null | sed -n 's,^\([0-9].*\),REV  "\1",p' \
+	 && TZ= svn info 2>/dev/null \
+	 | sed -n 'h;s,^.* Date: *\([^ ]*\) .*$$,DATE "\1",p;g;s,^.* Date: *[^ ]* *\([^ ]*\) .*$$,TIME "\1",p') \
 	| sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
 else
 
 # SVN not available, guess version info from Id strings
 svnversion.h: CHANGELOG Makefile
 	echo '/* svnversion.h.  Generated by Makefile from Id strings.  */' > $@
-	(cd $(srcdir) && cat Makefile.am configure.in smart*.in *.cpp *.h *.s) \
+	(cd $(srcdir) && cat CHANGELOG Makefile.am configure.in smart*.in *.cpp *.h *.s) \
 	| sed -n 's,^.*\$$[I][d]: [^ ]* \([0-9][0-9]* [0-9][-0-9]* [0-9][:0-9]*\)[^:0-9][^$$]*\$$.*$$,\1,p' \
 	| sort -n -r \
 	| sed -n 'h;s,^\([^ ]*\) .*$$,REV  "\1~",p;g;s,^[^ ]* \([^ ]*\) .*$$,DATE "\1",p;g;s,^[^ ]* [^ ]* \([^ ]*\)$$,TIME "\1",p;q' \
diff --git a/smartmontools/configure.in b/smartmontools/configure.in
index 51cc1a61c..1c4377325 100644
--- a/smartmontools/configure.in
+++ b/smartmontools/configure.in
@@ -48,7 +48,7 @@ AC_MSG_CHECKING([whether this is a build from SVN])
 is_svn_build=no
 if test -f "$srcdir/.svn/entries"; then
   is_svn_build=unknown
-  if (cd "$srcdir" && svn --version && svn info && svn status -q) >/dev/null 2>&1; then
+  if (cd "$srcdir" && svn --version && svnversion && svn info) >/dev/null 2>&1; then
     is_svn_build=yes
   fi
 fi
-- 
GitLab