[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/release-0.2.1] Backport: Generate version tags using Git, not (broken) svn revisions.



commit 02d93caa09656b1ef73838608258afad5c090105
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Jan 25 14:01:04 2011 -0500

    Backport: Generate version tags using Git, not (broken) svn revisions.
    
    Partial backport of daa0326aaaa85a760be94ee2360cfa61a9fb5be2 .
    Resolves bug 2402.  Bugfix on 0.2.1.15 (for the part where we switched to
    git) and on 0.2.1.30 (for the part where we dumped micro-revisions.)
---
 changes/bug2402_redux |    6 +++++
 src/or/Makefile.am    |   60 ++++++++++--------------------------------------
 src/or/config.c       |    4 +-
 src/or/router.c       |    2 -
 4 files changed, 21 insertions(+), 51 deletions(-)

diff --git a/changes/bug2402_redux b/changes/bug2402_redux
new file mode 100644
index 0000000..84be04a
--- /dev/null
+++ b/changes/bug2402_redux
@@ -0,0 +1,6 @@
+  o Minor bugfixes
+    - Use micro-revision numbers in 0.2.1.x instead: apparently, they
+      were more used than we had known.  (Bugfix on 0.2.1.30).
+    - Instead of generating our micro-version numbers using SVN revisions,
+      use git revisions instead.  Bugfix on 0.2.1.15-rc; fixes bug 2402.
+
diff --git a/src/or/Makefile.am b/src/or/Makefile.am
index ad2476f..51c1b0f 100644
--- a/src/or/Makefile.am
+++ b/src/or/Makefile.am
@@ -55,53 +55,19 @@ noinst_HEADERS = or.h eventdns.h eventdns_tor.h micro-revision.i
 tor_main.o: micro-revision.i
 
 micro-revision.i: FORCE
-	@svkdir=$$SVKROOT; 					\
-	if test "x$$svkdir" = x ; then 				\
-	  svkdir=$$HOME/.svk; 					\
-	fi; 							\
-	if test -d ../../.git && test -x "`which git 2>&1;true`" ; then \
-	  if test -d ../../.git/svn && test -x "`which git-svn 2>&1;true`" ; then \
-	    git-svn info ../../README | 			\
-	    sed -n 's/^Revision: \([0-9][0-9]*\).*/"\1"/p'      \
-	                                   > micro-revision.tmp \
-	        || true; 					\
-	  fi; 							\
-	elif test -d ../../.svn && test -x "`which svn 2>&1;true`" ; then \
-	  svn info ../.. |					\
-	  sed -n 's/^Revision: \([0-9][0-9]*\).*/"\1"/p' > micro-revision.tmp \
-	     || true;						\
-	elif test -x "`which svk 2>&1;true`" && test -d $$svkdir/local; 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' | \
-	        head -1`;					\
-	      if test x$$loc = x; then				\
-		break;						\
-	      else						\
-		location=/$$loc;				\
-	      fi;						\
-	    fi;							\
-	  done;							\
-	  if test x$$rev != xx; then				\
-	    echo \"$$rev\" > micro-revision.tmp;		\
-	  fi;							\
-	fi;							\
-	if test ! -f micro-revision.tmp ; then			\
-	  if test ! -f micro-revision.i ; then			\
-	    echo '""' > micro-revision.i;			\
-	  fi;							\
-	elif test ! -f micro-revision.i ||			\
-	  test x"`cat micro-revision.tmp`" != x"`cat micro-revision.i`"; then \
-	  mv micro-revision.tmp micro-revision.i;		\
-	fi; true
+       @rm -f micro-revision.tmp;                                      \
+       if test -d ../../.git && test -x "`which git 2>&1;true`"; then  \
+         HASH="`git rev-parse --short=16 HEAD`";                       \
+         echo \"$$HASH\" > micro-revision.tmp;                         \
+        fi;                                                            \
+       if test ! -f micro-revision.tmp ; then                          \
+         if test ! -f micro-revision.i ; then                          \
+           echo '""' > micro-revision.i;                               \
+         fi;                                                           \
+       elif test ! -f micro-revision.i ||                              \
+          test x"`cat micro-revision.tmp`" != x"`cat micro-revision.i`"; then \
+         mv micro-revision.tmp micro-revision.i;                       \
+        fi; true
 
 #Dummy target to ensure that micro-revision.i _always_ gets built.
 FORCE:
diff --git a/src/or/config.c b/src/or/config.c
index 8397b23..9cd8149 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -829,9 +829,9 @@ get_version(void)
 {
   if (_version == NULL) {
     if (strlen(tor_svn_revision)) {
-      size_t len = strlen(VERSION)+strlen(tor_svn_revision)+8;
+      size_t len = strlen(VERSION)+strlen(tor_svn_revision)+16;
       _version = tor_malloc(len);
-      tor_snprintf(_version, len, "%s (r%s)", VERSION, tor_svn_revision);
+      tor_snprintf(_version, len, "%s (git-%s)", VERSION, tor_svn_revision);
     } else {
       _version = tor_strdup(VERSION);
     }
diff --git a/src/or/router.c b/src/or/router.c
index 75f592d..4ce4f85 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -1586,8 +1586,6 @@ router_guess_address_from_dir_headers(uint32_t *guess)
   return -1;
 }
 
-extern const char tor_svn_revision[]; /* from tor_main.c */
-
 /** Set <b>platform</b> (max length <b>len</b>) to a NUL-terminated short
  * string describing the version of Tor and the operating system we're
  * currently running on.



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits