svn build issue

Ben Boeckel mathstuf at gmail.com
Fri Oct 25 06:39:51 UTC 2013


On Mon, 21 Oct, 2013 at 02:12:04 GMT, Kevin Kofler wrote:
> Upstream's CMakeLists.txt does this:
>         FIND_PACKAGE(Subversion)
>         IF(Subversion_FOUND)
>           Subversion_WC_INFO(${PROJECT_SOURCE_DIR} GUAYADEQUE)
>           MESSAGE("Current revision is ${GUAYADEQUE_WC_REVISION}")
>           SET( _GUREVISION_ ${GUAYADEQUE_WC_REVISION})
>         ELSE(Subversion_FOUND)
>           SET( _GUREVISION_ "" )
>         ENDIF(Subversion_FOUND)
>
> In particular, this line:
>           Subversion_WC_INFO(${PROJECT_SOURCE_DIR} GUAYADEQUE)
> runs "svn info" on the current directory to obtain the revision and store it 
> in the CMake variable GUAYADEQUE_WC_REVISION, which is then copies to the 
> CMake variable _GUREVISION_, presumably to show it in some about dialog or 
> something. And the tarball they ship is a working copy in an outdated format 
> (outdated SVN version). (IMHO, shipping SVN working copies rather than 
> exports as tarballs is broken in the first place.)
>
> IMHO, just removing the .svn directories (i.e. converting the working copies 
> to a clean export) is the best fix, but you could also run "svn upgrade" in 
> the specfile (with BuildRequires: subversion) if you think it's important to 
> have the revision show up (but you could also manually specify
> -D_GUREVISION_:STRING=1885 on the cmake command line to get that).

FWIW, the way that this *should* be done is:

  1) Wish you had git's export-subst support[1]
  2) If no .svn directory exists, assume it's not computable (no
     revision number)
  3) If subversion is found, then add_custom_command() to generate a
     header file with configure_file() from output of execute_process()
     to get the current revision (and preferably also whether the source
     tree has modifications)

The main problem with the approach here is that the revision isn't
guaranteed to be right (not really a problem for tarballs, but upstream
might care):

    % cmake ../src
    % make # Uses current revision
    % cd ../src
    % vim # Hack, hack, hack
    % svn add .
    % svn commit
    % cd ../build
    % make # Uses previous revision

--Ben

[1].gitattributes and set export-subst on the CMake file with this code:

    if ("$Format:$" STREQUAL "")
      option(TREE_IS_PATCHED "Maintainers: Please set to ON if patched" OFF)
      set(git_full_hash  "$Format:%H")
      set(git_short_hash "$Format:%h")
      set(git_tree_dirty "${TREE_IS_PATCHED}")

      configure_file(...)
    else ()
      # Logic from above.
    endif ()



More information about the devel mailing list