[pacman-dev] [PATCH]

Roman Kyrylych roman.kyrylych at gmail.com
Mon Apr 2 11:47:16 EDT 2007


Here's quick patch to fix http://bugs.archlinux.org/task/6791
However maybe it would be better to have some do_exit(<errorcode>)
function that will cleanup things before exit.


diff -uprN pacman-lib.orig/scripts/makepkg pacman-lib/scripts/makepkg
--- pacman-lib.orig/scripts/makepkg	2007-03-30 06:24:09.000000000 +0300
+++ pacman-lib/scripts/makepkg	2007-04-02 18:42:06.000000000 +0300
@@ -676,18 +676,21 @@ for netfile in ${source[@]}; do
 		if [ -z "$FTPAGENT" ]; then
 			error "FTPAGENT is not configured. Check the /etc/makepkg.conf file."
 			msg "Aborting..."
+			removedeps
 			exit 1
 		fi
 		ftpclient=$(echo $FTPAGENT | awk {'print $1'})
 		if [ ! -x "$ftpclient" ]; then
 			error "ftpclient $(basename $ftpclient) is not installed."
 			msg "Aborting..."
+			removedeps
 			exit 1
 		fi
 		proto=$(echo "$netfile" | sed 's|://.*||')
 		if [ "$proto" != "ftp" -a "$proto" != "http" -a "$proto" != "https" ]; then
 			error "$netfile was not found in the build directory and is not a
proper URL."
 			msg "Aborting..."
+			removedeps
 			exit 1
 		fi
 		msg2 "Downloading $file"
@@ -698,6 +701,7 @@ for netfile in ${source[@]}; do
 			error "Failure while downloading $file"
 			msg "Aborting..."
 			#rm "$file"
+			removedeps
 			exit 1
 		fi
 		if [ -n "$SRCDEST" ]; then
@@ -729,10 +733,13 @@ else
 			sha256) integrity_name="sha256sum" ;;
 			sha384) integrity_name="sha384sum" ;;
 			sha512) integrity_name="sha512sum" ;;
-			*) error "Invalid integrity algorithm '$integ' specified"; exit 1;;
+			*) error "Invalid integrity algorithm '$integ' specified";
+			removedeps
+			exit 1;;
 		esac
 		if [ ! $(type -p $integrity_name) ]; then
 			error "Cannot find the $integrity_name program."
+			removedeps
 			exit 1
 		fi

@@ -778,6 +785,7 @@ else
 				done
 				if [ $errors -gt 0 ]; then
 					error "One or more files did not pass the validity check!"
+			removedeps
 					exit 1
 				fi
 			else
@@ -831,6 +839,7 @@ else
 				if [ "$unziphack" != "1" -o $? -ne 1 ]; then
 					error "Failed to extract $file"
 					msg "Aborting..."
+					removedeps
 					exit 1
 				fi
 			fi
@@ -1060,6 +1069,7 @@ comp_files=".PKGINFO .FILELIST ${install

 if ! tar czf $pkg_file $comp_files *; then
 	error "Failed to create package file."
+	removedeps
 	exit 1
 fi


-- 
Roman Kyrylych (Роман Кирилич)


More information about the pacman-dev mailing list