mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-08 08:30:47 -09:00
utils/generate-cyclonedx: remove "support" for bz2 and gzip compressed patches
Buildroot-local patches can only be suffixed by .patch, otherwise they
either need to be downloaded via <PKG>_PATCH or manually applied via
$(APPLY_PATCHES) in a <PKG>_{PRE,POST}_PATCH_HOOKS like in
linux/linux.mk. In the former case, they are then listed in the
show-info output with a full URL (prefixed by '<PKG>_SITE_METHOD+'). In
the latter case, they not listed as patches at the moment, just as
externalReferences.
By removing "support" for those compressed patches, we can avoid the bz2
dependency and can now use Buildroot's host-python3 package without
BR2_PACKAGE_HOST_PYTHON3_BZIP2 to run utils/generate-cyclonedx.
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Arnout Vandecappelle <arnout@rnout.be>
(cherry picked from commit 0b70e16d5a)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
committed by
Thomas Perale
parent
3c6a6df8a4
commit
7c7b4e3333
@@ -9,8 +9,6 @@
|
||||
|
||||
|
||||
import argparse
|
||||
import bz2
|
||||
import gzip
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
@@ -179,7 +177,7 @@ def patch_retrieve_header(content: str) -> str:
|
||||
|
||||
|
||||
def read_patch_file(patch_path: Path) -> str:
|
||||
"""Read the content of a patch file, handling compression.
|
||||
"""Read the content of a patch file.
|
||||
|
||||
Args:
|
||||
patch_path (Path): Patch path.
|
||||
@@ -187,16 +185,8 @@ def read_patch_file(patch_path: Path) -> str:
|
||||
Returns:
|
||||
str: Patch content.
|
||||
"""
|
||||
if patch_path.suffix == ".gz":
|
||||
f = gzip.open(patch_path, mode="rt")
|
||||
elif patch_path.suffix == ".bz":
|
||||
f = bz2.open(patch_path, mode="rt")
|
||||
else:
|
||||
f = open(patch_path)
|
||||
|
||||
content = f.read()
|
||||
f.close()
|
||||
return content
|
||||
with open(patch_path) as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
def cyclonedx_patches(patch_list: list[str]):
|
||||
|
||||
Reference in New Issue
Block a user