aboutsummaryrefslogtreecommitdiff
path: root/common/hooks/post-pkg
diff options
context:
space:
mode:
authorEnno Boland <g@s01.de>2014-08-11 16:05:13 +0000
committerEnno Boland <g@s01.de>2014-08-11 16:05:13 +0000
commitf4544b82a6d53a413bd093ec0bb490e21c04801a (patch)
treec0b7fc6c7fc5d9039090a0bd56eb89cb43f80a36 /common/hooks/post-pkg
parent19332495b8fb4bc83c9fb83c6474cb16784c9d56 (diff)
downloadvoid-packages-f4544b82a6d53a413bd093ec0bb490e21c04801a.tar
void-packages-f4544b82a6d53a413bd093ec0bb490e21c04801a.tar.gz
void-packages-f4544b82a6d53a413bd093ec0bb490e21c04801a.tar.bz2
void-packages-f4544b82a6d53a413bd093ec0bb490e21c04801a.tar.lz
void-packages-f4544b82a6d53a413bd093ec0bb490e21c04801a.tar.xz
void-packages-f4544b82a6d53a413bd093ec0bb490e21c04801a.tar.zst
void-packages-f4544b82a6d53a413bd093ec0bb490e21c04801a.zip
common/hooks: add support for vcdiff creation
Diffstat (limited to 'common/hooks/post-pkg')
-rw-r--r--common/hooks/post-pkg/01-xdelta_repolist.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/common/hooks/post-pkg/01-xdelta_repolist.sh b/common/hooks/post-pkg/01-xdelta_repolist.sh
new file mode 100644
index 00000000000..a18f6ae3071
--- /dev/null
+++ b/common/hooks/post-pkg/01-xdelta_repolist.sh
@@ -0,0 +1,24 @@
+# This hook generates vcdiffs
+
+hook() {
+ set -x
+ [ -z "$XBPS_GENERATE_VCDIFF" ] && return 0;
+
+ find $XBPS_REPOSITORY -name '*.genVcdiff' | xargs -r sha256sum | \
+ while read chk oldfile; do
+ newfile=${oldfile/.genVcdiff/}
+
+ if ! cmp -s "${newfile}" "${oldfile}"; then
+ newdiff="${newfile}.${chk}.vcdiff"
+ xdelta3 -D -R -f -e -s "${oldfile}" "${newfile}" "${newdiff}"
+ for diff in ${newfile}.*.vcdiff; do
+ [ "${diff}" = "${newdiff}" ] && continue;
+ cp -- "${diff}" "${diff}.tmp"
+ xdelta3 -f merge -m "${diff}.tmp" "${newdiff}" "${diff}"
+ rm -- "${diff}.tmp"
+ done
+ fi
+
+ rm -- "${oldfile}"
+ done
+}