[pacman-dev] [PATCH] makepkg: fix check for previously built packages with package splitting

Allan McRae allan at archlinux.org
Wed Jul 1 03:36:25 EDT 2009


Checks if some or all packages are built before overwriting/installing.
Adds two new translation strings

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 scripts/makepkg.sh.in |   41 ++++++++++++++++++++++++++++++++---------
 1 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 2bb7eb9..61ae037 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1646,15 +1646,38 @@ if [ "${#pkgname[@]}" -gt "1" ]; then
 	SPLITPKG=1
 fi
 
-if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \
-     -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then
-	if [ "$INSTALL" -eq 1 ]; then
-		warning "$(gettext "A package has already been built, installing existing package...")"
-		install_package
-		exit $?
-	else
-		error "$(gettext "A package has already been built. (use -f to overwrite)")"
-		exit 1
+if [ "$SPLITPKG" -eq 0 ]; then
+	if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \
+			-a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then
+		if [ "$INSTALL" -eq 1 ]; then
+			warning "$(gettext "A package has already been built, installing existing package...")"
+			install_package
+			exit $?
+		else
+			error "$(gettext "A package has already been built. (use -f to overwrite)")"
+			exit 1
+		fi
+	fi
+else
+	local allpkgbuilt=1
+	local somepkgbuilt=0
+	for pkg in ${pkgname[@]}; do
+		if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" ]; then
+			somepkgbuilt=1
+		else
+			allpkgbuilt=0
+		fi
+	done
+	if [ -f "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then
+		if [ "$INSTALL" -eq 1 -a "$allpkgbuilt" -eq 1 ]; then
+			warning "$(gettext "The package group has already been built, installing existing packages...")"
+			install_package
+			exit $?
+		fi
+		if [ "$somepkgbuilt" -eq 1 ]; then
+			error "$(gettext "The package group has already been (partially) built. (use -f to overwrite)")"
+			exit 1
+		fi
 	fi
 fi
 
-- 
1.6.3.3



More information about the pacman-dev mailing list