All of lore.kernel.org
 help / color / mirror / Atom feed
* deb: custom compression
@ 2019-08-07  3:28 Tim Blechmann
  2019-08-07  6:04 ` Adrian Bunk
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Blechmann @ 2019-08-07  3:28 UTC (permalink / raw)
  To: poky

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

hi!

poky compresses deb packages with the default flags, which these days
boils down to using xz compression.
trying to cut down turnaround times for local builds, i tried to modify
the `package_deb` class to be able to force a low gzip compression via a
`DPKG_FAST` parameter (patch attached).

could this patch be accepted upstream?

thanks a lot,
tim

[-- Attachment #2: 0001-package_deb-add-DPKG_FAST-flag.patch --]
[-- Type: text/plain, Size: 1808 bytes --]

From c36ead7c4cc9b0cb81b274ddcd288f0d13c90662 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <tim@klingt.org>
Date: Fri, 2 Aug 2019 06:05:47 +0200
Subject: [PATCH] package_deb: add DPKG_FAST flag

by default dpkg-deb compresses debian packages with xz. xz gives great
compression ratios, at the cost of compression speed.

we therefore introduce a DPKG_FAST flag, which compresses with gzip, which
should be an order of magnitude faster than xz at the cost of almost
doubling package sizes.

numbers:
https://www.rootusers.com/gzip-vs-bzip2-vs-xz-performance-comparison/

Signed-off-by: Tim Blechmann <tim@klingt.org>
---
 meta/classes/package_deb.bbclass | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index 6f81591653..28c6b9c19f 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -15,6 +15,10 @@ APTCONF_TARGET = "${WORKDIR}"
 
 APT_ARGS = "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS") == "1"]}"
 
+DPKG_FAST ??= "0"
+
+BB_HASHCONFIG_WHITELIST += "DPKG_FAST"
+
 def debian_arch_map(arch, tune):
     tune_features = tune.split()
     if arch == "allarch":
@@ -269,7 +273,13 @@ def deb_write_pkg(pkg, d):
             conffiles.close()
 
         os.chdir(basedir)
-        subprocess.check_output("PATH=\"%s\" dpkg-deb -b %s %s" % (localdata.getVar("PATH"), root, pkgoutdir),
+
+        if d.getVar("DPKG_FAST") != "0":
+            dpkg_args = "-Zgzip -z1"
+        else:
+            dpkg_args = ""
+
+        subprocess.check_output("PATH=\"%s\" dpkg-deb %s -b %s %s" % (localdata.getVar("PATH"), dpkg_args, root, pkgoutdir),
                                 stderr=subprocess.STDOUT,
                                 shell=True)
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-08-07 12:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-07  3:28 deb: custom compression Tim Blechmann
2019-08-07  6:04 ` Adrian Bunk
2019-08-07  6:35   ` Tim Blechmann
2019-08-07 10:16     ` Alexander Kanavin
2019-08-07 12:53     ` Adrian Bunk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.