Looking how pkgdelta works, I found this line
xdelta3 -q -f -s "$oldfile" "$newfile" "$deltafile" || ret=$?
which seemed to be responsible for the actual delta generation, however
man xdelta3
revealed that there were different compression levels (0-9) (not sure
which one is default).
To make it short, we could have had smaller deltas since pkgdelta was
introduced!
Examples:
-9 16660K blender-12:2.69.c7ac0e-1_to_13:2.69.13290d-1-x86_64.delta
default 17832K blender-12:2.69.c7ac0e-1_to_13:2.69.13290d-1-x86_64.delta
-9 504K xbmc-12.3-10_to_12.3-11-x86_64.delta
default 572K xbmc-12.3-10_to_12.3-11-x86_64.delta
The attached patch adds the "-9" option to the line above.
Side note: it might be even more advantageous to use bsdiff instead of
xdelta3
comparing the /usr/bin/blender binaries of the above versions
(12:2.69.c7ac0e-1 and 13:2.69.13290d-1) :
xdelta3 10.4M
xdelta3 -9 9.9M
bsdiff 4.7M
,however bsdiff is only for direct diff creation, bsdiff foo1.pkg.tar.xz
foo2.pkg.tar.xz will create a diff between the archives and not their
contents, so that'd require further coding which I am unable to do
(maybe someone else volunteers :) ).
Kind regards, Matthias
>From 218d1161010e743df9acfd191e57d6a4ba599f11 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= <[email protected]>
Date: Wed, 5 Mar 2014 23:32:42 +0100
Subject: [PATCH] pkgdelta: use highest compression level (9) when xdelta3
generates the delta
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Matthias Krüger <[email protected]>
---
scripts/pkgdelta.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/pkgdelta.sh.in b/scripts/pkgdelta.sh.in
index be49326..054cb83 100644
--- a/scripts/pkgdelta.sh.in
+++ b/scripts/pkgdelta.sh.in
@@ -140,7 +140,7 @@ create_xdelta()
deltafile=$(dirname "$newfile")/$pkgname-${oldver}_to_${newver}-$arch.delta
local ret=0
- xdelta3 -q -f -s "$oldfile" "$newfile" "$deltafile" || ret=$?
+ xdelta3 -9 -q -f -s "$oldfile" "$newfile" "$deltafile" || ret=$?
if (( ret )); then
error "$(gettext "Delta could not be created.")"
return 1
--
1.9.0