common/do-patch: handle spaces in patch filename

This commit is contained in:
Piotr Wójcik 2022-05-19 20:56:42 +02:00
parent f134c0484c
commit bfda85dace
2 changed files with 10 additions and 10 deletions

View File

@ -6,23 +6,23 @@ _process_patch() {
_args="-Np1" _args="-Np1"
_patch=${i##*/} _patch=${i##*/}
if [ -f $PATCHESDIR/${_patch}.args ]; then if [ -f "$PATCHESDIR/${_patch}.args" ]; then
_args=$(<$PATCHESDIR/${_patch}.args) _args=$(<"$PATCHESDIR/${_patch}.args")
elif [ -n "$patch_args" ]; then elif [ -n "$patch_args" ]; then
_args=$patch_args _args=$patch_args
fi fi
cp -f $i "$wrksrc" cp -f "$i" "$wrksrc"
# Try to guess if its a compressed patch. # Try to guess if its a compressed patch.
if [[ $f =~ .gz$ ]]; then if [[ $i =~ .gz$ ]]; then
gunzip "$wrksrc/${_patch}" gunzip "$wrksrc/${_patch}"
_patch=${_patch%%.gz} _patch=${_patch%%.gz}
elif [[ $f =~ .bz2$ ]]; then elif [[ $i =~ .bz2$ ]]; then
bunzip2 "$wrksrc/${_patch}" bunzip2 "$wrksrc/${_patch}"
_patch=${_patch%%.bz2} _patch=${_patch%%.bz2}
elif [[ $f =~ .diff$ ]]; then elif [[ $i =~ .diff$ ]]; then
: :
elif [[ $f =~ .patch$ ]]; then elif [[ $i =~ .patch$ ]]; then
: :
else else
msg_warn "$pkgver: unknown patch type: $i.\n" msg_warn "$pkgver: unknown patch type: $i.\n"
@ -31,7 +31,7 @@ _process_patch() {
cd "$wrksrc" cd "$wrksrc"
msg_normal "$pkgver: patching: ${_patch}.\n" msg_normal "$pkgver: patching: ${_patch}.\n"
patch -s ${_args} <${_patch} 2>/dev/null patch -s ${_args} <"${_patch}" 2>/dev/null
} }
hook() { hook() {
@ -44,11 +44,11 @@ hook() {
done < $PATCHESDIR/series done < $PATCHESDIR/series
else else
for f in $PATCHESDIR/*; do for f in $PATCHESDIR/*; do
[ ! -f $f ] && continue [ ! -f "$f" ] && continue
if [[ $f =~ ^.*.args$ ]]; then if [[ $f =~ ^.*.args$ ]]; then
continue continue
fi fi
_process_patch $f _process_patch "$f"
done done
fi fi
} }