blob: e847e33b6679c42bd8426b6d32ff16cab9e59a60 (
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
|
# Reads CMake/release-tarballs.txt by the rules .github/scripts/release-policy.py
# and package-cli-tools.sh apply: fields split on blanks, a line whose first
# field starts with # is a comment, and each tarball is named once and names
# at least one program.
function (wsjt_read_release_tarballs tarball_file programs_out)
if (NOT EXISTS "${tarball_file}")
message (FATAL_ERROR "Release tarball list not found: ${tarball_file}")
endif ()
file (STRINGS "${tarball_file}" _wsjt_tarball_lines ENCODING UTF-8)
set (_wsjt_tarball_names)
set (_wsjt_tarball_programs)
foreach (_wsjt_tarball_line IN LISTS _wsjt_tarball_lines)
string (REGEX MATCHALL "[^ \t\r]+" _wsjt_tarball_fields "${_wsjt_tarball_line}")
list (LENGTH _wsjt_tarball_fields _wsjt_tarball_field_count)
if (_wsjt_tarball_field_count EQUAL 0)
continue ()
endif ()
list (GET _wsjt_tarball_fields 0 _wsjt_tarball_name)
if (_wsjt_tarball_name MATCHES "^#")
continue ()
endif ()
if (_wsjt_tarball_field_count LESS 2)
message (FATAL_ERROR "release tarball ${_wsjt_tarball_name} names no programs in ${tarball_file}")
endif ()
if (_wsjt_tarball_name IN_LIST _wsjt_tarball_names)
message (FATAL_ERROR "release tarball ${_wsjt_tarball_name} is named twice in ${tarball_file}")
endif ()
list (APPEND _wsjt_tarball_names "${_wsjt_tarball_name}")
list (REMOVE_AT _wsjt_tarball_fields 0)
list (APPEND _wsjt_tarball_programs ${_wsjt_tarball_fields})
endforeach ()
if (NOT _wsjt_tarball_names)
message (FATAL_ERROR "no release tarballs named in ${tarball_file}")
endif ()
set (${programs_out} "${_wsjt_tarball_programs}" PARENT_SCOPE)
endfunction ()
|