[pacman-dev] My makepkg changes/updates

Dan McGee dpmcgee at gmail.com
Thu Dec 21 13:18:26 EST 2006


I'm checking to see if stuff broke now...because I now see my local
script won't run. Oops. :)

Thanks for the clarifications on the echo.

I think that $PKGDEST check can go now if we eliminate the options for
command line destination of the package. I killed it in my local copy,
and it is in the patch below to fix small mistakes you made while
patching.

The patch has some indentation changes after you reformatted it with
tabs, makes for easier reading; vim got confused with some of the do
loops and case statements. It also fixes a few minor typos found, and
makes my --repackage stuff a bit more clear. It is pretty
straightforward and a lot shorter than that last one.

-Dan

--- pacman-lib.orig/scripts/makepkg	2006-12-21 12:52:59.000000000 -0500
+++ pacman-lib/scripts/makepkg	2006-12-21 13:11:02.000000000 -0500
@@ -293,16 +293,17 @@

 ARGLIST=$@

+#source makepkg.conf; fail if it is not found
 if [ -f /etc/makepkg.conf ]; then
	source /etc/makepkg.conf
 else
-	error "/etc/makepkg.conf not found. cannot continue"
+	error "/etc/makepkg.conf not found. Cannot continue."
 	exit 1
 fi

 #Source user-specific makepkg.conf overrides
 if [ -f ~/.makepkg.conf ]; then
-    source ~/.makepkg.conf
+	source ~/.makepkg.conf
 fi

 while [ "$#" -ne "0" ]; do
@@ -328,13 +329,13 @@
 		--repackage)  REPKG=1 ;;
 		--log)        LOGGING=1 ;;
 		--help)
-		usage
-		exit 0
-		;;
+			usage
+			exit 0
+			;;
 		--*)
-		usage
-		exit 1
-		;;
+			usage
+			exit 1
+			;;
 		-*)
 		while getopts "bBcCdefghij:Lmop:rRsS-" opt; do
 			case $opt in
@@ -384,21 +385,11 @@
 	exit 1
 fi

-# TODO: is this necessary?
-# convert a (possibly) relative path to absolute
-cd $PKGDEST 2>/dev/null
-if [ $? -ne 0 ]; then
-	error "Package destination directory does not exist or permission denied."
-	exit 1
-fi
-PKGDEST=$(pwd)
-cd $OLDPWD
-
 if [ "$CLEANCACHE" = "1" ]; then
 	#fix flyspray feature request #5223
 	if [ -n "$SRCDEST" ]; then
 		msg "Cleaning up source files from the cache."
-		rm -rf "$SRCDEST"/*
+		rm -rf "$SRCDEST/*"
 		if [ $? -ne 0 ]; then
 			error "Problem removing files; you may not have correct
permissions in $SRCDEST"
 			exit 1
@@ -450,7 +441,7 @@
 	error "pkgrel is not allowed to contain hyphens."
 	exit 1
 fi
-if [ ! in_array $CARCH ${arch[@]}]; then
+if [ ! in_array $CARCH ${arch[@]} ]; then
 	error "$pkgname is not available for the '$CARCH' architecture."
 	plain "Note that many packages may need a line added to their $BUILDSCRIPT"
 	plain "such as arch=('$CARCH')."
@@ -503,7 +494,9 @@

 unset deplist makedeplist
 # fix flyspray bug #5973
-if [ $(type -p pacman) -a "$NODEPS" = "0" -a "$GENINTEG" = "0" -a
"$NOBUILD" = "0" ]; then
+if [ "$NODEPS" = "1" -o "$GENINTEG" = "1" -o "$NOBUILD" = "1" -o
"$REPKG" = "1" ]; then
+	warning "skipping dependency checks."
+elif [ $(type -p pacman) ]; then
 	msg "Checking Runtime Dependencies..."
 	deplist=$(checkdeps ${depends[@]})
 	handledeps $deplist
@@ -522,10 +515,6 @@
 	if [ $? -gt 0 ]; then
 		exit 1
 	fi
-elif [ "$GENINTEG" = "1" -o "$NOBUILD" = "1" ]; then
-	msg "skipping dependency checks."
-elif [ "$NODEPS" = "1" ]; then
-	warning "skipping dependency checks."
 else
 	warning "pacman was not found in PATH. skipping dependency checks."
 fi
@@ -585,7 +574,7 @@
 	fi
 done

-if [ "$NOEXTRACT" = "1" -o "$REPKG" ]; then
+if [ "$NOEXTRACT" = "1" -o "$REPKG" = "1" ]; then
 	warning "Skipping source integrity checks -- using existing src/ tree"
 else
 	for integ in ${INTEGRITY_CHECK[@]}; do
@@ -704,14 +693,18 @@
 			fi
 		fi
 	done
-fi
-
-if [ "$REPKG" = "0" ]; then
 	if [ "$EUID" = "0" ]; then
 		# chown all source files to root.root
 		chown -R root.root $startdir/src
 	fi
+fi

+if [ "$NOBUILD" = "1" ]; then
+	msg "Sources are ready."
+	exit 0
+elif [ "$REPKG" = "1" ]; then
+	warning "Skipping build                   -- using existing pkg/ tree"
+else
 	# check for existing pkg directory
 	if [ -d $startdir/pkg ]; then
 		msg "Removing existing pkg/ directory..."
@@ -719,11 +712,6 @@
 	fi
 	mkdir -p $startdir/pkg

-	if [ "$NOBUILD" = "1" ]; then
-		msg "Sources are ready."
-		exit 0
-	fi
-
 	# use distcc if requested
 	if [ "$USE_DISTCC" = "y" ]; then
 		[ -d /usr/lib/distcc/bin ] && export PATH=/usr/lib/distcc/bin:$PATH
@@ -794,23 +782,23 @@
 # compress man pages
 msg "Compressing man pages..."
 find $startdir/pkg/{usr{,/local},opt/*}/man -type f 2>/dev/null |
while read i ; do
-ext="${i##*.}"
-fn="${i##*/}"
-if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then
-	# update symlinks to this manpage
-	find $startdir/pkg/{usr{,/local},opt/*}/man -lname "$fn" 2>
/dev/null | while read ln ; do
-	rm -f "$ln"
-	ln -sf "${fn}.gz" "${ln}.gz"
-done
-# compress the original
-gzip -9 "$i"
+	ext="${i##*.}"
+	fn="${i##*/}"
+	if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then
+		# update symlinks to this manpage
+		find $startdir/pkg/{usr{,/local},opt/*}/man -lname "$fn" 2>
/dev/null | while read ln ; do
+			rm -f "$ln"
+			ln -sf "${fn}.gz" "${ln}.gz"
+		done
+		# compress the original
+		gzip -9 "$i"
 	fi
 done

 cd $startdir

 # strip binaries
-if [ ! "$(check_option NOSTRIP)" -a "$NOSTIP" = "0" ]; then
+if [ ! "$(check_option NOSTRIP)" -a "$NOSTRIP" = "0" ]; then
 	msg "Stripping debugging symbols from libraries..."
 	find pkg/{,usr,usr/local,opt/*}/lib -type f -not -name "*.dll" -not
-name "*.exe" \
 	-exec /usr/bin/strip --strip-debug '{}' \; 2>&1 \




More information about the pacman-dev mailing list