[packages/grok] - rel 4, avoid macro redefinition

baggins baggins at pld-linux.org
Sat Oct 18 21:24:52 CEST 2025


commit 490e90bcc3147d1334b86729eae4e3cce70623db
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sat Oct 18 23:24:35 2025 +0200

    - rel 4, avoid macro redefinition

 grok.spec          |  4 +++-
 local-macros.patch | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 1 deletion(-)
---
diff --git a/grok.spec b/grok.spec
index 69746fc..b03564d 100644
--- a/grok.spec
+++ b/grok.spec
@@ -1,7 +1,7 @@
 Summary:	A powerful pattern matching system for parsing and processing text
 Summary(pl.UTF-8):	Potężny system dopasowywania wzorców do analizy i przetwarzania tekstu
 Name:		grok
-%define	rel	3
+%define	rel	4
 %define	snap	20170721
 %define	gitref	a52f42b1fa359db2145a70216ec5b4ef43d57b5c
 # git history shows 1.2011xxxx, then 0.9.y... use 0 for now
@@ -15,6 +15,7 @@ Source0:	https://github.com/jordansissel/grok/archive/%{gitref}/%{name}-%{snap}.
 Patch0:		%{name}-gperf.patch
 Patch1:		%{name}-bison.patch
 Patch2:		missing-decls.patch
+Patch3:		local-macros.patch
 URL:		https://github.com/jordansissel/grok
 BuildRequires:	bison
 BuildRequires:	flex
@@ -54,6 +55,7 @@ Pliki nagłówkowe do tworzenia programów z użyciem biblioteki grok.
 %patch -P0 -p1
 %patch -P1 -p1
 %patch -P2 -p1
+%patch -P3 -p1
 
 %build
 %{__make} \
diff --git a/local-macros.patch b/local-macros.patch
new file mode 100644
index 0000000..5494f0e
--- /dev/null
+++ b/local-macros.patch
@@ -0,0 +1,58 @@
+--- grok-a52f42b1fa359db2145a70216ec5b4ef43d57b5c/grokre.c~	2017-07-20 23:49:31.000000000 +0200
++++ grok-a52f42b1fa359db2145a70216ec5b4ef43d57b5c/grokre.c	2025-10-18 23:23:17.219993928 +0200
+@@ -12,8 +12,8 @@
+ 
+ /* global, static variables */
+ 
+-#define CAPTURE_ID_LEN 5
+-#define CAPTURE_FORMAT "_%04x"
++#define _CAPTURE_ID_LEN 5
++#define _CAPTURE_FORMAT "_%04x"
+ 
+ /* internal functions */
+ static char *grok_pattern_expand(grok_t *grok); //, int offset, int length);
+@@ -166,7 +166,7 @@
+   int full_len = -1;
+   int full_size = -1;
+   char *full_pattern = NULL;
+-  char capture_id_str[CAPTURE_ID_LEN + 1];
++  char capture_id_str[_CAPTURE_ID_LEN + 1];
+ 
+   const char *patname = NULL;
+ 
+@@ -244,7 +244,7 @@
+       pcre_get_substring(full_pattern, capture_vector, g_pattern_num_captures,
+                          g_cap_subname, &subname);
+ 
+-      snprintf(capture_id_str, CAPTURE_ID_LEN + 1, CAPTURE_FORMAT, capture_id);
++      snprintf(capture_id_str, _CAPTURE_ID_LEN + 1, _CAPTURE_FORMAT, capture_id);
+ 
+       /* Add this capture to the list of captures */
+       gct->id = capture_id;
+@@ -283,7 +283,7 @@
+       /* Insert the capture id into (?<FOO>) */
+       substr_replace(&full_pattern, &full_len, &full_size,
+                      start + 3, 0,
+-                     capture_id_str, CAPTURE_ID_LEN);
++                     capture_id_str, _CAPTURE_ID_LEN);
+       grok_log(grok, LOG_REGEXPAND, "% 20s: %.*s", "add capture id",
+                full_len, full_pattern);
+ 
+@@ -291,7 +291,7 @@
+       /* Insert the pattern into (?<FOO>pattern) */
+       /* 3 = '(?<', 4 = strlen(capture_id_str), 1 = ")" */
+       substr_replace(&full_pattern, &full_len, &full_size, 
+-                     start + 3 + CAPTURE_ID_LEN + 1, 0, 
++                     start + 3 + _CAPTURE_ID_LEN + 1, 0, 
+                      pattern_regex, regexp_len);
+       grok_log(grok, LOG_REGEXPAND, ":: Inserted: %.*s", regexp_len,
+                pattern_regex);
+@@ -403,7 +403,7 @@
+   for (i = 0; i < nametable_size; i++) {
+     offset = i * nametable_entrysize;
+     stringnum = (nametable[offset] << 8) + nametable[offset + 1];
+-    sscanf(nametable + offset + 2, CAPTURE_FORMAT, &capture_id);
++    sscanf(nametable + offset + 2, _CAPTURE_FORMAT, &capture_id);
+     grok_log(grok, LOG_COMPILE, "Studying capture %d", capture_id);
+     gct = (grok_capture *)grok_capture_get_by_id(grok, capture_id);
+     assert(gct != NULL);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/grok.git/commitdiff/490e90bcc3147d1334b86729eae4e3cce70623db



More information about the pld-cvs-commit mailing list