Skip to content
Snippets Groups Projects
Commit 104bf8bb authored by Luca Boccassi's avatar Luca Boccassi
Browse files

Backport patches and bump version constraints for zstd 1.5.7

Closes: #1100475
parent 3de1c4c6
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ Uploaders: ...@@ -7,7 +7,7 @@ Uploaders:
Build-Depends: Build-Depends:
debhelper-compat (= 13), debhelper-compat (= 13),
dh-sequence-python3, dh-sequence-python3,
libzstd-dev (>= 1.5.6~), libzstd-dev (>= 1.5.7~),
python3-all-dev, python3-all-dev,
python3-cffi (>= 1.16.0~), python3-cffi (>= 1.16.0~),
python3-setuptools, python3-setuptools,
...@@ -28,8 +28,8 @@ Depends: ...@@ -28,8 +28,8 @@ Depends:
${python3:Depends}, ${python3:Depends},
${shlibs:Depends}, ${shlibs:Depends},
# Temporarily force libzstd1 version requirement # Temporarily force libzstd1 version requirement
libzstd1 (>= 1.5.6~), libzstd1 (>= 1.5.7~),
libzstd1 (<< 1.5.7~), libzstd1 (<< 1.5.8~),
Suggests: Suggests:
python-zstandard-doc, python-zstandard-doc,
Description: Python bindings for interfacing with Zstandard library Description: Python bindings for interfacing with Zstandard library
......
Author: Bernhard M. Wiedemann <bwiedemann@suse.de>
Description: use zstd-1.5.7
Forwarded: https://github.com/indygreg/python-zstandard/pull/255
--- a/c-ext/backend_c.c
+++ b/c-ext/backend_c.c
@@ -152,7 +152,7 @@
PyObject *features = NULL;
PyObject *feature = NULL;
unsigned zstd_ver_no = ZSTD_versionNumber();
- unsigned our_hardcoded_version = 10506;
+ unsigned our_hardcoded_version = 10507;
if (ZSTD_VERSION_NUMBER != our_hardcoded_version ||
zstd_ver_no != our_hardcoded_version) {
PyErr_Format(
--- a/tests/test_compressor_compress.py
+++ b/tests/test_compressor_compress.py
@@ -52,7 +52,7 @@
cctx = zstd.ZstdCompressor(level=3, write_content_size=False)
result = cctx.compress(b"".join(chunks))
- self.assertEqual(len(result), 999)
+ self.assertEqual(len(result), 1029)
self.assertEqual(result[0:4], b"\x28\xb5\x2f\xfd")
# This matches the test for read_to_iter() below.
--- a/tests/test_compressor_compressobj.py
+++ b/tests/test_compressor_compressobj.py
@@ -39,7 +39,7 @@
cobj = cctx.compressobj()
result = cobj.compress(b"".join(chunks)) + cobj.flush()
- self.assertEqual(len(result), 999)
+ self.assertEqual(len(result), 1029)
self.assertEqual(result[0:4], b"\x28\xb5\x2f\xfd")
params = zstd.get_frame_parameters(result)
--- a/tests/test_compressor_copy_stream.py
+++ b/tests/test_compressor_copy_stream.py
@@ -50,7 +50,7 @@
r, w = cctx.copy_stream(source, dest)
self.assertEqual(r, 255 * 16384)
- self.assertEqual(w, 999)
+ self.assertEqual(w, 1029)
params = zstd.get_frame_parameters(dest.getvalue())
self.assertEqual(params.content_size, zstd.CONTENTSIZE_UNKNOWN)
--- a/tests/test_compressor_stream_writer.py
+++ b/tests/test_compressor_stream_writer.py
@@ -301,7 +301,7 @@
d = zstd.train_dictionary(8192, samples)
h = hashlib.sha1(d.as_bytes()).hexdigest()
- self.assertEqual(h, "a46d2f7a3bc3357c9d717d3dadf9a26fde23e93d")
+ self.assertEqual(h, "f32ddfbe0878bbd428afc00b17810387c6752191")
buffer = io.BytesIO()
cctx = zstd.ZstdCompressor(level=9, dict_data=d)
--- a/tests/test_module_attributes.py
+++ b/tests/test_module_attributes.py
@@ -5,7 +5,7 @@
class TestModuleAttributes(unittest.TestCase):
def test_version(self):
- self.assertEqual(zstd.ZSTD_VERSION, (1, 5, 6))
+ self.assertEqual(zstd.ZSTD_VERSION, (1, 5, 7))
self.assertEqual(zstd.__version__, "0.23.0")
This diff is collapsed.
Author: Michał Górny <mgorny@gentoo.org>
Description: update make_cffi.py to skip type alias macros in zstd 1.5.7
Forwarded: https://github.com/indygreg/python-zstandard/pull/255
--- a/make_cffi.py
+++ b/make_cffi.py
@@ -179,7 +179,7 @@
include_dirs=INCLUDE_DIRS,
)
-DEFINE = re.compile(b"^\\#define ([a-zA-Z0-9_]+) ")
+DEFINE = re.compile(rb"^#define\s+([a-zA-Z0-9_]+)\s+(\S+)")
sources = []
@@ -204,9 +204,14 @@
if m.group(1) in (b"ZSTD_LIB_VERSION", b"ZSTD_VERSION_STRING"):
continue
+ # These defines create aliases from old (camelCase) type names
+ # to the new PascalCase names, which breaks CFFI.
+ if m.group(1).lower() == m.group(2).lower():
+ continue
+
# The ... is magic syntax by the cdef parser to resolve the
# value at compile time.
- sources.append(m.group(0) + b" ...")
+ sources.append(b"#define " + m.group(1) + b" ...")
cdeflines = b"\n".join(sources).splitlines()
cdeflines = [l for l in cdeflines if l.strip()]
Author: Michał Górny <mgorny@gentoo.org>
Description: update backend_cffi for new type names in zstd 1.5.7
Forwarded: https://github.com/indygreg/python-zstandard/pull/255
--- a/zstandard/backend_cffi.py
+++ b/zstandard/backend_cffi.py
@@ -2574,7 +2574,7 @@
:return:
:py:class:`FrameParameters`
"""
- params = ffi.new("ZSTD_frameHeader *")
+ params = ffi.new("ZSTD_FrameHeader *")
data_buffer = ffi.from_buffer(data)
zresult = lib.ZSTD_getFrameHeader(params, data_buffer, len(data_buffer))
@@ -4289,7 +4289,7 @@
# All chunks should be zstd frames and should have content size set.
chunk_buffer = ffi.from_buffer(chunk)
- params = ffi.new("ZSTD_frameHeader *")
+ params = ffi.new("ZSTD_FrameHeader *")
zresult = lib.ZSTD_getFrameHeader(
params, chunk_buffer, len(chunk_buffer)
)
0001-Use-system-zstd-by-default.patch 0001-Use-system-zstd-by-default.patch
0002-Disable-test_features.patch 0002-Disable-test_features.patch
0003-use-zstd-1.5.7.patch
0004-update-vendored-zstd-1.5.7.patch
0005-update-make-cffi-zstd-1.5.7.patch
0006-update-backend-cffi-zstd-1.5.7.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment