blob: 416dc0a75fbd846a03a2a42900e0813f7bea9c74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
# Check the CMake source tree for suspicious policy introdcutions...
#
message("=============================================================================")
message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
message("")
message("CMake_BINARY_DIR='${CMake_BINARY_DIR}'")
message("CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'")
message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
message("")
# If this does not appear to be a git checkout, just pass the test here
# and now. (Do not let the test fail if it is run in a tree *exported* from a
# repository or unpacked from a .zip file source installer...)
#
set(is_git_checkout 0)
if(EXISTS "${CMake_SOURCE_DIR}/.git")
set(is_git_checkout 1)
endif()
message("is_git_checkout='${is_git_checkout}'")
message("")
if(NOT is_git_checkout)
message("source tree is not a git checkout... test passes by early return...")
return()
endif()
# If no GIT_EXECUTABLE, see if we can figure out which git was used
# for the ctest_update step on this dashboard...
#
if(is_git_checkout AND NOT GIT_EXECUTABLE)
set(ctest_ini_file "")
set(exe "")
# Use the old name:
if(EXISTS "${CMake_BINARY_DIR}/DartConfiguration.tcl")
set(ctest_ini_file "${CMake_BINARY_DIR}/DartConfiguration.tcl")
endif()
# But if it exists, prefer the new name:
if(EXISTS "${CMake_BINARY_DIR}/CTestConfiguration.ini")
set(ctest_ini_file "${CMake_BINARY_DIR}/CTestConfiguration.ini")
endif()
# If there is a ctest ini file, read the update command or git command
# from it:
#
if(ctest_ini_file)
file(STRINGS "${ctest_ini_file}" line REGEX "^GITCommand: (.*)$")
string(REGEX REPLACE "^GITCommand: (.*)$" "\\1" line "${line}")
if("${line}" MATCHES "^\"")
string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
else()
string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
endif()
set(exe "${line}")
if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND")
set(exe "")
endif()
if(exe)
message("info: GIT_EXECUTABLE set by 'GITCommand:' from '${ctest_ini_file}'")
endif()
if(NOT exe)
file(STRINGS "${ctest_ini_file}" line REGEX "^UpdateCommand: (.*)$")
string(REGEX REPLACE "^UpdateCommand: (.*)$" "\\1" line "${line}")
if("${line}" MATCHES "^\"")
string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
else()
string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
endif()
set(exe "${line}")
if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND")
set(exe "")
endif()
if(exe)
message("info: GIT_EXECUTABLE set by 'UpdateCommand:' from '${ctest_ini_file}'")
endif()
endif()
else()
message("info: no DartConfiguration.tcl or CTestConfiguration.ini file...")
endif()
# If we have still not grokked the exe, look in the Update.xml file to see
# if we can parse it from there...
#
if(NOT exe)
file(GLOB_RECURSE update_xml_file "${CMake_BINARY_DIR}/Testing/Update.xml")
if(update_xml_file)
file(STRINGS "${update_xml_file}" line
REGEX "^.*<UpdateCommand>(.*)</UpdateCommand>$" LIMIT_COUNT 1)
string(REPLACE ""\;" "\"" line "${line}")
string(REGEX REPLACE "^.*<UpdateCommand>(.*)</UpdateCommand>$" "\\1" line "${line}")
if("${line}" MATCHES "^\"")
string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
else()
string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
endif()
if(line)
set(exe "${line}")
endif()
if(exe)
message("info: GIT_EXECUTABLE set by '<UpdateCommand>' from '${update_xml_file}'")
endif()
else()
message("info: no Update.xml file...")
endif()
endif()
if(exe)
set(GIT_EXECUTABLE "${exe}")
message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
message("")
if(NOT EXISTS "${GIT_EXECUTABLE}")
message(FATAL_ERROR "GIT_EXECUTABLE does not exist...")
endif()
else()
message(FATAL_ERROR "could not determine GIT_EXECUTABLE...")
endif()
endif()
if(is_git_checkout AND GIT_EXECUTABLE)
# Check with "git grep" if there are any unacceptable cmPolicies additions
#
message("=============================================================================")
message("This is a git checkout, using git grep to verify no unacceptable policies")
message("are being introduced....")
message("")
execute_process(COMMAND ${GIT_EXECUTABLE} grep -En "[0-9][0-9][0-9][0-9][0-9].*cmPolicies"
WORKING_DIRECTORY ${CMake_SOURCE_DIR}
OUTPUT_VARIABLE grep_output
OUTPUT_STRIP_TRAILING_WHITESPACE)
message("=== output of 'git grep -En \"[0-9][0-9][0-9][0-9][0-9].*cmPolicies\"' ===")
message("${grep_output}")
message("=== end output ===")
message("")
if(NOT "${grep_output}" STREQUAL "")
message(FATAL_ERROR "git grep output is non-empty...
New CMake policies must be introduced in a non-date-based version number.
Send email to the cmake-developers list to figure out what the target
version number for this policy should be...")
endif()
endif()
# Still here? Good then...
#
message("test passes")
message("")
|