From aee3ff266e8346a8a036cd1dbe0fc641005444d2 Mon Sep 17 00:00:00 2001 From: alexreuter <13192937+alexreuter@users.noreply.github.com> Date: Thu, 20 Oct 2022 15:54:45 -0400 Subject: [PATCH 1/2] Switch gzip to pigz --- ofrak_components/Dockerstub | 2 +- ofrak_components/ofrak_components/gzip.py | 2 +- ofrak_components/ofrak_components_test/test_gzip_component.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ofrak_components/Dockerstub b/ofrak_components/Dockerstub index c11c8a1a6..5618f9a9d 100644 --- a/ofrak_components/Dockerstub +++ b/ofrak_components/Dockerstub @@ -4,11 +4,11 @@ RUN apt-get -y update && \ build-essential \ cpio \ git \ - gzip \ liblz4-dev \ liblzo2-dev \ libzstd-dev \ lzop \ + pigz \ p7zip-full \ zip \ qemu \ diff --git a/ofrak_components/ofrak_components/gzip.py b/ofrak_components/ofrak_components/gzip.py index 921bd7abd..3976d0be1 100644 --- a/ofrak_components/ofrak_components/gzip.py +++ b/ofrak_components/ofrak_components/gzip.py @@ -40,7 +40,7 @@ async def unpack(self, resource: Resource, config=None): with tempfile.NamedTemporaryFile(suffix=".gz") as temp_file: temp_file.write(await resource.get_data()) temp_file.flush() - command = ["gzip", "-d", "-c", temp_file.name] # Decompress to stdout + command = ["pigz", "-d", "-c", temp_file.name] # Decompress to stdout try: run_result = subprocess.run(command, check=True, capture_output=True) data = run_result.stdout diff --git a/ofrak_components/ofrak_components_test/test_gzip_component.py b/ofrak_components/ofrak_components_test/test_gzip_component.py index cbd46ac3f..62ddf4362 100644 --- a/ofrak_components/ofrak_components_test/test_gzip_component.py +++ b/ofrak_components/ofrak_components_test/test_gzip_component.py @@ -50,7 +50,7 @@ async def create_root_resource(self, ofrak_context: OFRAKContext) -> Resource: f.write(self.INITIAL_DATA) gzip_path = os.path.join(d, self.GZIP_FILENAME) - gzip_command = ["gzip", file_path] + gzip_command = ["pigz", file_path] try: subprocess.run(gzip_command, check=True, capture_output=True) except subprocess.CalledProcessError as e: @@ -78,7 +78,7 @@ async def verify(self, root_resource: Resource) -> None: with open(gzip_path, "wb") as f: f.write(gzip_data) - gunzip_command = ["gzip", "-d", "-c", gzip_path] + gunzip_command = ["pigz", "-d", "-c", gzip_path] try: result = subprocess.run(gunzip_command, check=True, capture_output=True) data = result.stdout From 369e88ff5b83bffd957bff4fad241bd05a980d18 Mon Sep 17 00:00:00 2001 From: alexreuter <13192937+alexreuter@users.noreply.github.com> Date: Fri, 21 Oct 2022 10:01:12 -0400 Subject: [PATCH 2/2] Add pigz to brew install command --- docs/environment-setup.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/environment-setup.md b/docs/environment-setup.md index 6fbc0656c..d39710528 100644 --- a/docs/environment-setup.md +++ b/docs/environment-setup.md @@ -181,6 +181,7 @@ source ofrak-venv/bin/activate java \ libmagic \ lzop \ + pigz \ p7zip \ qemu \ squashfs \