← Back to team overview

kicad-developers team mailing list archive

Bazaar revision cmake patch

 

Hello Marco

I have made a proposed patch for the revision number generated by the cmake
scripts. Here attached.

Background information:
The current cmake scripts that generate the bzr revision number to be
displayed in the version info in kicad showed only the (HEAD) revision of
the repository, and not the working tree. This is not any good if one tries
to checkout an older version and build and then forgets what he has build.

I have modified such that it grabs the tree version, which is the version
checked out with bzr update -r1337 or whatever revision you are interrested
in.

I am new to cmake, so patch might not be ideal, but it works!

Nick Østergaard
=== modified file 'CMakeModules/CreateBzrVersionHeader.cmake'
--- CMakeModules/CreateBzrVersionHeader.cmake	2013-10-11 16:24:43 +0000
+++ CMakeModules/CreateBzrVersionHeader.cmake	2013-12-24 23:18:26 +0000
@@ -30,8 +30,15 @@
         set( _Bazaar_SAVED_LC_ALL "$ENV{LC_ALL}" )
         set( ENV{LC_ALL} C )
 
-        execute_process( COMMAND
-                         ${Bazaar_EXECUTABLE} log -r-1 ${PROJECT_SOURCE_DIR}
+        # Get the tree revison
+        execute_process( COMMAND
+                         ${Bazaar_EXECUTABLE} revno --tree ${PROJECT_SOURCE_DIR}
+                         OUTPUT_VARIABLE _bazaar_TREE_DATE
+                         OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+        # Get more info about that revision
+        execute_process( COMMAND
+                         ${Bazaar_EXECUTABLE} log -r${_bazaar_TREE_DATE} ${PROJECT_SOURCE_DIR}
                          OUTPUT_VARIABLE _bazaar_LAST_CHANGE_LOG
                          ERROR_VARIABLE _bazaar_log_error
                          RESULT_VARIABLE _bazaar_log_result


Follow ups