2014-02-12 17:38:32 +00:00
|
|
|
# This hook applies patches from "patches" directory.
|
|
|
|
|
|
|
|
_process_patch() {
|
|
|
|
local _args= _patch= i=$1
|
|
|
|
|
|
|
|
_args="-Np0"
|
2015-09-11 05:55:40 +00:00
|
|
|
_patch=${i##*/}
|
|
|
|
|
2014-02-12 17:38:32 +00:00
|
|
|
if [ -f $PATCHESDIR/${_patch}.args ]; then
|
|
|
|
_args=$(cat $PATCHESDIR/${_patch}.args)
|
|
|
|
elif [ -n "$patch_args" ]; then
|
|
|
|
_args=$patch_args
|
|
|
|
fi
|
2015-07-29 08:17:37 +00:00
|
|
|
cp -f $i "$wrksrc"
|
2014-02-12 17:38:32 +00:00
|
|
|
|
|
|
|
# Try to guess if its a compressed patch.
|
2014-05-31 05:55:46 +00:00
|
|
|
if [[ $f =~ .gz$ ]]; then
|
2015-07-29 08:17:37 +00:00
|
|
|
gunzip "$wrksrc/${_patch}"
|
2014-02-12 17:38:32 +00:00
|
|
|
_patch=${_patch%%.gz}
|
2014-05-31 05:55:46 +00:00
|
|
|
elif [[ $f =~ .bz2$ ]]; then
|
2015-07-29 08:17:37 +00:00
|
|
|
bunzip2 "$wrksrc/${_patch}"
|
2014-02-12 17:38:32 +00:00
|
|
|
_patch=${_patch%%.bz2}
|
2014-05-13 11:11:39 +00:00
|
|
|
elif [[ $f =~ .diff ]]; then
|
2014-02-12 17:38:32 +00:00
|
|
|
:
|
2014-05-13 11:11:39 +00:00
|
|
|
elif [[ $f =~ .patch ]]; then
|
2014-02-12 17:38:32 +00:00
|
|
|
:
|
|
|
|
else
|
|
|
|
msg_warn "$pkgver: unknown patch type: $i.\n"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2015-07-29 08:17:37 +00:00
|
|
|
cd "$wrksrc"
|
2015-08-02 08:54:59 +00:00
|
|
|
msg_normal "$pkgver: patching: ${_patch}.\n"
|
2014-02-12 17:38:32 +00:00
|
|
|
patch -sl ${_args} -i ${_patch} 2>/dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
hook() {
|
|
|
|
if [ ! -d "$wrksrc" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
if [ -r $PATCHESDIR/series ]; then
|
|
|
|
cat $PATCHESDIR/series | while read f; do
|
|
|
|
_process_patch "$PATCHESDIR/$f"
|
|
|
|
done
|
|
|
|
else
|
|
|
|
for f in $PATCHESDIR/*; do
|
|
|
|
[ ! -f $f ] && continue
|
|
|
|
if $(echo $f|grep -Eq '^.*.args$'); then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
_process_patch $f
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|