fix lz4 deprecation warning, require lz4 >= 1.7.0 (r129)

as we bundle lz4 1.8.0 now, platforms not having a recent liblz4 can
now just use the bundled code.

(cherry picked from commit fe48caf853)
This commit is contained in:
Thomas Waldmann 2017-12-15 07:08:06 +01:00
parent 83603acd48
commit 21ba3ff63c
5 changed files with 7 additions and 7 deletions

View File

@ -141,7 +141,7 @@ following dependencies first:
optional install. optional install.
* OpenSSL_ >= 1.0.0, plus development headers. * OpenSSL_ >= 1.0.0, plus development headers.
* libacl_ (which depends on libattr_), both plus development headers. * libacl_ (which depends on libattr_), both plus development headers.
* liblz4_, plus development headers. * liblz4_ >= r129 (1.7.0), plus development headers.
* some Python dependencies, pip will automatically install them for you * some Python dependencies, pip will automatically install them for you
* optionally, the llfuse_ Python package is required if you wish to mount an * optionally, the llfuse_ Python package is required if you wish to mount an
archive as a FUSE filesystem. See setup.py about the version requirements. archive as a FUSE filesystem. See setup.py about the version requirements.

View File

@ -15,7 +15,7 @@ import textwrap
import setup_lz4 import setup_lz4
import setup_zstd import setup_zstd
# True: use the shared liblz4 (>= TBD) from the system, False: use the bundled lz4 code # True: use the shared liblz4 (>= 1.7.0 / r129) from the system, False: use the bundled lz4 code
prefer_system_liblz4 = True prefer_system_liblz4 = True
# True: use the shared libzstd (>= 1.3.0) from the system, False: use the bundled zstd code # True: use the shared libzstd (>= 1.3.0) from the system, False: use the bundled zstd code

View File

@ -25,7 +25,7 @@ def lz4_system_prefix(prefixes):
filename = os.path.join(prefix, 'include', 'lz4.h') filename = os.path.join(prefix, 'include', 'lz4.h')
if os.path.exists(filename): if os.path.exists(filename):
with open(filename, 'r') as fd: with open(filename, 'r') as fd:
if 'LZ4_decompress_safe' in fd.read(): if 'LZ4_compress_default' in fd.read(): # requires lz4 >= 1.7.0 (r129)
return prefix return prefix

View File

@ -25,10 +25,10 @@ except ImportError:
from .helpers import Buffer, DecompressionError from .helpers import Buffer, DecompressionError
API_VERSION = '1.1_05' API_VERSION = '1.1_06'
cdef extern from "algorithms/lz4-libselect.h": cdef extern from "algorithms/lz4-libselect.h":
int LZ4_compress_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize) nogil int LZ4_compress_default(const char* source, char* dest, int inputSize, int maxOutputSize) nogil
int LZ4_decompress_safe(const char* source, char* dest, int inputSize, int maxOutputSize) nogil int LZ4_decompress_safe(const char* source, char* dest, int inputSize, int maxOutputSize) nogil
int LZ4_compressBound(int inputSize) nogil int LZ4_compressBound(int inputSize) nogil
@ -138,7 +138,7 @@ class LZ4(CompressorBase):
osize = LZ4_compressBound(isize) osize = LZ4_compressBound(isize)
buf = buffer.get(osize) buf = buffer.get(osize)
dest = <char *> buf dest = <char *> buf
osize = LZ4_compress_limitedOutput(source, dest, isize, osize) osize = LZ4_compress_default(source, dest, isize, osize)
if not osize: if not osize:
raise Exception('lz4 compress failed') raise Exception('lz4 compress failed')
return super().compress(dest[:osize]) return super().compress(dest[:osize])

View File

@ -135,7 +135,7 @@ def check_extension_modules():
raise ExtensionModuleError raise ExtensionModuleError
if chunker.API_VERSION != '1.1_01': if chunker.API_VERSION != '1.1_01':
raise ExtensionModuleError raise ExtensionModuleError
if compress.API_VERSION != '1.1_05': if compress.API_VERSION != '1.1_06':
raise ExtensionModuleError raise ExtensionModuleError
if borg.crypto.low_level.API_VERSION != '1.1_02': if borg.crypto.low_level.API_VERSION != '1.1_02':
raise ExtensionModuleError raise ExtensionModuleError