Compare commits
10 Commits
503ce7bb81
...
56b71bb61a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56b71bb61a | ||
|
|
0fae1e49fd | ||
|
|
41ebdd895b | ||
|
|
5d244b47db | ||
|
|
fed64f1b5e | ||
|
|
18456bfc78 | ||
|
|
8744c09493 | ||
|
|
da5d1e6d54 | ||
|
|
476d51fc0a | ||
|
|
14edb952ee |
108
Remove-broken-agrep-test-entry.patch
Normal file
108
Remove-broken-agrep-test-entry.patch
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
From 35f61f40d6b68928ca5d409fa9fc204ea77e2199 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Vogt <fvogt@suse.de>
|
||||||
|
Date: Tue, 11 Oct 2022 11:35:53 +0200
|
||||||
|
Subject: [PATCH] Remove broken agrep test entry
|
||||||
|
|
||||||
|
It's meant to cause agrep to return with exit code 2, but asserts that it's
|
||||||
|
exit code 1 instead.
|
||||||
|
|
||||||
|
It's meant to ensure that using ".*" as pattern results in exit code 2 because
|
||||||
|
it matches also an empty string. However, glob expansion results in ".*"
|
||||||
|
picking up files such as "." and ".." from the CWD, which get interpreted as
|
||||||
|
valid pattern. This results in exit status 1 (no match found) which is what
|
||||||
|
the .ok file expects, but that's invalid.
|
||||||
|
|
||||||
|
With bash 5.2, glob expansion no longer matches "." and ".." by default, so
|
||||||
|
the test works as intended by accident, causing a mismatch with the expected
|
||||||
|
wrong exit code.
|
||||||
|
|
||||||
|
It's unfortunately not easily possible to avoid glob expansion in this case.
|
||||||
|
|
||||||
|
Just remove the test for now.
|
||||||
|
---
|
||||||
|
tests/agrep/exitstatus.args | 1 -
|
||||||
|
tests/agrep/exitstatus.ok | 61 -------------------------------------
|
||||||
|
2 files changed, 62 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/agrep/exitstatus.args b/tests/agrep/exitstatus.args
|
||||||
|
index 808ae77..2f53e97 100644
|
||||||
|
--- a/tests/agrep/exitstatus.args
|
||||||
|
+++ b/tests/agrep/exitstatus.args
|
||||||
|
@@ -5,6 +5,5 @@ this-wont-be-found
|
||||||
|
.
|
||||||
|
-v .
|
||||||
|
# Some errors which should give exit status 2.
|
||||||
|
--d .* dummy
|
||||||
|
-d {1 dummy
|
||||||
|
\
|
||||||
|
diff --git a/tests/agrep/exitstatus.ok b/tests/agrep/exitstatus.ok
|
||||||
|
index 28427bb..bd23b4c 100644
|
||||||
|
--- a/tests/agrep/exitstatus.ok
|
||||||
|
+++ b/tests/agrep/exitstatus.ok
|
||||||
|
@@ -521,67 +521,6 @@ Exit status 1.
|
||||||
|
Exit status 1.
|
||||||
|
#### TEST: agrep -H -n -s --color --show-position -v . < exitstatus.in
|
||||||
|
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -d .* dummy exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -d .* dummy < exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -c -d .* dummy exitstatus.in
|
||||||
|
-exitstatus.in:0
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -c -d .* dummy < exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -H -d .* dummy exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -H -d .* dummy < exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -l -d .* dummy exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -l -d .* dummy < exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -n -d .* dummy exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -n -d .* dummy < exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -s -d .* dummy exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -s -d .* dummy < exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -M -d .* dummy exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -M -d .* dummy < exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep --show-position -d .* dummy exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep --show-position -d .* dummy < exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep --color -d .* dummy exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep --color -d .* dummy < exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -H -n -s --color --show-position -d .* dummy exitstatus.in
|
||||||
|
-
|
||||||
|
-Exit status 1.
|
||||||
|
-#### TEST: agrep -H -n -s --color --show-position -d .* dummy < exitstatus.in
|
||||||
|
-
|
||||||
|
Exit status 1.
|
||||||
|
#### TEST: agrep -d {1 dummy exitstatus.in
|
||||||
36
tre-CVE-2016-8859.patch
Normal file
36
tre-CVE-2016-8859.patch
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
diff -up tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-match-parallel.c.CVE-2016-8859 tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-match-parallel.c
|
||||||
|
--- tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-match-parallel.c.CVE-2016-8859 2014-02-28 19:55:36.000000000 +0100
|
||||||
|
+++ tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-match-parallel.c 2016-11-02 22:07:41.984468354 +0100
|
||||||
|
@@ -59,6 +59,9 @@ char *alloca ();
|
||||||
|
#ifdef HAVE_MALLOC_H
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif /* HAVE_MALLOC_H */
|
||||||
|
+#ifdef HAVE_STDINT_H
|
||||||
|
+#include <stdint.h>
|
||||||
|
+#endif /* HAVE_STDINT_H */
|
||||||
|
|
||||||
|
#include "tre-internal.h"
|
||||||
|
#include "tre-match-utils.h"
|
||||||
|
@@ -153,7 +156,7 @@ tre_tnfa_run_parallel(const tre_tnfa_t *
|
||||||
|
everything in a single large block from the stack frame using alloca()
|
||||||
|
or with malloc() if alloca is unavailable. */
|
||||||
|
{
|
||||||
|
- int tbytes, rbytes, pbytes, xbytes, total_bytes;
|
||||||
|
+ size_t tbytes, rbytes, pbytes, xbytes, total_bytes;
|
||||||
|
char *tmp_buf;
|
||||||
|
/* Compute the length of the block we need. */
|
||||||
|
tbytes = sizeof(*tmp_tags) * num_tags;
|
||||||
|
@@ -168,11 +171,11 @@ tre_tnfa_run_parallel(const tre_tnfa_t *
|
||||||
|
#ifdef TRE_USE_ALLOCA
|
||||||
|
buf = alloca(total_bytes);
|
||||||
|
#else /* !TRE_USE_ALLOCA */
|
||||||
|
- buf = xmalloc((unsigned)total_bytes);
|
||||||
|
+ buf = xmalloc(total_bytes);
|
||||||
|
#endif /* !TRE_USE_ALLOCA */
|
||||||
|
if (buf == NULL)
|
||||||
|
return REG_ESPACE;
|
||||||
|
- memset(buf, 0, (size_t)total_bytes);
|
||||||
|
+ memset(buf, 0, total_bytes);
|
||||||
|
|
||||||
|
/* Get the various pointers within tmp_buf (properly aligned). */
|
||||||
|
tmp_tags = (void *)buf;
|
||||||
BIN
tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca.tar.gz
Normal file
BIN
tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca.tar.gz
Normal file
Binary file not shown.
21
tre-chicken.patch
Normal file
21
tre-chicken.patch
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
diff -up tre-0.8.0/python/setup.py.chicken tre-0.8.0/python/setup.py
|
||||||
|
--- tre-0.8.0/python/setup.py.chicken 2009-09-20 09:51:01.000000000 +0200
|
||||||
|
+++ tre-0.8.0/python/setup.py 2009-09-20 15:43:45.000000000 +0200
|
||||||
|
@@ -10,7 +10,8 @@ import shutil
|
||||||
|
|
||||||
|
version = "0.8.0"
|
||||||
|
data_files = []
|
||||||
|
-include_dirs = ["../lib"]
|
||||||
|
+include_dirs = ["../include"]
|
||||||
|
+library_dirs = ["../lib/.libs"]
|
||||||
|
libraries = ["tre"]
|
||||||
|
|
||||||
|
if sys.platform == "win32":
|
||||||
|
@@ -31,6 +32,7 @@ setup(name = "tre",
|
||||||
|
sources = ["tre-python.c"],
|
||||||
|
define_macros = [("HAVE_CONFIG_H", None)],
|
||||||
|
include_dirs = include_dirs,
|
||||||
|
+ library_dirs = library_dirs,
|
||||||
|
libraries = libraries
|
||||||
|
),
|
||||||
|
],
|
||||||
12
tre-issue37.patch
Normal file
12
tre-issue37.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff -up tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-parse.c.issue37 tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-parse.c
|
||||||
|
--- tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-parse.c.issue37 2014-02-28 19:55:36.000000000 +0100
|
||||||
|
+++ tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-parse.c 2016-11-02 21:01:51.705351218 +0100
|
||||||
|
@@ -1480,6 +1480,8 @@ tre_parse(tre_parse_ctx_t *ctx)
|
||||||
|
ctx->re++;
|
||||||
|
while (ctx->re_end - ctx->re >= 0)
|
||||||
|
{
|
||||||
|
+ if (i == sizeof(tmp))
|
||||||
|
+ return REG_EBRACE;
|
||||||
|
if (ctx->re[0] == CHAR_RBRACE)
|
||||||
|
break;
|
||||||
|
if (tre_isxdigit(ctx->re[0]))
|
||||||
12
tre-issue50.patch
Normal file
12
tre-issue50.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff -up tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-parse.c.issue50 tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-parse.c
|
||||||
|
--- tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-parse.c.issue50 2019-02-23 17:36:40.940463693 +0100
|
||||||
|
+++ tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-parse.c 2019-02-23 18:40:41.111544430 +0100
|
||||||
|
@@ -1341,7 +1341,7 @@ tre_parse(tre_parse_ctx_t *ctx)
|
||||||
|
|
||||||
|
case CHAR_RPAREN: /* end of current subexpression */
|
||||||
|
if ((ctx->cflags & REG_EXTENDED && depth > 0)
|
||||||
|
- || (ctx->re > ctx->re_start
|
||||||
|
+ || (!(ctx->cflags & REG_EXTENDED) && ctx->re > ctx->re_start
|
||||||
|
&& *(ctx->re - 1) == CHAR_BACKSLASH))
|
||||||
|
{
|
||||||
|
DPRINT(("tre_parse: empty: '%.*" STRF "'\n",
|
||||||
10
tre-ldflags.patch
Normal file
10
tre-ldflags.patch
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
diff -up tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/tre.pc.in.ldflags tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/tre.pc.in
|
||||||
|
--- tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/tre.pc.in.ldflags 2014-02-28 19:55:36.000000000 +0100
|
||||||
|
+++ tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/tre.pc.in 2015-06-08 22:55:39.316078801 +0200
|
||||||
|
@@ -6,5 +6,5 @@ includedir=@includedir@
|
||||||
|
Name: TRE
|
||||||
|
Description: TRE regexp matching library
|
||||||
|
Version: @PACKAGE_VERSION@
|
||||||
|
-Libs: -L${libdir} -ltre @LDFLAGS@ @LIBINTL@ @LIBS@
|
||||||
|
+Libs: -L${libdir} -ltre @LIBINTL@ @LIBS@
|
||||||
|
Cflags: -I${includedir} @CPPFLAGS@
|
||||||
193
tre-python3.patch
Normal file
193
tre-python3.patch
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
diff -up tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/python/example.py.py3 tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/python/example.py
|
||||||
|
--- tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/python/example.py.py3 2014-02-28 19:55:36.000000000 +0100
|
||||||
|
+++ tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/python/example.py 2019-02-24 00:13:35.372854041 +0100
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
import tre
|
||||||
|
|
||||||
|
fz = tre.Fuzzyness(maxerr = 3)
|
||||||
|
-print fz
|
||||||
|
+print (fz)
|
||||||
|
|
||||||
|
pt = tre.compile("Don(ald( Ervin)?)? Knuth", tre.EXTENDED)
|
||||||
|
data = """
|
||||||
|
@@ -16,5 +16,5 @@ typefaces.
|
||||||
|
m = pt.search(data, fz)
|
||||||
|
|
||||||
|
if m:
|
||||||
|
- print m.groups()
|
||||||
|
- print m[0]
|
||||||
|
+ print (m.groups())
|
||||||
|
+ print (m[0])
|
||||||
|
diff -up tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/python/tre-python.c.py3 tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/python/tre-python.c
|
||||||
|
--- tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/python/tre-python.c.py3 2014-02-28 19:55:36.000000000 +0100
|
||||||
|
+++ tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/python/tre-python.c 2019-02-24 00:13:35.373854053 +0100
|
||||||
|
@@ -86,9 +86,9 @@ TreFuzzyness_repr(PyObject *obj)
|
||||||
|
TreFuzzynessObject *self = (TreFuzzynessObject*)obj;
|
||||||
|
PyObject *o;
|
||||||
|
|
||||||
|
- o = PyString_FromFormat("%s(delcost=%d,inscost=%d,maxcost=%d,subcost=%d,"
|
||||||
|
+ o = PyUnicode_FromFormat("%s(delcost=%d,inscost=%d,maxcost=%d,subcost=%d,"
|
||||||
|
"maxdel=%d,maxerr=%d,maxins=%d,maxsub=%d)",
|
||||||
|
- self->ob_type->tp_name, self->ap.cost_del,
|
||||||
|
+ Py_TYPE(self)->tp_name, self->ap.cost_del,
|
||||||
|
self->ap.cost_ins, self->ap.max_cost,
|
||||||
|
self->ap.cost_subst, self->ap.max_del,
|
||||||
|
self->ap.max_err, self->ap.max_ins,
|
||||||
|
@@ -118,8 +118,7 @@ static PyMemberDef TreFuzzyness_members[
|
||||||
|
};
|
||||||
|
|
||||||
|
static PyTypeObject TreFuzzynessType = {
|
||||||
|
- PyObject_HEAD_INIT(NULL)
|
||||||
|
- 0, /* ob_size */
|
||||||
|
+ PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
|
TRE_MODULE ".Fuzzyness", /* tp_name */
|
||||||
|
sizeof(TreFuzzynessObject), /* tp_basicsize */
|
||||||
|
0, /* tp_itemsize */
|
||||||
|
@@ -193,7 +192,7 @@ PyTreMatch_groups(TreMatchObject *self,
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
-PyTreMatch_groupi(PyObject *obj, int gn)
|
||||||
|
+PyTreMatch_groupi(PyObject *obj, Py_ssize_t gn)
|
||||||
|
{
|
||||||
|
TreMatchObject *self = (TreMatchObject*)obj;
|
||||||
|
PyObject *result;
|
||||||
|
@@ -220,7 +219,7 @@ PyTreMatch_group(TreMatchObject *self, P
|
||||||
|
PyObject *result;
|
||||||
|
long gn;
|
||||||
|
|
||||||
|
- gn = PyInt_AsLong(grpno);
|
||||||
|
+ gn = PyLong_AsLong(grpno);
|
||||||
|
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
@@ -277,8 +276,7 @@ static PySequenceMethods TreMatch_as_seq
|
||||||
|
};
|
||||||
|
|
||||||
|
static PyTypeObject TreMatchType = {
|
||||||
|
- PyObject_HEAD_INIT(NULL)
|
||||||
|
- 0, /* ob_size */
|
||||||
|
+ PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
|
TRE_MODULE ".Match", /* tp_name */
|
||||||
|
sizeof(TreMatchObject), /* tp_basicsize */
|
||||||
|
0, /* tp_itemsize */
|
||||||
|
@@ -380,8 +378,8 @@ PyTrePattern_search(TrePatternObject *se
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- targ = PyString_AsString(pstring);
|
||||||
|
- tlen = PyString_Size(pstring);
|
||||||
|
+ targ = PyBytes_AsString(pstring);
|
||||||
|
+ tlen = PyBytes_Size(pstring);
|
||||||
|
|
||||||
|
rc = tre_reganexec(&self->rgx, targ, tlen, &mo->am, fz->ap, eflags);
|
||||||
|
}
|
||||||
|
@@ -433,8 +431,7 @@ PyTrePattern_dealloc(TrePatternObject *s
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyTypeObject TrePatternType = {
|
||||||
|
- PyObject_HEAD_INIT(NULL)
|
||||||
|
- 0, /* ob_size */
|
||||||
|
+ PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
|
TRE_MODULE ".Pattern", /* tp_name */
|
||||||
|
sizeof(TrePatternObject), /* tp_basicsize */
|
||||||
|
0, /* tp_itemsize */
|
||||||
|
@@ -467,7 +464,7 @@ static PyTypeObject TrePatternType = {
|
||||||
|
};
|
||||||
|
|
||||||
|
static TrePatternObject *
|
||||||
|
-newTrePatternObject()
|
||||||
|
+newTrePatternObject(void)
|
||||||
|
{
|
||||||
|
TrePatternObject *self;
|
||||||
|
|
||||||
|
@@ -482,7 +479,7 @@ static PyObject *
|
||||||
|
PyTre_ncompile(PyObject *self, PyObject *args)
|
||||||
|
{
|
||||||
|
TrePatternObject *rv;
|
||||||
|
- PyUnicodeObject *upattern = NULL;
|
||||||
|
+ PyObject *upattern = NULL;
|
||||||
|
char *pattern = NULL;
|
||||||
|
int pattlen;
|
||||||
|
int cflags = 0;
|
||||||
|
@@ -537,9 +534,8 @@ static PyMethodDef tre_methods[] = {
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
-static char *tre_doc =
|
||||||
|
-"Python module for TRE library\n\nModule exports "
|
||||||
|
-"the only function: compile";
|
||||||
|
+
|
||||||
|
+#define tre_doc "Python module for TRE library\n\nModule exports the only function: compile"
|
||||||
|
|
||||||
|
static struct _tre_flags {
|
||||||
|
char *name;
|
||||||
|
@@ -556,40 +552,57 @@ static struct _tre_flags {
|
||||||
|
{ NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
+
|
||||||
|
+static struct PyModuleDef moduledef = {
|
||||||
|
+ PyModuleDef_HEAD_INIT,
|
||||||
|
+ TRE_MODULE ".Module", /* m_name */
|
||||||
|
+ tre_doc, /* m_doc */
|
||||||
|
+ -1, /* m_size */
|
||||||
|
+ tre_methods, /* m_methods */
|
||||||
|
+ NULL, /* m_reload */
|
||||||
|
+ NULL, /* m_traverse */
|
||||||
|
+ NULL, /* m_clear */
|
||||||
|
+ NULL, /* m_free */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+
|
||||||
|
PyMODINIT_FUNC
|
||||||
|
-inittre(void)
|
||||||
|
+PyInit_tre(void)
|
||||||
|
{
|
||||||
|
PyObject *m;
|
||||||
|
struct _tre_flags *fp;
|
||||||
|
|
||||||
|
if (PyType_Ready(&TreFuzzynessType) < 0)
|
||||||
|
- return;
|
||||||
|
+ return NULL;
|
||||||
|
if (PyType_Ready(&TreMatchType) < 0)
|
||||||
|
- return;
|
||||||
|
+ return NULL;
|
||||||
|
if (PyType_Ready(&TrePatternType) < 0)
|
||||||
|
- return;
|
||||||
|
+ return NULL;
|
||||||
|
|
||||||
|
/* Create the module and add the functions */
|
||||||
|
- m = Py_InitModule3(TRE_MODULE, tre_methods, tre_doc);
|
||||||
|
+
|
||||||
|
+ m = PyModule_Create (&moduledef);
|
||||||
|
+
|
||||||
|
if (m == NULL)
|
||||||
|
- return;
|
||||||
|
+ return NULL;
|
||||||
|
|
||||||
|
Py_INCREF(&TreFuzzynessType);
|
||||||
|
if (PyModule_AddObject(m, "Fuzzyness", (PyObject*)&TreFuzzynessType) < 0)
|
||||||
|
- return;
|
||||||
|
+ return NULL;
|
||||||
|
Py_INCREF(&TreMatchType);
|
||||||
|
if (PyModule_AddObject(m, "Match", (PyObject*)&TreMatchType) < 0)
|
||||||
|
- return;
|
||||||
|
+ return NULL;
|
||||||
|
Py_INCREF(&TrePatternType);
|
||||||
|
if (PyModule_AddObject(m, "Pattern", (PyObject*)&TrePatternType) < 0)
|
||||||
|
- return;
|
||||||
|
+ return NULL;
|
||||||
|
ErrorObject = PyErr_NewException(TRE_MODULE ".Error", NULL, NULL);
|
||||||
|
Py_INCREF(ErrorObject);
|
||||||
|
if (PyModule_AddObject(m, "Error", ErrorObject) < 0)
|
||||||
|
- return;
|
||||||
|
+ return NULL;
|
||||||
|
|
||||||
|
/* Insert the flags */
|
||||||
|
for (fp = tre_flags; fp->name != NULL; fp++)
|
||||||
|
if (PyModule_AddIntConstant(m, fp->name, fp->val) < 0)
|
||||||
|
- return;
|
||||||
|
+ return NULL;
|
||||||
|
+ return m;
|
||||||
|
}
|
||||||
11
tre-tests.patch
Normal file
11
tre-tests.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
diff -up tre-0.7.6/tests/agrep/run-tests.sh.tests tre-0.7.6/tests/agrep/run-tests.sh
|
||||||
|
--- tre-0.7.6/tests/agrep/run-tests.sh.tests 2009-03-11 10:44:44.000000000 +0100
|
||||||
|
+++ tre-0.7.6/tests/agrep/run-tests.sh 2009-08-22 20:20:15.885084058 +0200
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
+export LD_LIBRARY_PATH=$top_builddir/lib/.libs
|
||||||
|
agrep="$top_builddir/src/agrep"
|
||||||
|
|
||||||
|
echo "$builddir $top_builddir $srcdir"
|
||||||
125
tre.spec
Normal file
125
tre.spec
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
%global commit c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca
|
||||||
|
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||||
|
Name: tre
|
||||||
|
Version: 0.8.0
|
||||||
|
Release: 5
|
||||||
|
License: BSD-2-Clause
|
||||||
|
Source0: https://github.com/laurikari/tre/archive/%{commit}/tre-%{commit}.tar.gz
|
||||||
|
Patch0: %{name}-chicken.patch
|
||||||
|
Patch1: %{name}-tests.patch
|
||||||
|
Patch2: %{name}-ldflags.patch
|
||||||
|
Patch3: %{name}-CVE-2016-8859.patch
|
||||||
|
Patch4: %{name}-issue37.patch
|
||||||
|
Patch5: %{name}-issue50.patch
|
||||||
|
Patch10: %{name}-python3.patch
|
||||||
|
Patch11: Remove-broken-agrep-test-entry.patch
|
||||||
|
|
||||||
|
Summary: POSIX compatible regexp library with approximate matching
|
||||||
|
URL: http://laurikari.net/tre/
|
||||||
|
BuildRequires: gettext-devel glibc-langpack-en libtool python3-devel glibc-all-langpacks
|
||||||
|
Requires: %{name}-common = %{version}-%{release}
|
||||||
|
%description
|
||||||
|
TRE is a lightweight, robust, and efficient POSIX compatible regexp
|
||||||
|
matching library with some exciting features such as approximate
|
||||||
|
matching.
|
||||||
|
|
||||||
|
%package common
|
||||||
|
Summary: Cross-platform files for use with the tre package
|
||||||
|
BuildArch: noarch
|
||||||
|
%description common
|
||||||
|
This package contains platform-agnostic files used by the TRE
|
||||||
|
library.
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Requires: tre = %{version}-%{release}
|
||||||
|
Summary: Development files for use with the tre package
|
||||||
|
%description devel
|
||||||
|
This package contains header files and static libraries for use when
|
||||||
|
building applications which use the TRE library.
|
||||||
|
|
||||||
|
%package -n python3-%{name}
|
||||||
|
Summary: Python bindings for the tre library
|
||||||
|
%{?python_provide:%python_provide python3-tre}
|
||||||
|
%description -n python3-%{name}
|
||||||
|
This package contains the python bindings for the TRE library.
|
||||||
|
|
||||||
|
%package -n agrep
|
||||||
|
Summary: Approximate grep utility
|
||||||
|
%description -n agrep
|
||||||
|
The agrep tool is similar to the commonly used grep utility, but agrep
|
||||||
|
can be used to search for approximate matches.
|
||||||
|
The agrep tool searches text input for lines (or records separated by
|
||||||
|
strings matching arbitrary regexps) that contain an approximate, or
|
||||||
|
fuzzy, match to a specified regexp, and prints the matching lines.
|
||||||
|
Limits can be set on how many errors of each kind are allowed, or
|
||||||
|
only the best matching lines can be output.
|
||||||
|
Unlike other agrep implementations, TRE agrep allows full POSIX
|
||||||
|
regexps of any length, any number of errors, and non-uniform costs.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n tre-%{commit}
|
||||||
|
%patch0 -p1 -b .chicken
|
||||||
|
%patch1 -p1 -b .tests
|
||||||
|
%patch2 -p1 -b .ldflags
|
||||||
|
%patch3 -p1 -b .CVE-2016-8859
|
||||||
|
%patch4 -p1 -b .issue37
|
||||||
|
%patch5 -p1 -b .issue50
|
||||||
|
%patch10 -p1
|
||||||
|
%patch11 -p1
|
||||||
|
touch ChangeLog
|
||||||
|
autoreconf -vif
|
||||||
|
|
||||||
|
%build
|
||||||
|
%configure --disable-static --disable-rpath
|
||||||
|
%{__make} %{?_smp_mflags}
|
||||||
|
pushd python
|
||||||
|
%py3_build
|
||||||
|
popd
|
||||||
|
|
||||||
|
%install
|
||||||
|
%{__make} install DESTDIR=$RPM_BUILD_ROOT
|
||||||
|
pushd python
|
||||||
|
%py3_install
|
||||||
|
popd
|
||||||
|
rm $RPM_BUILD_ROOT%{_libdir}/*.la
|
||||||
|
%find_lang %{name}
|
||||||
|
|
||||||
|
%check
|
||||||
|
%{__make} check
|
||||||
|
%ldconfig_scriptlets
|
||||||
|
|
||||||
|
%files
|
||||||
|
%{_libdir}/libtre.so.*
|
||||||
|
|
||||||
|
%files common -f %{name}.lang
|
||||||
|
%doc AUTHORS ChangeLog LICENSE NEWS README THANKS TODO
|
||||||
|
%doc doc/*.html doc/*.css
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%{_libdir}/libtre.so
|
||||||
|
%{_libdir}/pkgconfig/*
|
||||||
|
%{_includedir}/*
|
||||||
|
|
||||||
|
%files -n python3-%{name}
|
||||||
|
%attr(0755,root,root) %{python3_sitearch}/tre.cpython-%{python3_version_nodots}*-%{_arch}-linux%{_gnu}.so
|
||||||
|
%{python3_sitearch}/tre-%{version}-py%{python3_version}.egg-info
|
||||||
|
|
||||||
|
%files -n agrep
|
||||||
|
%{_bindir}/agrep
|
||||||
|
%{_mandir}/man1/agrep.1*
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Thu Jun 06 2024 Wenlong Zhang <zhangwenlong@loongson.cn> - 0.8.0-5
|
||||||
|
- fix build error for loongarch64
|
||||||
|
|
||||||
|
* Sat Jul 22 2023 xu_ping <707078654@qq.com> - 0.8.0-4
|
||||||
|
- Fix test failure
|
||||||
|
|
||||||
|
* Mon Nov 14 2022 huajingyun <huajingyun@loongson.cn> - 0.8.0-3
|
||||||
|
- Fix build error on loongarch
|
||||||
|
|
||||||
|
* Tue May 10 2022 caodongxia <caodongxia@h-partners.com> - 0.8.0-2
|
||||||
|
- License compliance rectification
|
||||||
|
|
||||||
|
* Wed May 12 2021 zhangtao <zhangtao307@huawei.com> - 0.8.0-1
|
||||||
|
- package init
|
||||||
Loading…
x
Reference in New Issue
Block a user