diff options
author | Juan RP <xtraeme@gmail.com> | 2014-08-13 19:57:46 +0000 |
---|---|---|
committer | Juan RP <xtraeme@gmail.com> | 2014-08-13 19:57:46 +0000 |
commit | 8ff17f52f308c07d9586a6d028b12234bdf3951f (patch) | |
tree | 5887de221fc5427ecdf4d512f09737e2fdfff91a | |
parent | 3854badc2cd343629489159df43e68f5c4cc05f9 (diff) | |
parent | bdb339f5fa0044ac9b9a1fd296b581b41be5ff9e (diff) | |
download | void-packages-8ff17f52f308c07d9586a6d028b12234bdf3951f.tar void-packages-8ff17f52f308c07d9586a6d028b12234bdf3951f.tar.gz void-packages-8ff17f52f308c07d9586a6d028b12234bdf3951f.tar.bz2 void-packages-8ff17f52f308c07d9586a6d028b12234bdf3951f.tar.lz void-packages-8ff17f52f308c07d9586a6d028b12234bdf3951f.tar.xz void-packages-8ff17f52f308c07d9586a6d028b12234bdf3951f.tar.zst void-packages-8ff17f52f308c07d9586a6d028b12234bdf3951f.zip |
Merge pull request #503 from Gottox/xdelta
Generates binary diffs for repository indexes.
-rw-r--r-- | common/hooks/post-pkg/01-xdelta_repolist.sh | 29 | ||||
-rw-r--r-- | common/hooks/pre-pkg/01-xdelta_repolist.sh | 11 |
2 files changed, 40 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..24c961a470f --- /dev/null +++ b/common/hooks/post-pkg/01-xdelta_repolist.sh @@ -0,0 +1,29 @@ +# This hook generates vcdiffs + +hook() { + set -x + type -P xdelta3 > /dev/null || 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 -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 + + # generate an empty diff to the new file + newchk=`sha256sum ${newfile} | awk '{ print $1 }'` + xdelta3 -f -e -s "${newfile}" "${newfile}" \ + "${newfile}.${newchk}.vcdiff" + + rm -- "${oldfile}" + done +} diff --git a/common/hooks/pre-pkg/01-xdelta_repolist.sh b/common/hooks/pre-pkg/01-xdelta_repolist.sh new file mode 100644 index 00000000000..4a3941885e2 --- /dev/null +++ b/common/hooks/pre-pkg/01-xdelta_repolist.sh @@ -0,0 +1,11 @@ +# this hook marks files which are about to change for generating vcdiffs + +hook() { + type -P xdelta3 > /dev/null || return 0; + + # create links to preserve old versions of repodata + find $XBPS_REPOSITORY -name '*-repodata' | \ + while read; do + ln "${REPLY}" "${REPLY}.genVcdiff" + done +} |