new file mode 100644
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Weidmüller Interface GmbH & Co. KG
+# Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
+#
+"""Bintool implementation for lzop
+
+lzop allows compression and decompression of files.
+
+Documentation is available via::
+
+ man lzop
+"""
+
+from binman import bintool
+
+# pylint: disable=C0103
+class Bintoollzop(bintool.BintoolPacker):
+ """Compression/decompression using the lzop algorithm
+
+ This bintool supports running `lzop` to compress and decompress data, as
+ used by binman.
+
+ It is also possible to fetch the tool, which uses `apt` to install it.
+
+ Documentation is available via::
+
+ man lzop
+ """
+ def __init__(self, name):
+ super().__init__(name, 'lzo', compress_args=[])
@@ -11,12 +11,12 @@ from binman import bintool
from patman import tools
# Supported compressions
-COMPRESSIONS = ['bzip2', 'gzip', 'lz4', 'lzma']
+COMPRESSIONS = ['bzip2', 'gzip', 'lz4', 'lzma', 'lzo']
bintools = {}
def _get_tool_name(algo):
- names = {'lzma': 'lzma_alone'}
+ names = {'lzma': 'lzma_alone', 'lzo': 'lzop'}
return names.get(algo, algo)
def _get_tool(algo):
@@ -34,13 +34,14 @@ def compress(indata, algo):
Note that for lzma this uses an old version of the algorithm, not that
provided by xz.
- This requires 'bzip2', 'gzip', 'lz4' and 'lzma_alone' tools. It also
- requires an output directory to be previously set up, by calling
+ This requires 'bzip2', 'gzip', 'lz4', 'lzma_alone' and 'lzop' tools. It
+ also requires an output directory to be previously set up, by calling
PrepareOutputDir().
Args:
indata (bytes): Input data to compress
- algo (str): Algorithm to use ('none', 'bzip2', 'gzip', 'lz4' or 'lzma')
+ algo (str): Algorithm to use ('none', 'bzip2', 'gzip', 'lz4', 'lzma' or
+ 'lzo')
Returns:
bytes: Compressed data
@@ -61,13 +62,14 @@ def decompress(indata, algo):
Note that for lzma this uses an old version of the algorithm, not that
provided by xz.
- This requires 'bzip2', 'gzip', 'lz4' and 'lzma_alone' tools. It also
- requires an output directory to be previously set up, by calling
+ This requires 'bzip2', 'gzip', 'lz4', 'lzma_alone' and 'lzop' tools. It
+ also requires an output directory to be previously set up, by calling
PrepareOutputDir().
Args:
indata (bytes): Input data to decompress
- algo (str): Algorithm to use ('none', 'bzip2', 'gzip', 'lz4' or 'lzma')
+ algo (str): Algorithm to use ('none', 'bzip2', 'gzip', 'lz4', 'lzma' or
+ 'lzo')
Returns:
(bytes) Compressed data