Am Sonntag, 11. März 2012 um 18:02:54, schrieb Lars Gullik Bjønnes 
<lar...@gullik.org>
> Kornel Benko <kor...@lyx.org> writes:
> 
> | Am Sonntag, 11. März 2012 um 16:07:46, schrieb Lars Gullik Bjønnes 
> <lar...@gullik.org>
> >> On Sun, Mar 11, 2012 at 16:04, Vincent van Ravesteijn <v...@lyx.org> wrote:
> >> > Op 11-3-2012 15:39, Lars Gullik Bjønnes schreef:
> >> >
> >> >> I have just put the LyX git repo the lyx server.
> >> >>
> >> >> Clone with
> >> >>
> >> >> git clone g...@git.lyx.org:lyx
> >> >>
> >> >> Check that everything is ok.
> >> >>
> >> > Looks ok to me.
> >> 
> >> Ok, let's see if we can hear from someone else before I loosen up access.
> >> 
> >> -- 
> >>         Lgb
> >
> | It works, only I have to find a replacement for `svnversion` used in my 
> scripts to mark the created package.
> >
> | There seems to be something similar `git describe`, but somehow it shows 
> the value of 1397 commits, while
> | svn was already at commit 40911.
> 
> $ git describe
> 2.0.0-1397-g8be1845
> 
> Says that your current working tree is 1397 commits after the 2.0.0 tag,
> and curretnly at commit 8be1845.
> 
> -- 
>    Lgb

OK. So now I have the first change for cmake ready. It works like the svn-based 
version.
For now, I add 40000 to the commit value.
More sophisticated handling (like evaluate also `git log 2.0.0 -n1`) looks like 
not needed.

        Kornel
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1f6daf3..6bd53ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -251,16 +251,18 @@ foreach(_c_l ${_config_lines} )
 endforeach(_c_l)
 
 # Find the revision number and for later use
-FIND_PROGRAM(LYX_SVNVERSION svnversion)
-#message(STATUS "svnversion = ${LYX_SVNVERSION}")
-if(LYX_SVNVERSION)
-	EXECUTE_PROCESS(COMMAND ${LYX_SVNVERSION} WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE LYX_PACKAGE_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
-	# We use this value also to set the package-patch-value
-	if(LYX_PACKAGE_RELEASE MATCHES "^\([0-9]+\)")
-		set(LYX_REVISION_VERSION ${CMAKE_MATCH_1})
+FIND_PROGRAM(LYX_GITVERSION git)
+#message(STATUS "gitversion = ${LYX_GITVERSION}")
+if(LYX_GITVERSION)
+	EXECUTE_PROCESS(COMMAND ${LYX_GITVERSION} "describe" WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE LYX_PACKAGE_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
+	if (LYX_PACKAGE_RELEASE MATCHES "^2\\.0\\.0\\-\([0-9]+\)\\-.*$")
+	  # We will add offset of 40000 to get appropriate value to
+	  # previous svn.
+	  # We use this value than also to set the package-patch-value
+	  MATH(EXPR LYX_REVISION_VERSION "(${CMAKE_MATCH_1}+40000)")
 	endif()
 else()
-	set(LYX_REVISION_VERSION svn) #TODO use date
+	set(LYX_REVISION_VERSION git) #TODO use date
 endif()
 
 

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to