瀏覽代碼

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

as we bundle lz4 1.8.0 now, platform not having a recent liblz4 can
now just use the bundled code.
Thomas Waldmann 7 年之前
父節點
當前提交
fe48caf853
共有 5 個文件被更改,包括 7 次插入7 次删除
  1. 1 1
      docs/installation.rst
  2. 1 1
      setup.py
  3. 1 1
      setup_lz4.py
  4. 3 3
      src/borg/compress.pyx
  5. 1 1
      src/borg/helpers/checks.py

+ 1 - 1
docs/installation.rst

@@ -141,7 +141,7 @@ following dependencies first:
   optional install.
 * OpenSSL_ >= 1.0.0, plus development headers.
 * libacl_ (which depends on libattr_), both plus development headers.
-* liblz4_, plus development headers.
+* liblz4_ >= r129 (1.7.0), plus development headers.
 * ZeroMQ_ >= 4.0.0, plus development headers.
 * some Python dependencies, pip will automatically install them for you
 * optionally, the llfuse_ Python package is required if you wish to mount an

+ 1 - 1
setup.py

@@ -15,7 +15,7 @@ import textwrap
 import setup_lz4
 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
 
 # True: use the shared libzstd (>= 1.3.0) from the system, False: use the bundled zstd code

+ 1 - 1
setup_lz4.py

@@ -25,7 +25,7 @@ def lz4_system_prefix(prefixes):
         filename = os.path.join(prefix, 'include', 'lz4.h')
         if os.path.exists(filename):
             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
 
 

+ 3 - 3
src/borg/compress.pyx

@@ -25,10 +25,10 @@ except ImportError:
 
 from .helpers import Buffer, DecompressionError
 
-API_VERSION = '1.1_05'
+API_VERSION = '1.1_06'
 
 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_compressBound(int inputSize) nogil
 
@@ -139,7 +139,7 @@ class LZ4(CompressorBase):
         buf = buffer.get(osize)
         dest = <char *> buf
         with nogil:
-            osize = LZ4_compress_limitedOutput(source, dest, isize, osize)
+            osize = LZ4_compress_default(source, dest, isize, osize)
         if not osize:
             raise Exception('lz4 compress failed')
         return super().compress(dest[:osize])

+ 1 - 1
src/borg/helpers/checks.py

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