[pacman-dev] [PATCH 05/10] makepkg: Refactor split packaging to reduce code duplication

Jan Alexander Steffens (heftig) jan.steffens at gmail.com
Thu May 31 16:24:50 UTC 2018


---
 scripts/makepkg.sh.in | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index f8f43540..86af4675 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1124,30 +1124,23 @@ backup_package_variables() {
 run_solo_packaging() {
 	pkgdir="$pkgdirbase/$pkgname"
 	mkdir "$pkgdir"
-	if (( PKGFUNC )); then
-		run_package
+	if [[ -n $1 ]] || (( PKGFUNC )); then
+		run_package $1
 	fi
 	tidy_install
 	lint_package || exit $E_PACKAGE_FAILED
 	create_package
-	create_debug_package
 }
 
 run_split_packaging() {
 	local pkgname_backup=("${pkgname[@]}")
 	local restore_package_variables
 	for pkgname in ${pkgname_backup[@]}; do
-		pkgdir="$pkgdirbase/$pkgname"
-		mkdir "$pkgdir"
 		restore_package_variables="$(backup_package_variables)"
-		run_package $pkgname
-		tidy_install
-		lint_package || exit $E_PACKAGE_FAILED
-		create_package
+		run_solo_packaging $pkgname
 		eval "$restore_package_variables"
 	done
 	pkgname=("${pkgname_backup[@]}")
-	create_debug_package
 }
 
 usage() {
@@ -1554,6 +1547,8 @@ if (( INFAKEROOT )); then
 		run_split_packaging
 	fi
 
+	create_debug_package
+
 	msg "$(gettext "Leaving %s environment.")" "fakeroot"
 	exit $E_OK
 fi
-- 
2.17.0


More information about the pacman-dev mailing list