Poky Project Discussions
 help / color / mirror / Atom feed
From: Tim Blechmann <tim@klingt.org>
To: poky@yoctoproject.org
Subject: deb: custom compression
Date: Wed, 7 Aug 2019 11:28:32 +0800	[thread overview]
Message-ID: <qidgh2$3lce$1@blaine.gmane.org> (raw)

[-- 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


             reply	other threads:[~2019-08-07  4:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07  3:28 Tim Blechmann [this message]
2019-08-07  6:04 ` deb: custom compression Adrian Bunk
2019-08-07  6:35   ` Tim Blechmann
2019-08-07 10:16     ` Alexander Kanavin
2019-08-07 12:53     ` Adrian Bunk

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='qidgh2$3lce$1@blaine.gmane.org' \
    --to=tim@klingt.org \
    --cc=poky@yoctoproject.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