]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
classes/package: Use gzip for extended package data
authorJoshua Watt <jpewhacker@gmail.com>
Mon, 27 Mar 2023 20:05:30 +0000 (15:05 -0500)
committerSteve Sakoman <steve@sakoman.com>
Tue, 28 Mar 2023 02:29:20 +0000 (16:29 -1000)
The master version of extended package data 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>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/classes/package.bbclass
meta/lib/oe/packagedata.py

index 84fdafa8fec78aef485ddf0d53d95ad03722895f..49d30caef70217993b22b24079e4134083740168 100644 (file)
@@ -1470,7 +1470,7 @@ PKGDATA_VARS = "PN PE PV PR PKGE PKGV PKGR LICENSE DESCRIPTION SUMMARY RDEPENDS
 python emit_pkgdata() {
     from glob import glob
     import json
-    import bb.compress.zstd
+    import gzip
 
     def process_postinst_on_target(pkg, mlprefix):
         pkgval = d.getVar('PKG_%s' % pkg)
@@ -1610,9 +1610,8 @@ fi
 
             sf.write('%s_%s: %d\n' % ('PKGSIZE', pkg, total_size))
 
-        subdata_extended_file = pkgdatadir + "/extended/%s.json.zstd" % pkg
-        num_threads = int(d.getVar("BB_NUMBER_THREADS"))
-        with bb.compress.zstd.open(subdata_extended_file, "wt", encoding="utf-8", num_threads=num_threads) as f:
+        subdata_extended_file = pkgdatadir + "/extended/%s.json.gz" % pkg
+        with gzip.open(subdata_extended_file, "wt", encoding="utf-8") as f:
             json.dump(extended_data, f, sort_keys=True, separators=(",", ":"))
 
         # Symlinks needed for rprovides lookup
index 00f7dc1f3d47f639cc3a5e2baa9cdad5ed5de5a9..feb834c0e346bfbb0cd834bb1458b01454018d02 100644 (file)
@@ -59,12 +59,11 @@ def read_subpkgdata_dict(pkg, d):
 
 def read_subpkgdata_extended(pkg, d):
     import json
-    import bb.compress.zstd
+    import gzip
 
-    fn = d.expand("${PKGDATA_DIR}/extended/%s.json.zstd" % pkg)
+    fn = d.expand("${PKGDATA_DIR}/extended/%s.json.gz" % pkg)
     try:
-        num_threads = int(d.getVar("BB_NUMBER_THREADS"))
-        with bb.compress.zstd.open(fn, "rt", encoding="utf-8", num_threads=num_threads) as f:
+        with gzip.open(fn, "rt", encoding="utf-8") as f:
             return json.load(f)
     except FileNotFoundError:
         return None