Skip to contentSkip to conversation

deb: custom compression

PATCH Tim Blechmann 3 participants 5 messages Aug 7, 2019

lore
Share & tools
lore
#0 lore raw

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

From c36ead7c4cc9b0cb81b274ddcd288f0d13c90662 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <[email protected]>
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/

---
 meta/classes/package_deb.bbclass | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
meta/classes/package_deb.bbclass +11 -1
index 6f81591653..28c6b9c19f 100644
@@ -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)
 
Signature · 1 line
2.18.0
#1 lore raw
Quoted 9 lines · Tim Blechmann

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?

It is specific to your problem (and sent to the wrong mailing list).

A more generic solution would be similar to OPKGBUILDCMD, allowing the user to pass any parameters (including any compression settings) to dpkg-deb.

This would also support the opposite usecase of "xz -9", which is both faster to download and faster to decompress than the default "xz -6".

Quoted 3 lines

thanks a lot,
tim
...

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#2 lore raw
Quoted 9 lines
Quoted 7 lines

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?

It is specific to your problem (and sent to the wrong mailing list).

my bad (thought it's this one, as the file resides in the poky repo). which is the right place for it?

Quoted 3 lines

A more generic solution would be similar to OPKGBUILDCMD, allowing the user to pass any parameters (including any compression settings) to dpkg-deb.

something like DPKG_OPTIONS i'm happy to adapt the patch?

thanks,
tim

#3 lore raw

openembedded-core list is the right one.

Alex

Quoted 28 lines · Tim Blechmann
Quoted 9 lines
Quoted 7 lines

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?

It is specific to your problem (and sent to the wrong mailing list).

my bad (thought it's this one, as the file resides in the poky repo). which is the right place for it?

Quoted 3 lines

A more generic solution would be similar to OPKGBUILDCMD, allowing the user to pass any parameters (including any compression settings) to dpkg-deb.

something like DPKG_OPTIONS i'm happy to adapt the patch?

thanks,
tim

--
_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky

#4 lore raw
In reply to Tim Blechmann
Quoted 6 lines · Tim Blechmann
Quoted 6 lines
Quoted 6 lines

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).

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

could this patch be accepted upstream?

It is specific to your problem (and sent to the wrong mailing list).

my bad (thought it's this one, as the file resides in the poky repo). which is the right place for it?

Not really your bad since it is complicated,
README.poky contains the details.

Quoted 5 lines
Quoted 3 lines

A more generic solution would be similar to OPKGBUILDCMD, allowing the user to pass any parameters (including any compression settings) to dpkg-deb.

something like DPKG_OPTIONS i'm happy to adapt the patch?

opkg (upstream defaults to gzip) has
OPKGBUILDCMD ??= 'opkg-build -Z xz -a "${XZ_DEFAULTS}"'

For dpkg-deb I would therefore suggest
DPKGDEBCMD ??= 'dpkg-deb'

Quoted 2 lines

thanks,
tim

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed