Revision: 74197
http://sourceforge.net/p/brlcad/code/74197
Author: starseeker
Date: 2019-10-20 21:31:32 +0000 (Sun, 20 Oct 2019)
Log Message:
-----------
Needs more testing, but set up the repository verification to work with either
Subversion or Git, depending on which VCS configuration directory is present.
Modified Paths:
--------------
brlcad/trunk/misc/CMake/distcheck_repo_verify.cmake.in
Modified: brlcad/trunk/misc/CMake/distcheck_repo_verify.cmake.in
===================================================================
--- brlcad/trunk/misc/CMake/distcheck_repo_verify.cmake.in 2019-10-20
20:44:47 UTC (rev 74196)
+++ brlcad/trunk/misc/CMake/distcheck_repo_verify.cmake.in 2019-10-20
21:31:32 UTC (rev 74197)
@@ -86,115 +86,129 @@
set(${SVN_PATHLIST} "${SVN_FILES}" PARENT_SCOPE)
endfunction(SVN_INFO_TO_PATH_LIST)
-# Git generates a textual report that we need to convert into a file list.
-#function(GIT_INFO_TO_PATH_LIST GIT_INFO GIT_PATHLIST)
-# set(GIT_PROCESSING ${${GIT_INFO}})
-# string(REGEX REPLACE "\n" ";" GIT_PROCESSING "${GIT_PROCESSING}")
-# set(GIT_FILES)
-# foreach(gf ${GIT_PROCESSING})
-# # https://git-scm.com/docs/git-status/#_output
-# string(REGEX REPLACE "[MADRCU?! ][MADRCU?!] " "" FILE_PATH "${gf}")
-# message("PATH: ${FILE_PATH}")
-# if(NOT IS_DIRECTORY "@CMAKE_SOURCE_DIR@/${FILE_PATH}")
-# list(APPEND GIT_FILES ${FILE_PATH})
-# else(NOT IS_DIRECTORY "@CMAKE_SOURCE_DIR@/${FILE_PATH}")
-# file(GLOB_RECURSE AFILES RELATIVE "@CMAKE_SOURCE_DIR@"
"@CMAKE_SOURCE_DIR@/${FILE_PATH}/*")
-# foreach(gr ${AFILES})
-# list(APPEND GIT_FILES ${gr})
-# endforeach(gr ${AFILES})
-# endif(NOT IS_DIRECTORY "@CMAKE_SOURCE_DIR@/${FILE_PATH}")
-# endforeach(gf ${GIT_PROCESSING})
-# set(${GIT_PATHLIST} "${GIT_FILES}" PARENT_SCOPE)
-#endfunction(GIT_INFO_TO_PATH_LIST)
-#
-## Look for Git - if we don't have the command, we can't query the
-## repository even if it is present.
-#find_program(GIT_EXEC git)
-#
-## We need the Git binary and the source directory must be a
-## checkout of the BRL-CAD git repository. If these two conditions
-## are met, we can collect information from Git
-#if(GIT_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.git")
-#
-# # By default, assume that nothing has been modified.
-# set(GIT_TREE_MODIFIED 0)
-#
-# # Get the file list
-# set(GIT_FILES "")
-# execute_process(COMMAND ${GIT_EXEC} -C "@CMAKE_SOURCE_DIR@" status
--porcelain --ignored OUTPUT_VARIABLE GIT_STDOUT ERROR_VARIABLE GIT_STDERR
RESULT_VARIABLE RETVAL)
-# if (RETVAL)
-# message("")
-# message("WARNING: Git does not seem to be working correctly.")
-# message(" Output from ${GIT_EXEC} -C \"@CMAKE_SOURCE_DIR@\"
status --porcelain --ignored:")
-# message("${GIT_STDERR}")
-# endif (RETVAL)
-#
-#
-# message(" --- Building file list from Git information: ...")
-#
-# GIT_INFO_TO_PATH_LIST(GIT_STDOUT GIT_FILES)
-#
-# message(FATAL_ERROR "git testing done")
-#endif(GIT_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.git")
+# If we're using subversion, check what it thinks the contents should be
+if(EXISTS "@CMAKE_SOURCE_DIR@/.svn")
+ # Look for Subversion - if we don't have the command, we can't query the
+ # repository even if it is present.
+ find_program(SVN_EXEC svn)
+ if(SVN_EXEC)
+ # We need the Subversion binary and the source directory must be a
+ # checkout of the BRL-CAD subversion repository. If these two conditions
+ # are met, we can collect information from subversion
-# Look for Subversion - if we don't have the command, we can't query the
-# repository even if it is present.
-find_program(SVN_EXEC svn)
+ # By default, assume that nothing has been modified.
+ set(SVN_TREE_MODIFIED 0)
-# We need the Subversion binary and the source directory must be a
-# checkout of the BRL-CAD subversion repository. If these two conditions
-# are met, we can collect information from subversion
-if(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
+ # Get the file list
+ set(SVN_FILES "")
+ execute_process(COMMAND ${SVN_EXEC} info -R "@CMAKE_SOURCE_DIR@"
OUTPUT_VARIABLE SVN_STDOUT ERROR_VARIABLE SVN_STDERR RESULT_VARIABLE RETVAL)
+ if (RETVAL)
+ message("")
+ message("WARNING: Subversion does not seem to be working correctly.")
+ message(" Output from ${SVN_EXEC} info -R
\"@CMAKE_SOURCE_DIR@\":")
+ message("${SVN_STDERR}")
+ endif (RETVAL)
- # By default, assume that nothing has been modified.
- set(SVN_TREE_MODIFIED 0)
+ message(" --- Building file list from Subversion manifests: ...")
- # Get the file list
- set(SVN_FILES "")
- execute_process(COMMAND ${SVN_EXEC} info -R "@CMAKE_SOURCE_DIR@"
OUTPUT_VARIABLE SVN_STDOUT ERROR_VARIABLE SVN_STDERR RESULT_VARIABLE RETVAL)
- if (RETVAL)
- message("")
- message("WARNING: Subversion does not seem to be working correctly.")
- message(" Output from ${SVN_EXEC} info -R \"@CMAKE_SOURCE_DIR@\":")
- message("${SVN_STDERR}")
- endif (RETVAL)
+ SVN_INFO_TO_PATH_LIST(SVN_STDOUT SVN_FILES)
- message(" --- Building file list from Subversion manifests: ...")
+ # Check whether Subversion is reporting modified files. Also, if any
+ # deleted files are reported, remove those from the SVN_FILES list
+ execute_process(COMMAND ${SVN_EXEC} status "@CMAKE_SOURCE_DIR@"
OUTPUT_VARIABLE SVN_STDOUT ERROR_VARIABLE SVN_STDERR)
+ string(REPLACE "@CMAKE_SOURCE_DIR@/" "" SVN_STDOUT "${SVN_STDOUT}")
+ string(REGEX REPLACE "\r?\n" ";" SVN_STATUS "${SVN_STDOUT}")
+ foreach(ITEM ${SVN_STATUS})
+ if(${ITEM} MATCHES "^M")
+ set(SVN_TREE_MODIFIED 1)
+ endif(${ITEM} MATCHES "^M")
+ if(${ITEM} MATCHES "^D")
+ string(REGEX REPLACE "^D[\\t\\ ]*" "" item_path "${ITEM}")
+ list(REMOVE_ITEM SVN_FILES ${item_path})
+ endif(${ITEM} MATCHES "^D")
+ endforeach(ITEM ${SVN_STATUS})
- SVN_INFO_TO_PATH_LIST(SVN_STDOUT SVN_FILES)
+ # Generate a sorted text file with the results of the Subversion list
processing.
+ scrub_list(SVN_FILES)
+ list(SORT SVN_FILES)
+ list(REMOVE_DUPLICATES SVN_FILES)
- # Check whether Subversion is reporting modified files. Also, if any
- # deleted files are reported, remove those from the SVN_FILES list
- execute_process(COMMAND ${SVN_EXEC} status "@CMAKE_SOURCE_DIR@"
OUTPUT_VARIABLE SVN_STDOUT ERROR_VARIABLE SVN_STDERR)
- string(REPLACE "@CMAKE_SOURCE_DIR@/" "" SVN_STDOUT "${SVN_STDOUT}")
- string(REGEX REPLACE "\r?\n" ";" SVN_STATUS "${SVN_STDOUT}")
- foreach(ITEM ${SVN_STATUS})
- if(${ITEM} MATCHES "^M")
- set(SVN_TREE_MODIFIED 1)
- endif(${ITEM} MATCHES "^M")
- if(${ITEM} MATCHES "^D")
- string(REGEX REPLACE "^D[\\t\\ ]*" "" item_path "${ITEM}")
- list(REMOVE_ITEM SVN_FILES ${item_path})
- endif(${ITEM} MATCHES "^D")
- endforeach(ITEM ${SVN_STATUS})
+ # If we've got modified files, we shouldn't use resulting tarballs for a
distribution -
+ # warn accordingly.
+ if(SVN_TREE_MODIFIED)
+ message("\n**** NOTE: Subversion reports modified source files present
in the source tree.\n Distcheck proceeding, but archives will not be
suitable for release.\n")
+ set(NOT_DISTCHECK_READY 1)
+ endif(SVN_TREE_MODIFIED)
- # Generate a sorted text file with the results of the Subversion list
processing.
- scrub_list(SVN_FILES)
- list(SORT SVN_FILES)
- list(REMOVE_DUPLICATES SVN_FILES)
+ message(" --- Building file list from Subversion manifests: Done")
- # If we've got modified files, we shouldn't use resulting tarballs for a
distribution -
- # warn accordingly.
- if(SVN_TREE_MODIFIED)
- message("\n**** NOTE: Subversion reports modified source files present in
the source tree.\n Distcheck proceeding, but archives will not be suitable
for release.\n")
- set(NOT_DISTCHECK_READY 1)
- endif(SVN_TREE_MODIFIED)
+ endif(SVN_EXEC)
+endif(EXISTS "@CMAKE_SOURCE_DIR@/.svn")
- message(" --- Building file list from Subversion manifests: Done")
+# If we're using Git, check what it thinks the contents should be
+if(EXISTS "@CMAKE_SOURCE_DIR@/.git")
+ # Look for Subversion - if we don't have the command, we can't query the
+ # repository even if it is present.
+ find_program(GIT_EXEC git)
-endif(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
+ if(GIT_EXEC)
+ # We need the Git binary and the source directory must be a
+ # checkout of the BRL-CAD subversion repository. If these two conditions
+ # are met, we can collect information from Git
+ # By default, assume that nothing has been modified.
+ set(SVN_TREE_MODIFIED 0)
+
+ # Get the file list
+ set(GIT_FILES "")
+ execute_process(COMMAND ${GIT_EXEC} ls-tree --full-tree -r --name-only HEAD
+ WORKING_DIRECTORY "@CMAKE_SOURCE_DIR@"
+ OUTPUT_VARIABLE GIT_STDOUT
+ ERROR_VARIABLE GIT_STDERR
+ RESULT_VARIABLE RETVAL)
+ string(REGEX REPLACE "\r?\n" ";" GIT_FILES "${GIT_STDOUT}")
+ if (RETVAL)
+ message("")
+ message("WARNING: Git does not seem to be working correctly.")
+ message(" Output from \"${GIT_EXEC} ls-tree --full-tree -r
--name-only HEAD\" in \"@CMAKE_SOURCE_DIR@\":")
+ message("${GIT_STDERR}")
+ endif (RETVAL)
+
+ # Check whether Git is reporting modified files.
+ execute_process(COMMAND ${GIT_EXEC} status --porcelain --ignored
+ WORKING_DIRECTORY "@CMAKE_SOURCE_DIR@"
+ OUTPUT_VARIABLE GIT_STDOUT
+ ERROR_VARIABLE GIT_STDERR)
+ string(REGEX REPLACE "\r?\n" ";" GIT_STATUS "${GIT_STDOUT}")
+ foreach(ITEM ${GIT_STATUS})
+ if(${ITEM} MATCHES "^\\?\\?")
+ string(REGEX REPLACE "^[?][?][\\t\\ ]*" "" item_path "${ITEM}")
+ list(REMOVE_ITEM GIT_FILES ${item_path})
+ else(${ITEM} MATCHES "^\\?\\?")
+ set(GIT_TREE_MODIFIED 1)
+ endif(${ITEM} MATCHES "^\\?\\?")
+ endforeach(ITEM ${GIT_STATUS})
+
+ # Generate a sorted text file with the results of the Git list processing.
+ scrub_list(GIT_FILES)
+ list(SORT GIT_FILES)
+ list(REMOVE_DUPLICATES GIT_FILES)
+
+ # If we've got modified files, we shouldn't use resulting tarballs for a
distribution -
+ # warn accordingly.
+ if(GIT_TREE_MODIFIED)
+ message("\n**** NOTE: Git reports modified source files present in the
source tree.\n Distcheck proceeding, but archives will not be suitable for
release.\n")
+ set(NOT_DISTCHECK_READY 1)
+ endif(GIT_TREE_MODIFIED)
+
+ message(" --- Building file list from Git manifests: Done")
+
+ endif(GIT_EXEC)
+endif(EXISTS "@CMAKE_SOURCE_DIR@/.git")
+
+
+
# The build system has kindly created lists of files and directories for us,
# but in order to compare the build system's lists to the others generated
# by this script we need the fully expanded list. Read and expand...
@@ -222,7 +236,7 @@
# Start scrubbing...
set(FS_FILES)
foreach(pf ${FS_FILE_LIST})
- if(NOT "${pf}" MATCHES ".*\\.svn/.*")
+ if(NOT "${pf}" MATCHES ".*\\.svn/.*" AND NOT "${pf}" MATCHES "^\\.git/.*")
if(CPACK_IGNORE_BUILD_PATH)
if(NOT "${pf}" MATCHES "^${CPACK_IGNORE_BUILD_PATH}.*")
list(APPEND FS_FILES ${pf})
@@ -230,7 +244,7 @@
else(CPACK_IGNORE_BUILD_PATH)
list(APPEND FS_FILES ${pf})
endif(CPACK_IGNORE_BUILD_PATH)
- endif(NOT "${pf}" MATCHES ".*\\.svn/.*")
+ endif(NOT "${pf}" MATCHES ".*\\.svn/.*" AND NOT "${pf}" MATCHES "^\\.git/.*")
endforeach(pf ${FS_FILE_LIST})
set(FS_FILE_LIST ${FS_FILES})
if(NOT FS_FILE_LIST)
@@ -252,34 +266,68 @@
# If we have Subversion, we can do lots more interesting comparisons.
# Otherwise, just look for files the build system doesn't know about.
-if(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
+if(EXISTS "@CMAKE_SOURCE_DIR@/.svn")
+ if(SVN_EXEC)
- # Report file in Subversion but not the build logic:
- set(SVN_FILES_NOT_IN_BUILD ${SVN_FILES})
- list(REMOVE_ITEM SVN_FILES_NOT_IN_BUILD ${BUILD_FILES})
- if(SVN_FILES_NOT_IN_BUILD)
- string(REPLACE ";" "\n" SVN_FILES_NOT_IN_BUILD "${SVN_FILES_NOT_IN_BUILD}")
- message("\nFiles known to subversion are not accounted for in build logic:
\n${SVN_FILES_NOT_IN_BUILD}\n")
- endif(SVN_FILES_NOT_IN_BUILD)
+ # Report file in Subversion but not the build logic:
+ set(SVN_FILES_NOT_IN_BUILD ${SVN_FILES})
+ list(REMOVE_ITEM SVN_FILES_NOT_IN_BUILD ${BUILD_FILES})
+ if(SVN_FILES_NOT_IN_BUILD)
+ string(REPLACE ";" "\n" SVN_FILES_NOT_IN_BUILD
"${SVN_FILES_NOT_IN_BUILD}")
+ message("\nFiles known to subversion are not accounted for in build
logic: \n${SVN_FILES_NOT_IN_BUILD}\n")
+ endif(SVN_FILES_NOT_IN_BUILD)
- # Report file in the build logic but not Subversion:
- set(BUILD_FILES_NOT_IN_SVN ${BUILD_FILES})
- list(REMOVE_ITEM BUILD_FILES_NOT_IN_SVN ${SVN_FILES})
- if(BUILD_FILES_NOT_IN_SVN)
- string(REPLACE ";" "\n" BUILD_FILES_NOT_IN_SVN "${BUILD_FILES_NOT_IN_SVN}")
- message("\nFiles mentioned in build logic are not checked into the
repository: \n${BUILD_FILES_NOT_IN_SVN}\n")
- endif(BUILD_FILES_NOT_IN_SVN)
+ # Report file in the build logic but not Subversion:
+ set(BUILD_FILES_NOT_IN_SVN ${BUILD_FILES})
+ list(REMOVE_ITEM BUILD_FILES_NOT_IN_SVN ${SVN_FILES})
+ if(BUILD_FILES_NOT_IN_SVN)
+ string(REPLACE ";" "\n" BUILD_FILES_NOT_IN_SVN
"${BUILD_FILES_NOT_IN_SVN}")
+ message("\nFiles mentioned in build logic are not checked into the
repository: \n${BUILD_FILES_NOT_IN_SVN}\n")
+ endif(BUILD_FILES_NOT_IN_SVN)
- # Either of the previous two cases halts distcheck until fixed.
- set(FORCE_DISTCHECK @FORCE_DISTCHECK@)
- if (SVN_FILES_NOT_IN_BUILD OR BUILD_FILES_NOT_IN_SVN)
- if (NOT FORCE_DISTCHECK)
- message(FATAL_ERROR "ERROR: Distcheck cannot proceed until build files
and repo are in sync (set -DFORCE_DISTCHECK=ON to override)")
- endif (NOT FORCE_DISTCHECK)
- endif (SVN_FILES_NOT_IN_BUILD OR BUILD_FILES_NOT_IN_SVN)
+ # Either of the previous two cases halts distcheck until fixed.
+ set(FORCE_DISTCHECK @FORCE_DISTCHECK@)
+ if (SVN_FILES_NOT_IN_BUILD OR BUILD_FILES_NOT_IN_SVN)
+ if (NOT FORCE_DISTCHECK)
+ message(FATAL_ERROR "ERROR: Distcheck cannot proceed until build files
and repo are in sync (set -DFORCE_DISTCHECK=ON to override)")
+ endif (NOT FORCE_DISTCHECK)
+ endif (SVN_FILES_NOT_IN_BUILD OR BUILD_FILES_NOT_IN_SVN)
-endif(SVN_EXEC AND EXISTS "@CMAKE_SOURCE_DIR@/.svn")
+ endif(SVN_EXEC)
+endif(EXISTS "@CMAKE_SOURCE_DIR@/.svn")
+# If we have Git, we can do lots more interesting comparisons.
+# Otherwise, just look for files the build system doesn't know about.
+if(EXISTS "@CMAKE_SOURCE_DIR@/.git")
+ if(GIT_EXEC)
+
+ # Report file in Git but not the build logic:
+ set(GIT_FILES_NOT_IN_BUILD ${GIT_FILES})
+ list(REMOVE_ITEM GIT_FILES_NOT_IN_BUILD ${BUILD_FILES})
+ if(GIT_FILES_NOT_IN_BUILD)
+ string(REPLACE ";" "\n" GIT_FILES_NOT_IN_BUILD
"${GIT_FILES_NOT_IN_BUILD}")
+ message("\nFiles known to Git are not accounted for in build logic:
\n${GIT_FILES_NOT_IN_BUILD}\n")
+ endif(GIT_FILES_NOT_IN_BUILD)
+
+ # Report file in the build logic but not Git:
+ set(BUILD_FILES_NOT_IN_GIT ${BUILD_FILES})
+ list(REMOVE_ITEM BUILD_FILES_NOT_IN_GIT ${GIT_FILES})
+ if(BUILD_FILES_NOT_IN_GIT)
+ string(REPLACE ";" "\n" BUILD_FILES_NOT_IN_GIT
"${BUILD_FILES_NOT_IN_GIT}")
+ message("\nFiles mentioned in build logic are not checked into the
repository: \n${BUILD_FILES_NOT_IN_GIT}\n")
+ endif(BUILD_FILES_NOT_IN_GIT)
+
+ # Either of the previous two cases halts distcheck until fixed.
+ set(FORCE_DISTCHECK @FORCE_DISTCHECK@)
+ if (GIT_FILES_NOT_IN_BUILD OR BUILD_FILES_NOT_IN_GIT)
+ if (NOT FORCE_DISTCHECK)
+ message(FATAL_ERROR "ERROR: Distcheck cannot proceed until build files
and repo are in sync (set -DFORCE_DISTCHECK=ON to override)")
+ endif (NOT FORCE_DISTCHECK)
+ endif (GIT_FILES_NOT_IN_BUILD OR BUILD_FILES_NOT_IN_GIT)
+
+ endif(GIT_EXEC)
+endif(EXISTS "@CMAKE_SOURCE_DIR@/.git")
+
set(IGNORED_FS_FILES ${FS_FILE_LIST})
list(REMOVE_ITEM IGNORED_FS_FILES ${BUILD_FILES})
if(IGNORED_FS_FILES)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits