common/hooks: add support for vcdiff creation
This commit is contained in:
parent
19332495b8
commit
f4544b82a6
3 changed files with 37 additions and 1 deletions
24
common/hooks/post-pkg/01-xdelta_repolist.sh
Normal file
24
common/hooks/post-pkg/01-xdelta_repolist.sh
Normal file
|
@ -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
|
||||
}
|
11
common/hooks/pre-pkg/01-xdelta_repolist.sh
Normal file
11
common/hooks/pre-pkg/01-xdelta_repolist.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
# this hook marks files which are about to change for generating vcdiffs
|
||||
|
||||
hook() {
|
||||
[ -z "$XBPS_GENERATE_VCDIFF" ] && return 0;
|
||||
|
||||
# create links to preserve old versions of repodata
|
||||
find $XBPS_REPOSITORY -name '*-repodata' | \
|
||||
while read; do
|
||||
ln "${REPLY}" "${REPLY}.genVcdiff"
|
||||
done
|
||||
}
|
3
xbps-src
3
xbps-src
|
@ -469,7 +469,8 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
|
|||
XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
|
||||
XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_PKG_OPTIONS \
|
||||
XBPS_CONFIG_FILE XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR \
|
||||
XBPS_SRC_VERSION XBPS_DESTDIR FAKEROOT_CMD CHROOT_CMD XBPS_MACHINE
|
||||
XBPS_SRC_VERSION XBPS_DESTDIR FAKEROOT_CMD CHROOT_CMD XBPS_MACHINE \
|
||||
XBPS_GENERATE_VCDIFF
|
||||
|
||||
for i in REPOSITORY DESTDIR BUILDDIR SRCDISTDIR; do
|
||||
eval val="\$XBPS_$i"
|
||||
|
|
Loading…
Reference in a new issue