include the svn revision in the --version info (wish 162179)

Alexander Neundorf neundorf at kde.org
Thu Nov 20 23:21:33 GMT 2008


On Monday 17 November 2008, Jaime wrote:
> Hello,
>
>   I have a patch for CMakeList.txt in kdelibs to solve my own wish (include
> the svn revision in the --version info)
>
> http://bugs.kde.org/show_bug.cgi?id=162179
>
> --- CMakeLists.txt     2008-11-17 12:29:41.765625000 +0100
> +++ CMakeLists.txt      2008-11-17 10:06:49.000000000
> +0100
> @@ -8,9 +8,29
> @@
>
>
>
> set (KDE_VERSION_MAJOR
> 4)
> set (KDE_VERSION_MINOR
> 1)
> set (KDE_VERSION_RELEASE
> 73)
> set (KDE_VERSION
> "${KDE_VERSION_MAJOR}.${KDE_VERSION_MINOR}.${KDE_VERSION_RELEASE}" )
> -set (KDE_VERSION_STRING "${KDE_VERSION} (KDE 4.1.73 (KDE 4.2 >=
> 20081112))")
> +
>
> +execute_process(COMMAND svn info --xml WORKING_DIRECTORY
> ${CMAKE_CURRENT_SOURCE_DIR}
>
> +                             COMMAND grep -m 1
> revision
> +                             COMMAND cut -f 2 -d
> \"
> +                             OUTPUT_VARIABLE SVN_REVISION
> )
> +if (SVN_REVISION)
> +  string(STRIP ${SVN_REVISION} SVN_REVISION)
> +  set(SVN_REVISION "r${SVN_REVISION}")
> +else(SVN_REVISION)
> +  set (SVN_REVISION "${KDE_VERSION}")
> +endif(SVN_REVISION)
> +
> +set (KDE_VERSION_STRING "${KDE_VERSION}  (${SVN_REVISION} (KDE 4.2 >=
> 20081112))")
>
> With this patch, if the svn info is not available, the KDE_VERSION_STRING
> remains unaltered.
>
> Can this still be applied in trunk or have to wait to 4.3?

This only runs if cmake runs. I.e. you can get a lot of updates via svn up but 
as long as no cmake file is changed this doesn't run again, so you will have 
a wrong svn revision.
I wouldn't put it in as it is now.

Alex




More information about the kde-core-devel mailing list