From: Joshua Watt <jpewhacker@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [OE-core][dunfell][PATCH v2 4/5] create-spdx: Use gzip for compression
Date: Mon, 27 Mar 2023 15:05:29 -0500 [thread overview]
Message-ID: <20230327200530.3354151-5-JPEWhacker@gmail.com> (raw)
In-Reply-To: <20230327200530.3354151-1-JPEWhacker@gmail.com>
The master version of the SPDX classes uses zstd for efficient
compression, but it relies on the zstd tool to be present on the host
system. Since dunfell supports older distros, we don't want to add this
tool as an additional requirement so switch to using gzip instead.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
meta/classes/create-spdx-2.2.bbclass | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass
index 13d13fe1fc..42b693d586 100644
--- a/meta/classes/create-spdx-2.2.bbclass
+++ b/meta/classes/create-spdx-2.2.bbclass
@@ -466,13 +466,11 @@ python do_create_spdx() {
@contextmanager
def optional_tarfile(name, guard, mode="w"):
import tarfile
- import bb.compress.zstd
-
- num_threads = int(d.getVar("BB_NUMBER_THREADS"))
+ import gzip
if guard:
name.parent.mkdir(parents=True, exist_ok=True)
- with bb.compress.zstd.open(name, mode=mode + "b", num_threads=num_threads) as f:
+ with gzip.open(name, mode=mode + "b") as f:
with tarfile.open(fileobj=f, mode=mode + "|") as tf:
yield tf
else:
@@ -550,7 +548,7 @@ python do_create_spdx() {
add_download_packages(d, doc, recipe)
if process_sources(d) and include_sources:
- recipe_archive = deploy_dir_spdx / "recipes" / (doc.name + ".tar.zst")
+ recipe_archive = deploy_dir_spdx / "recipes" / (doc.name + ".tar.gz")
with optional_tarfile(recipe_archive, archive_sources) as archive:
spdx_get_src(d)
@@ -618,7 +616,7 @@ python do_create_spdx() {
package_doc.add_relationship(spdx_package, "GENERATED_FROM", "%s:%s" % (recipe_ref.externalDocumentId, recipe.SPDXID))
package_doc.add_relationship(package_doc, "DESCRIBES", spdx_package)
- package_archive = deploy_dir_spdx / "packages" / (package_doc.name + ".tar.zst")
+ package_archive = deploy_dir_spdx / "packages" / (package_doc.name + ".tar.gz")
with optional_tarfile(package_archive, archive_packaged) as archive:
package_files = add_package_files(
d,
@@ -899,8 +897,8 @@ python image_combine_spdx() {
if link != target_path:
link.symlink_to(os.path.relpath(target_path, link.parent))
- spdx_tar_path = imgdeploydir / (image_name + ".spdx.tar.zst")
- make_image_link(spdx_tar_path, ".spdx.tar.zst")
+ spdx_tar_path = imgdeploydir / (image_name + ".spdx.tar.gz")
+ make_image_link(spdx_tar_path, ".spdx.tar.gz")
}
python sdk_host_combine_spdx() {
@@ -931,7 +929,7 @@ def combine_spdx(d, rootfs_name, rootfs_deploydir, rootfs_spdxid, packages, spdx
from datetime import timezone, datetime
from pathlib import Path
import tarfile
- import bb.compress.zstd
+ import gzip
creation_time = datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))
@@ -1002,8 +1000,8 @@ def combine_spdx(d, rootfs_name, rootfs_deploydir, rootfs_spdxid, packages, spdx
index = {"documents": []}
- spdx_tar_path = rootfs_deploydir / (rootfs_name + ".spdx.tar.zst")
- with bb.compress.zstd.open(spdx_tar_path, "w", num_threads=num_threads) as f:
+ spdx_tar_path = rootfs_deploydir / (rootfs_name + ".spdx.tar.gz")
+ with gzip.open(spdx_tar_path, "w") as f:
with tarfile.open(fileobj=f, mode="w|") as tar:
def collect_spdx_document(path):
nonlocal tar
--
2.33.0
next prev parent reply other threads:[~2023-03-27 20:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 20:45 [OE-core][dunfell][PATCH 0/5] Backport SPDX support Joshua Watt
2023-03-22 20:45 ` [OE-core][dunfell][PATCH 1/5] classes/create-spdx: Backport Joshua Watt
2023-03-23 13:42 ` Ernst Sjöstrand
2023-03-23 20:52 ` Richard Purdie
2023-03-24 10:01 ` Ernst Sjöstrand
2023-03-22 20:45 ` [OE-core][dunfell][PATCH 2/5] classes/package: Add extended packaged data Joshua Watt
2023-03-22 20:45 ` [OE-core][dunfell][PATCH 3/5] licenses: Add GPL+ licenses to map Joshua Watt
2023-03-22 20:45 ` [OE-core][dunfell][PATCH 4/5] create-spdx: Use gzip for compression Joshua Watt
2023-03-22 20:45 ` [OE-core][dunfell][PATCH 5/5] classes/package: Use gzip for extended package data Joshua Watt
2023-03-27 20:05 ` [OE-core][dunfell][PATCH v2 0/5] Backport SPDX Support Joshua Watt
2023-03-27 20:05 ` [OE-core][dunfell][PATCH v2 1/5] classes/create-spdx: Backport Joshua Watt
2023-03-27 20:05 ` [OE-core][dunfell][PATCH v2 2/5] classes/package: Add extended packaged data Joshua Watt
2023-03-27 20:05 ` [OE-core][dunfell][PATCH v2 3/5] licenses: Add GPL+ licenses to map Joshua Watt
2023-03-27 20:05 ` Joshua Watt [this message]
2023-03-27 20:05 ` [OE-core][dunfell][PATCH v2 5/5] classes/package: Use gzip for extended package data Joshua Watt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230327200530.3354151-5-JPEWhacker@gmail.com \
--to=jpewhacker@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox