[geos-commits] r4389 - in trunk: . tools

Sandro Santilli strk at kbt.io
Fri Mar 31 12:44:55 PDT 2017


Author: strk
Date: 2017-03-31 12:44:55 -0700 (Fri, 31 Mar 2017)
New Revision: 4389

Added:
   trunk/tools/repo_revision.sh
Removed:
   trunk/tools/svn_repo_revision.sh
Modified:
   trunk/CMakeLists.txt
   trunk/Makefile.am
   trunk/tools/Makefile.am
Log:
Rename svn_repo_revision.sh to repo_revision.sh

.. even if it still only extracts the *SVN* revision (also from git log).
See #794

Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2017-03-31 19:26:16 UTC (rev 4388)
+++ trunk/CMakeLists.txt	2017-03-31 19:44:55 UTC (rev 4389)
@@ -296,7 +296,7 @@
      find_program(SH sh)
      if(SH)
         execute_process(COMMAND ${SH} -c
-        "cd ${PROJECT_SOURCE_DIR} && ${PROJECT_SOURCE_DIR}/tools/svn_repo_revision.sh")
+        "cd ${PROJECT_SOURCE_DIR} && ${PROJECT_SOURCE_DIR}/tools/repo_revision.sh")
 
         file(RENAME "${PROJECT_SOURCE_DIR}/geos_revision.h"
         "${PROJECT_BINARY_DIR}/geos_revision.h")

Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am	2017-03-31 19:26:16 UTC (rev 4388)
+++ trunk/Makefile.am	2017-03-31 19:44:55 UTC (rev 4389)
@@ -54,7 +54,7 @@
 	cd $(srcdir) && git svn rebase --authors-file authors.git
 
 geos_revision.h:
-	top_srcdir=$(srcdir) sh $(srcdir)/tools/svn_repo_revision.sh
+	top_srcdir=$(srcdir) sh $(srcdir)/tools/repo_revision.sh
 
 VALGRIND = $(LIBTOOL) --mode=execute valgrind --leak-check=full --error-exitcode=1
 

Modified: trunk/tools/Makefile.am
===================================================================
--- trunk/tools/Makefile.am	2017-03-31 19:26:16 UTC (rev 4388)
+++ trunk/tools/Makefile.am	2017-03-31 19:44:55 UTC (rev 4389)
@@ -2,4 +2,4 @@
 # This file is part of project GEOS (http://trac.osgeo.org/geos/)
 bin_SCRIPTS = geos-config
 
-EXTRA_DIST = CMakeLists.txt svn_repo_revision.sh
+EXTRA_DIST = CMakeLists.txt repo_revision.sh

Copied: trunk/tools/repo_revision.sh (from rev 4388, trunk/tools/svn_repo_revision.sh)
===================================================================
--- trunk/tools/repo_revision.sh	                        (rev 0)
+++ trunk/tools/repo_revision.sh	2017-03-31 19:44:55 UTC (rev 4389)
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+LC_ALL="C" # what for ?
+
+[ -z "$top_srcdir" ] && top_srcdir="."
+rev_file=$top_srcdir'/geos_revision.h'
+
+read_rev() {
+
+    if test -d $top_srcdir"/.svn"; then
+      read_rev_svn
+    elif test -d $top_srcdir"/.git"; then
+      read_rev_git
+    else
+      echo "Can't fetch local revision (neither .svn nor .git found)" >&2
+      echo 0
+    fi
+}
+
+read_rev_git() {
+
+  # TODO: test on old systems, I think I saw some `which`
+  #       implementations returning "nothing found" or something
+  #       like that, making the later if ( ! $svn_exe ) always false
+  #
+  git_exe=`which git`;
+  if test -z "$git_exe"; then
+    echo "Can't fetch SVN revision: no git executable found" >&2
+    echo 0;
+  fi
+
+  rev=`cd ${top_srcdir} && ${git_exe} log --grep=git-svn -1 | grep git-svn | cut -d@ -f2 | cut -d' ' -f1`
+
+  if test -z "$rev"; then
+    echo "Can't fetch SVN revision from git log" >&2 
+    echo 0
+  else
+    echo $rev
+  fi
+}
+
+read_rev_svn() {
+
+  # TODO: test on old systems, I think I saw some `which`
+  #       implementations returning "nothing found" or something
+  #       like that, making the later if ( ! $svn_exe ) always false
+  #
+  svn_exe=`which svn`
+  if test -z "$svn_exe"; then
+    echo "Can't fetch SVN revision: no svn executable found" >&2
+    echo 0;
+  fi
+
+  svn_info=`"${svn_exe}" info | grep 'Last Changed Rev:' | cut -d: -f2`
+
+  if test -z "$svn_info"; then
+    echo "Can't fetch SVN revision with `svn info`" >&2
+    echo 0
+  else
+    echo ${svn_info}
+  fi
+}
+
+write_defn() {
+  rev=$1
+  oldrev=0
+
+  # Do not override the file if new detected
+  # revision isn't zero nor different from the existing one
+  if test -f $rev_file; then
+    oldrev=`grep GEOS_SVN_REVISION ${rev_file} | awk '{print $2}'`
+    if test "$rev" = 0 -o "$rev" = "$oldrev"; then
+      echo "Not updating existing rev file at $oldrev" >&2
+      return;
+    fi
+  fi
+
+  echo "#define GEOS_SVN_REVISION $rev" | tee $rev_file
+  echo "Wrote rev '$rev' in file '$rev_file'" >&2
+}
+
+# Read the svn revision number
+svn_rev=`read_rev`
+
+# Write it 
+write_defn $svn_rev

Deleted: trunk/tools/svn_repo_revision.sh
===================================================================
--- trunk/tools/svn_repo_revision.sh	2017-03-31 19:26:16 UTC (rev 4388)
+++ trunk/tools/svn_repo_revision.sh	2017-03-31 19:44:55 UTC (rev 4389)
@@ -1,86 +0,0 @@
-#!/bin/sh
-
-LC_ALL="C" # what for ?
-
-[ -z "$top_srcdir" ] && top_srcdir="."
-rev_file=$top_srcdir'/geos_revision.h'
-
-read_rev() {
-
-    if test -d $top_srcdir"/.svn"; then
-      read_rev_svn
-    elif test -d $top_srcdir"/.git"; then
-      read_rev_git
-    else
-      echo "Can't fetch local revision (neither .svn nor .git found)" >&2
-      echo 0
-    fi
-}
-
-read_rev_git() {
-
-  # TODO: test on old systems, I think I saw some `which`
-  #       implementations returning "nothing found" or something
-  #       like that, making the later if ( ! $svn_exe ) always false
-  #
-  git_exe=`which git`;
-  if test -z "$git_exe"; then
-    echo "Can't fetch SVN revision: no git executable found" >&2
-    echo 0;
-  fi
-
-  rev=`cd ${top_srcdir} && ${git_exe} log --grep=git-svn -1 | grep git-svn | cut -d@ -f2 | cut -d' ' -f1`
-
-  if test -z "$rev"; then
-    echo "Can't fetch SVN revision from git log" >&2 
-    echo 0
-  else
-    echo $rev
-  fi
-}
-
-read_rev_svn() {
-
-  # TODO: test on old systems, I think I saw some `which`
-  #       implementations returning "nothing found" or something
-  #       like that, making the later if ( ! $svn_exe ) always false
-  #
-  svn_exe=`which svn`
-  if test -z "$svn_exe"; then
-    echo "Can't fetch SVN revision: no svn executable found" >&2
-    echo 0;
-  fi
-
-  svn_info=`"${svn_exe}" info | grep 'Last Changed Rev:' | cut -d: -f2`
-
-  if test -z "$svn_info"; then
-    echo "Can't fetch SVN revision with `svn info`" >&2
-    echo 0
-  else
-    echo ${svn_info}
-  fi
-}
-
-write_defn() {
-  rev=$1
-  oldrev=0
-
-  # Do not override the file if new detected
-  # revision isn't zero nor different from the existing one
-  if test -f $rev_file; then
-    oldrev=`grep GEOS_SVN_REVISION ${rev_file} | awk '{print $2}'`
-    if test "$rev" = 0 -o "$rev" = "$oldrev"; then
-      echo "Not updating existing rev file at $oldrev" >&2
-      return;
-    fi
-  fi
-
-  echo "#define GEOS_SVN_REVISION $rev" | tee $rev_file
-  echo "Wrote rev '$rev' in file '$rev_file'" >&2
-}
-
-# Read the svn revision number
-svn_rev=`read_rev`
-
-# Write it 
-write_defn $svn_rev



More information about the geos-commits mailing list