From bfda85dacefb4be2ce93d2635402a20736b3bedc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Thu, 19 May 2022 20:56:42 +0200
Subject: [PATCH] common/do-patch: handle spaces in patch filename

---
 common/hooks/do-patch/00-patches.sh           | 20 +++++++++----------
 ...e-test.patch => 21.08.1 online test.patch} |  0
 2 files changed, 10 insertions(+), 10 deletions(-)
 rename srcpkgs/libkcddb/patches/{21.08.1--online-test.patch => 21.08.1 online test.patch} (100%)

diff --git a/common/hooks/do-patch/00-patches.sh b/common/hooks/do-patch/00-patches.sh
index 64659dc3028..c75209f931e 100644
--- a/common/hooks/do-patch/00-patches.sh
+++ b/common/hooks/do-patch/00-patches.sh
@@ -6,23 +6,23 @@ _process_patch() {
 	_args="-Np1"
 	_patch=${i##*/}
 
-	if [ -f $PATCHESDIR/${_patch}.args ]; then
-		_args=$(<$PATCHESDIR/${_patch}.args)
+	if [ -f "$PATCHESDIR/${_patch}.args" ]; then
+		_args=$(<"$PATCHESDIR/${_patch}.args")
 	elif [ -n "$patch_args" ]; then
 		_args=$patch_args
 	fi
-	cp -f $i "$wrksrc"
+	cp -f "$i" "$wrksrc"
 
 	# Try to guess if its a compressed patch.
-	if [[ $f =~ .gz$ ]]; then
+	if [[ $i =~ .gz$ ]]; then
 		gunzip "$wrksrc/${_patch}"
 		_patch=${_patch%%.gz}
-	elif [[ $f =~ .bz2$ ]]; then
+	elif [[ $i =~ .bz2$ ]]; then
 		bunzip2 "$wrksrc/${_patch}"
 		_patch=${_patch%%.bz2}
-	elif [[ $f =~ .diff$ ]]; then
+	elif [[ $i =~ .diff$ ]]; then
 		:
-	elif [[ $f =~ .patch$ ]]; then
+	elif [[ $i =~ .patch$ ]]; then
 		:
 	else
 		msg_warn "$pkgver: unknown patch type: $i.\n"
@@ -31,7 +31,7 @@ _process_patch() {
 
 	cd "$wrksrc"
 	msg_normal "$pkgver: patching: ${_patch}.\n"
-	patch -s ${_args} <${_patch} 2>/dev/null
+	patch -s ${_args} <"${_patch}" 2>/dev/null
 }
 
 hook() {
@@ -44,11 +44,11 @@ hook() {
 		done < $PATCHESDIR/series
 	else
 		for f in $PATCHESDIR/*; do
-			[ ! -f $f ] && continue
+			[ ! -f "$f" ] && continue
 			if [[ $f =~ ^.*.args$ ]]; then
 				continue
 			fi
-			_process_patch $f
+			_process_patch "$f"
 		done
 	fi
 }
diff --git a/srcpkgs/libkcddb/patches/21.08.1--online-test.patch b/srcpkgs/libkcddb/patches/21.08.1 online test.patch
similarity index 100%
rename from srcpkgs/libkcddb/patches/21.08.1--online-test.patch
rename to srcpkgs/libkcddb/patches/21.08.1 online test.patch