[packages/rpm-pld-macros] Accept xx( and xx\( noauto entries (we have mixtures of these in hundreds of specs - best would be t

arekm arekm at pld-linux.org
Tue May 5 12:34:05 CEST 2026


commit bfa47cdf77eb01a65cd15cac652d91a7418261ce
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Tue May 5 12:33:51 2026 +0200

    Accept xx( and xx\( noauto entries (we have mixtures of these in hundreds of specs - best would be to fix them all to use explicit escaping in specs)

 macros.pld          | 31 +++++++++++++++++++++++++++++++
 rpm-pld-macros.spec |  2 +-
 2 files changed, 32 insertions(+), 1 deletion(-)
---
diff --git a/rpm-pld-macros.spec b/rpm-pld-macros.spec
index 07861b6..d7ad16c 100644
--- a/rpm-pld-macros.spec
+++ b/rpm-pld-macros.spec
@@ -1,4 +1,4 @@
-%define		rpm_macros_rev	2.063
+%define		rpm_macros_rev	2.064
 %define		find_lang_rev	1.42
 # split into individual X_prov_ver if there is a reason to desync
 %define		prov_ver	4.15
diff --git a/macros.pld b/macros.pld
index 065e03f..e789891 100644
--- a/macros.pld
+++ b/macros.pld
@@ -1157,12 +1157,43 @@ fi; \
 # Used by __requires_exclude / __provides_exclude to filter auto-dependencies.
 # Strips single quotes from patterns (some specs quote _noautoreq values)
 # and skips #-comment tokens.
+#
+# Each token is normalized so that the common PLD usage forms work as
+# packagers actually expect:
+#   1. prefix(content)   - escape outer parens, keep content as regex
+#                          'pear(Foo.*)'         → pear\(Foo.*\)
+#                          'pear(a|.*b|c)'       → pear\((a|.*b|c)\)
+#                          'libc.so.6(GLIBC_..)' → libc.so.6\(GLIBC_..\)
+#                          The prefix must be alphanumeric/dot/dash; this
+#                          excludes coq's 'ocamlx?\(...\)' (has '?') and
+#                          audio plugin paths '%{_libdir}/(...)' (has '/'),
+#                          which fall through to step 2 or 3.
+#   2. token without '|' - escape unescaped parens (already-escaped \( stays)
+#                          '(GLIBC_PRIVATE)' → \(GLIBC_PRIVATE\)
+#   3. token with '|'    - left intact for regex alternation grouping
+#                          '%{_libdir}/(dssi|lv2|vst)' unchanged
+#                          'ocamlx?\((A|B|C)\)' unchanged
+#
+# This diverges from upstream RPM's pure-regex contract for
+# __requires_exclude but matches how every PLD spec already uses
+# _noautoreq in practice. The typed _noautoreq_<lang> variants
+# auto-escape via __noauto_regexp_helper and remain the preferred form.
 %__noautodep_helper() %{lua:
 local args = rpm.expand("%*")
 local result = {}
 for token in args:gmatch("%S+") do
   token = token:gsub("'", "")
   if token ~= "" and not token:match("^#") then
+    local prefix, content = token:match("^([%w._-]+)%((.*)%)$")
+    if prefix then
+      if content:match("|") then
+        token = prefix .. "\\((" .. content .. ")\\)"
+      else
+        token = prefix .. "\\(" .. content .. "\\)"
+      end
+    elseif not token:match("|") then
+      token = token:gsub("\\?%(", "\\("):gsub("\\?%)", "\\)")
+    end
     table.insert(result, token)
   end
 end
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-pld-macros.git/commitdiff/bfa47cdf77eb01a65cd15cac652d91a7418261ce



More information about the pld-cvs-commit mailing list