summaryrefslogtreecommitdiff
path: root/CMake/Modules/read_release_tarballs.cmake
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
committerChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
commitffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch)
tree1269efa852935b183daae4bb33a58d1b4d2ffb53 /CMake/Modules/read_release_tarballs.cmake
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to 'CMake/Modules/read_release_tarballs.cmake')
-rw-r--r--CMake/Modules/read_release_tarballs.cmake37
1 files changed, 37 insertions, 0 deletions
diff --git a/CMake/Modules/read_release_tarballs.cmake b/CMake/Modules/read_release_tarballs.cmake
new file mode 100644
index 00000000..e847e33b
--- /dev/null
+++ b/CMake/Modules/read_release_tarballs.cmake
@@ -0,0 +1,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 ()