[pacman-dev] makepkg changes

Dan McGee dpmcgee at gmail.com
Sat Jun 2 13:36:00 EDT 2007


79d73c646e76b4cca30845eb5d1b4e0116749f3b
 scripts/makepkg.in |   80 ++++++++++++++++++++++-----------------------------
 1 files changed, 35 insertions(+), 45 deletions(-)

diff --git a/scripts/makepkg.in b/scripts/makepkg.in
index 6ae4d8b..9a212e9 100644
--- a/scripts/makepkg.in
+++ b/scripts/makepkg.in
@@ -231,10 +231,9 @@ handledeps() {
 	[ $# -eq 0 ] && return $R_DEPS_SATISFIED

 	local deplist="$*"
-	local striplist dep depstrip
+	local dep striplist
 	for dep in $deplist; do
-		depstrip="$(echo $dep | sed -e 's|=.*$||' -e 's|>.&$||' -e 's|<.*$||')"
-		striplist="$striplist $depstrip"
+		striplist="$striplist $(echo $dep | sed -e 's|=.*$||' -e 's|>.*$||'
-e 's|<.*$||')"
 	done

You just don't want to let me win this one, do you? :P I figured I'd
keep it two lines for clarity.


 	if [ "$DEP_SRC" = "0" -a "$DEP_BIN" = "0" ]; then
@@ -303,11 +302,16 @@ handledeps() {
 }

 resolvedeps() {
+	# $pkgdeps is a GLOBAL variable, used by removedeps()
 	local R_DEPS_SATISFIED=0
-	local R_DEPS_MISSING=0
+	local R_DEPS_MISSING=1

-	deplist="$(checkdeps $*)"
-	[ "$deplist" = "" ] && return $R_DEPS_SATISFIED
+	local deplist="$(checkdeps $*)"
+	if [ "$deplist" = "" ]; then
+		return $R_DEPS_SATISFIED
+	else
+		pkgdeps="$pkgdeps $deplist"
+	fi

 	if handledeps $deplist; then
 		# check deps again to make sure they were resolved
@@ -328,24 +332,20 @@ resolvedeps() {

 # fix flyspray bug #5923
 removedeps() {
+	# $pkgdeps is a GLOBAL variable, set by resolvedeps()
 	[ "$RMDEPS" = "0" ] && return
+	[ "$pkgdeps" = "" ] && return

-	# runtimedeps and buildtimedeps are set when resolving deps
-	local deplist="$runtimedeps $buildtimedeps"
-
-	[ "$deplist" = "" ] && return
-
-	local striplist dep depstrip
-	for dep in $deplist; do
-		depstrip="$(echo $dep | sed -e 's|=.*$||' -e 's|>.&$||' -e 's|<.*$||')"
-		striplist="$striplist $depstrip"
+	local dep striplist
+	for dep in $pkgdeps; do
+		deplist="$deplist $(echo $dep | sed -e 's|=.*$||' -e 's|>.*$||' -e
's|<.*$||')"
 	done

Same as above.

 	msg "Removing installed dependencies..."
 	if [ "$ASROOT" = "0" ]; then
-		sudo pacman $PACMAN_OPTS -Rs $striplist
+		sudo pacman $PACMAN_OPTS -Rs $deplist
 	else
-		pacman $PACMAN_OPTS -Rs $striplist
+		pacman $PACMAN_OPTS -Rs $deplist
 	fi
 }

@@ -508,18 +508,21 @@ extract_sources() {
 				cmd="gunzip -d -f $file" ;;
 			*application/x-bzip*)
 				cmd="bunzip2 -f $file" ;;
+			*)
+				# Don't know what to use to extract this file,
+				# skip to the next file
+				continue;;
 		esac

-		if [ "$cmd" != "" ]; then
-			msg2 "$cmd"
-			$cmd
-			if [ $? -ne 0 ]; then
-				# unzip will return a 1 as a warning, it is not an error
-				if [ "$unziphack" != "1" -o $? -ne 1 ]; then
-					error "$(gettext "Failed to extract %s")" "$file"
-					msg "$(gettext "Aborting...")"
-					exit 1
-				fi
+		local ret=0
+		msg2 "$cmd"
+		$cmd || ret=$?
+		if [ $ret -ne 0 ]; then
+			# unzip will return a 1 as a warning, it is not an error
+			if [ $unziphack -ne 1 -o $ret -ne 1 ]; then
+				error "$(gettext "Failed to extract %s")" "$file"
+				msg "$(gettext "Aborting...")"
+				exit 1
 			fi
 		fi
 	done
@@ -746,8 +749,6 @@ create_package() {
 		error "$(gettext "Failed to create package file.")"
 		exit 1 # TODO: error code
 	fi
-
-	create_xdelta "$pkg_file"
 }

 create_xdelta() {
@@ -1177,27 +1178,14 @@ if [ "$NODEPS" = "1" -o "$GENINTEG" = "1" -o
"$NOBUILD" = "1" -o "$REPKG" = "1"
 	fi
 	# skip printing a warning message for the others: geninteg, nobuild, repkg
 elif [ $(type -p pacman) ]; then
+	unset pkgdeps # Set by resolvedeps() and used by removedeps()
 	deperr=0
-	# these two variables are needed later by removedeps
-	unset runtimedeps buildtimedeps

 	msg "$(gettext "Checking Runtime Dependencies...")"
-	resolvedeps ${depends[@]}
-	ret=$?
-	# deplist is a global variable set by resolvedeps
-	runtimedeps="$deplist"
-	if [ "$ret" != "0" ]; then
-		deperr=1
-	fi
+	resolvedeps ${depends[@]} || deperr=1

 	msg "$(gettext "Checking Buildtime Dependencies...")"
-	resolvedeps ${makedepends[@]}
-	ret=$?
-	# deplist is a global variable set by resolvedeps
-	buildtimedeps="$deplist"
-	if [ "$ret" != "0" ]; then
-		deperr=1
-	fi
+	resolvedeps ${makedepends[@]} || deperr=1

 	if [ $deperr -eq 1 ]; then
 		error "$(gettext "could not resolve all dependencies.")"
@@ -1258,6 +1246,8 @@ else
 		[ $ret -ne 0 ] && exit $ret
 		unset ret
 	fi
+
+	create_xdelta "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
 fi

 cd "$startdir"

The rest looks good.

-Dan




More information about the pacman-dev mailing list