Update macros

This commit is contained in:
2026-01-07 20:22:33 +08:00
parent fcbcd25f3a
commit a1c5ee9c5e

View File

@@ -11,9 +11,21 @@
%__cp -a . %{_builddir}/go/src/%{go_import_path} ; \\\
cd %{_builddir}/go/src/%{go_import_path} ; \\\
\\\
# How to include go modules (whitelist): \\\
# Exact package inclusions: %{?go_test_include} (space-separated list of packages) \\\
# Glob-based inclusions: set the GO_TEST_INCLUDE_GLOB environment variable or use %{?go_test_include_glob} \\\
# Note: If include list is set, only matching packages will be tested. \\\
# \\\
# How to exclude go modules: \\\
# Exact package exclusions: %{?go_test_exclude} (space-separated list of packages) \\\
# Regex-based exclusions: set the GO_TEST_EXCLUDE_GLOB environment variable or use %{?go_test_exclude_glob} \\\
# Glob-based exclusions: set the GO_TEST_EXCLUDE_GLOB environment variable or use %{?go_test_exclude_glob} \\\
# Note: Exclusions are applied after inclusions. \\\
_go_in_list="%{shrink:%{?go_test_include}}" ; \\\
if [ -n "${GO_TEST_INCLUDE_GLOB:-}" ]; then \\\
_go_in_glob="${GO_TEST_INCLUDE_GLOB}" ; \\\
else \\\
_go_in_glob="%{shrink:%{?go_test_include_glob}}" ; \\\
fi ; \\\
_go_ex_list="%{shrink:%{?go_test_exclude}}" ; \\\
if [ -n "${GO_TEST_EXCLUDE_GLOB:-}" ]; then \\\
_go_ex_glob="${GO_TEST_EXCLUDE_GLOB}" ; \\\
@@ -43,10 +55,27 @@
while IFS= read -r _pkg; do \\\
[ -z "$_pkg" ] && continue ; \\\
_skip=0 ; \\\
# Exact inclusions (whitelist) - if set, package must match \\\
if [ -n "$_go_in_list" ] || [ -n "$_go_in_glob" ]; then \\\
_included=0 ; \\\
for _in in $_go_in_list; do \\\
[ -n "$_in" ] && [ "$_pkg" = "$_in" ] && _included=1 && break ; \\\
done ; \\\
if [ "$_included" -eq 0 ] && [ -n "$_go_in_glob" ]; then \\\
for _pat in $_go_in_glob; do \\\
case "$_pkg" in \\\
$_pat) _included=1; break ;; \\\
esac ; \\\
done ; \\\
fi ; \\\
[ "$_included" -eq 0 ] && _skip=1 ; \\\
fi ; \\\
# Exact exclusions \\\
for _ex in $_go_ex_list; do \\\
[ -n "$_ex" ] && [ "$_pkg" = "$_ex" ] && _skip=1 && break ; \\\
done ; \\\
if [ "$_skip" -eq 0 ]; then \\\
for _ex in $_go_ex_list; do \\\
[ -n "$_ex" ] && [ "$_pkg" = "$_ex" ] && _skip=1 && break ; \\\
done ; \\\
fi ; \\\
# Glob exclusions \\\
if [ "$_skip" -eq 0 ] && [ -n "$_go_ex_glob" ]; then \\\
for _pat in $_go_ex_glob; do \\\