Browse Source

r12425@catbus: nickm | 2007-04-17 17:16:38 -0400
Detect the svn version correctly when building from an svk checkout too. Whee, fun with bash and make.


svn:r9985

Nick Mathewson 18 years ago
parent
commit
a973611834
2 changed files with 24 additions and 2 deletions
  1. 2 2
      ChangeLog
  2. 22 0
      src/or/Makefile.am

+ 2 - 2
ChangeLog

@@ -23,8 +23,8 @@ Changes in version 0.2.0.1-alpha - 2007-??-??
     - When warning about missing headers, tell the user to let us
     - When warning about missing headers, tell the user to let us
       know if the compile succeeds anyway, so we can downgrade the
       know if the compile succeeds anyway, so we can downgrade the
       warning.
       warning.
-    - If we're building from a subversion repository, include the current
-      SVN revision as part of the version string.
+    - If we're building from a subversion checkout or an SVK mirror, include
+      the current SVN revision as part of the version string.
 
 
   o Minor features (logging):
   o Minor features (logging):
     - Always prepend "Bug: " to any log message about a bug.
     - Always prepend "Bug: " to any log message about a bug.

+ 22 - 0
src/or/Makefile.am

@@ -37,6 +37,28 @@ micro-revision.i: FORCE
 	  sed -n 's/^Revision: \([0-9][0-9]*\).*/"\1"/p' > micro-revision.i \
 	  sed -n 's/^Revision: \([0-9][0-9]*\).*/"\1"/p' > micro-revision.i \
 	     || true; \
 	     || true; \
 	fi;							\
 	fi;							\
+	if test ! -f micro-revision.i -a x`which svk` != x; then\
+          location=../..;                                       \
+          rev=x;                                                \
+          while test x$$rev = xx; do                             \
+            x=`svk info $$location |                             \
+              sed -n 's/^Mirrored From:.*, Rev\. \([0-9][0-9]*\)/\1/p'`; \
+            if test x$$x != x; then                              \
+              rev=$$x;                                           \
+              break;                                            \
+            else                                                \
+              loc=`svk info $$location |                         \
+                sed -n 's/^Copied From: \(.*\), Rev\. [0-9][0-9]*/\1/p'`; \
+              if test x$$loc == x; then                          \
+                rev="";                                         \
+                break;                                          \
+              else                                              \
+                location=/$$loc;                                 \
+              fi;                                               \
+            fi;                                                 \
+          done;                                                 \
+          echo \"$$rev\" > micro-revision.i;                   \
+        fi;                                                     \
 	if test ! -f micro-revision.i; then			\
 	if test ! -f micro-revision.i; then			\
 	  echo '""' > micro-revision.i;				\
 	  echo '""' > micro-revision.i;				\
 	fi
 	fi