[pacman-dev] CVS update of pacman-lib (4 files)

dan at archlinux.org dan at archlinux.org
Sun Feb 4 13:28:21 EST 2007


    Date: Sunday, February 4, 2007 @ 13:28:21
  Author: dan
    Path: /home/cvs-pacman/pacman-lib

Modified: AUTHORS (1.6 -> 1.7) TODO.dan (1.2 -> 1.3)
          etc/makepkg.conf.in (1.9 -> 1.10) scripts/makepkg (1.41 -> 1.42)

* Updated makepkg to use a new form of options. These two arrays now replace
  most of the former options in makepkg.conf, and are described in detail
  there:
   BUILDENV=(fakeroot !distcc color !ccache)
   OPTIONS=(strip !docs !libtool emptydirs)
  Note that PKGBUILD specified options will always have final say. They will
  now be specified as they are above, except using lowercase 'options' array.
* makepkg was fixed so options actually work as expected.


---------------------+
 AUTHORS             |    2 -
 TODO.dan            |   58 +++++++++++++++++------------------
 etc/makepkg.conf.in |   48 +++++++++++++++--------------
 scripts/makepkg     |   82 +++++++++++++++++++++++++++++++++++++-------------
 4 files changed, 117 insertions(+), 73 deletions(-)


Index: pacman-lib/AUTHORS
diff -u pacman-lib/AUTHORS:1.6 pacman-lib/AUTHORS:1.7
--- pacman-lib/AUTHORS:1.6	Fri Jan 19 04:28:44 2007
+++ pacman-lib/AUTHORS	Sun Feb  4 13:28:21 2007
@@ -1,6 +1,7 @@
 Judd Vinet <jvinet at zeroflux.org>
 Aurelien Foret <aurelien at archlinux.org>
 Aaron Griffin <aaron at archlinux.org>
+Dan McGee <dan at archlinux.org>
 
 Miklós Vajna <vmiklos at frugalware.org>
 Christian Hamar <krics at linuxforum.hu>
@@ -8,6 +9,5 @@
 Josh Wheeler <deltalima at gmail.com>
 David Kimpe <DNAku at frugalware.org>
 
-Dan McGee <dpmcgee at gmail.com>
 James Rosten <seinfeld90 at gmail.com>
 Roman Kyrylych <Roman.Kyrylych at gmail.com>
Index: pacman-lib/TODO.dan
diff -u pacman-lib/TODO.dan:1.2 pacman-lib/TODO.dan:1.3
--- pacman-lib/TODO.dan:1.2	Wed Jan 31 01:55:40 2007
+++ pacman-lib/TODO.dan	Sun Feb  4 13:28:21 2007
@@ -2,12 +2,6 @@
 This is my personal TODO list. No guarantees if it is out of date and things
   no longer apply. If you want to help out with any of it, send me an email.
 
-* Variable names in makepkg.conf--confusing
-  - some use 'USE_', others do not
-  - some are 'NO', some are 'KEEP', etc.
-  - some options use 0/1, others are y/n
-* Should undocumented makepkg (and thus PKGBUILD) options be put in the
-  manpage, as well as including sections for them in the makepkg.conf file?
 * Go through all makepkg bugs in flyspray and see if they are rectified:
   http://bugs.archlinux.org/index.php?tasks=&project=1&string=makepkg
 
@@ -19,27 +13,19 @@
 * Port the libdownload (libfetch) manpage from BSD style to Linux style, or at
   very least change references to BSD.
 
-* Revise build system to a more static one (Aaron mentioned wmii system).
-
-* NEWS file updating and cleanup. Get rid of items that are bugfixes of never-
-  released code, etc.
-
-* New cache cleaning functionality in pacman - keep installed version, choose
-  number to keep, etc. Good python script in the forums that we should try to
-  emulate, perhaps.
-* pacman - downgrade feature - allow users to see cached packages and
+* Pacman 3.1 - New cache cleaning functionality in pacman - keep installed
+  version, choose number to keep, etc. Good python script in the forums that
+  we should try to emulate, perhaps.
+* Pacman 3.1 - downgrade feature - allow users to see cached packages and
   downgrade to (previous or any?) available options.
 
-* alpm_log_action & install script logging interaction - producing duplicate
-  entries in pacman logs (possibly fixed? needs more testing but looks good)
-
-* Extreme similarity between some of the sync and add code...we have to be able
-  to abstract more away from sync actions and add actions to just 'actions'
-  (example: sync,c, add.c, and deptest.c all contain a switch on PM_DEP_MOD_*)
-
-* Merge update, add, and sync code when possible, so we reduce duplication.
+* Pacman 3.1 - Extreme similarity between some of the sync and add code...we
+  have to be able to abstract more away from sync actions and add actions to
+  just 'actions' (example: sync,c, add.c, and deptest.c all contain a switch
+  on PM_DEP_MOD_*). Merge update, add, and sync code when possible, so we
+  reduce duplication.
 
-* For Pacman 3.1 - List every function, define, etc. in libalpm. Give one
+* Pacman 3.1 - List every function, define, etc. in libalpm. Give one
   sentence description of each. If it sounds like two are similar, find a way
   to combine or refactor them. If it is unnecessary- delete it. Stop keeping
   everything clustered in little add/sync/remove parts, allow transactions to
@@ -49,14 +35,28 @@
   are still relevant, etc. Ideas for -Re (#6273), changing meaning of -c (has
   two meanings, another FS bug), etc. 
 
-* Monotone suggestion- allow changing of a branch name after commit (example:
-  I meant to commit to a new branch, but I forgot --branch option on the
-  commit.  Can I remove the original branch cert and replace it with a new
-  one?)
+* Pacman 3.1 - Possible rewrite of make system. Options:
+  -- revise to be more static (Aaron mentioned wmii's system)
+  -- Cmake? It looks intriguing
+
+* Pacman 3.1 - Rewrite _alpm_sortbydeps to use Topological Sort. Should work
+  using a standard topo sort algorithm, once the crazy types can be fixed up
+  a bit. Include a cycle check - print a big error message if this happens.
+  -- http://en.wikipedia.org/wiki/Topological_sort
+  -- http://everything2.com/?node_id=556079
 
 Quick hits:
-* log_progress and cb_trans_progress - same function? not quite but commonality
+* log_progress and cb_trans_progress - same function? not quite but close
 * unsigned int vs. unsigned
 * 'ldd' & 'ldd -u' - many linkages
 * possibly split utilities/extras from pacman package
 * makepkg3 produces files with arch appended- gensync can't deal with it
+* FS #4185 - move where message is logged, perhaps?
+* Remove -A flag (and possibly -D, -T, and -Y?)
+* ideas mentioned here - http://bbs.archlinux.org/viewtopic.php?id=29450
+  add a .install message about mirrors, maybe comment whole file, encourage
+  rankmirrors usage
+* update copyrights
+* update pacman website
+* finish pacman coding style page
+* make indent.pro file for GNU indent
Index: pacman-lib/etc/makepkg.conf.in
diff -u pacman-lib/etc/makepkg.conf.in:1.9 pacman-lib/etc/makepkg.conf.in:1.10
--- pacman-lib/etc/makepkg.conf.in:1.9	Sat Feb  3 00:23:27 2007
+++ pacman-lib/etc/makepkg.conf.in	Sun Feb  4 13:28:21 2007
@@ -1,4 +1,4 @@
-# vim: set ft=sh ts=2 sw=2 et:
+#
 # /etc/makepkg.conf
 #
 
@@ -31,36 +31,38 @@
 # BUILD ENVIRONMENT
 #########################################################################
 #
-#-- Fakeroot: for building packages as a non-root user
-USE_FAKEROOT="y"
-#-- DistCC: a distributed C/C++/ObjC compiler (modify MAKEFLAGS too)
-USE_DISTCC="n"
-#-- A space-delimited list of hosts running in the DistCC cluster
-DISTCC_HOSTS=""
-#-- Colorized output messages
-USE_COLOR="y"
-#-- Use ccache when building
-USE_CCACHE=0
+# Defaults: ENVIRONMENT=(!fakeroot !distcc color !ccache)
+#
+#-- fakeroot: Allow building packages as a non-root user
+#-- distcc:   Use the Distributed C/C++/ObjC compiler
+#-- color:    Colorize output messages
+#-- ccache:   Use ccache to cache compilation
+#
+BUILDENV=(fakeroot !distcc color !ccache)
+#
+#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
+#-- specify a space-delimited list of hosts running in the DistCC cluster.
+#DISTCC_HOSTS=""
 
 #########################################################################
 # GLOBAL PACKAGE OPTIONS
 #   These are default values for the options=() settings
 #########################################################################
 #
-#-- Don't strip symbols from binaries/libraries
-NOSTRIP=0
-#-- Keep doc and info directories
-KEEPDOCS=0
-#-- Don't remove libtool files?
-NOLIBTOOL=0
-#-- Don't remove empty directories from package?
-NOEMPTYDIRS=0
+# Default: OPTIONS=(strip !docs !libtool emptydirs)
+#
+#-- strip:     Strip symbols from binaries/libraries
+#-- docs:      Save doc and info directories
+#-- libtool:   Leave libtool (.la) files in binaries
+#-- emptydirs: Leave empty directories in binaries
+#
+OPTIONS=(strip !docs !libtool emptydirs)
+
 #-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
-INTEGRITY_CHECK=(md5)
-#-- Info and doc directories to be removed
+INTEGRITY_CHECK=(md5 sha1)
+#-- Info and doc directories to remove (if option set correctly above)
 DOC_DIRS=(usr/{,share/}{info,doc} opt/gnome/{,share/}{info,doc,gtk-doc})
 
-
 #########################################################################
 # PACKAGE OUTPUT
 #########################################################################
@@ -71,3 +73,5 @@
 #SRCDEST=/var/cache/pacman/src
 #-- Packager: name/email of the person or organization building packages
 #PACKAGER="John Doe <john at doe.com>"
+
+# vim: set ft=sh ts=2 sw=2 et:
Index: pacman-lib/scripts/makepkg
diff -u pacman-lib/scripts/makepkg:1.41 pacman-lib/scripts/makepkg:1.42
--- pacman-lib/scripts/makepkg:1.41	Sat Feb  3 00:21:55 2007
+++ pacman-lib/scripts/makepkg	Sun Feb  4 13:28:21 2007
@@ -32,7 +32,7 @@
 PKGEXT="pkg.tar.gz"
 
 source "/etc/abs/abs.conf"
-SRCROOT=$ABSROOT
+SRCROOT="$ABSROOT"
 
 # Options
 CLEANUP=0
@@ -63,7 +63,7 @@
 ### SUBROUTINES ###
 
 plain() {
-	if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then
+	if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then
 		echo -e "    \033[1;1m$1\033[1;0m" >&2
 	else
 		echo "    $1" >&2
@@ -71,7 +71,7 @@
 }
 
 msg() {
-	if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then
+	if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then
 		echo -e "\033[1;32m==>\033[1;0m \033[1;1m$1\033[1;0m" >&2
 	else
 		echo "==> $1" >&2
@@ -79,7 +79,7 @@
 }
 
 msg2() {
-	if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then
+	if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then
 		echo -e "   \033[1;34m->\033[1;0m \033[1;1m$1\033[1;0m" >&2
 	else
 		echo "   -> $1" >&2
@@ -87,7 +87,7 @@
 }
 
 warning() {
-	if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then
+	if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then
 		echo -e "\033[1;33m==> WARNING:\033[1;0m \033[1;1m$1\033[1;0m" >&2
 	else
 		echo "==> WARNING: $1" >&2
@@ -95,7 +95,7 @@
 }
 
 error() {
-	if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then
+	if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then
 		echo -e "\033[1;31m==> ERROR:\033[1;0m \033[1;1m$1\033[1;0m" >&2
 	else
 		echo "==> ERROR: $1" >&2
@@ -106,16 +106,54 @@
 	echo "$1" | sed 's|^.*://.*/||g'
 }
 
+# checks to see if options are present in makepkg.conf or PKGBUILD;
+#   PKGBUILD options always take precedence
 check_option() {
+	local needle=$(echo $1 | tr [:upper:] [:lower:])
 	local i
+	# loop PKGBUILD opts first so it overrides makepkg.conf
 	for i in ${options[@]}; do
-		local uc=$(echo $i | tr [:lower:] [:upper:])
 		local lc=$(echo $i | tr [:upper:] [:lower:])
-		if [ "$uc" = "$1" -o "$lc" = "$1" ]; then
-			echo $1
+		if [ "$lc" = "$needle" ]; then
+			echo "y"
+			return
+		elif [ "$lc" = "!$needle" ]; then
+			echo "n"
+			return
+		fi
+	done
+	# fall back to makepkg.conf options
+	for i in ${OPTIONS[@]}; do
+		local lc=$(echo $i | tr [:upper:] [:lower:])
+		if [ "$lc" = "$needle" ]; then
+			echo "y"
+			return
+		elif [ "$lc" = "!$needle" ]; then
+			echo "n"
+			return
+		fi
+	done
+	echo "unknown"
+	return
+}
+
+# check if option is present in BUILDENV
+check_buildenv() {
+	local needle=$(echo $1 | tr [:upper:] [:lower:])
+	local i
+	# use options from makepkg.conf
+	for i in ${BUILDENV[@]}; do
+		local lc=$(echo $i | tr [:upper:] [:lower:])
+		if [ "$lc" = "$needle" ]; then
+			echo "y"
+			return
+		elif [ "$lc" = "!$needle" ]; then
+			echo "n"
 			return
 		fi
 	done
+	echo "unknown"
+	return
 }
 
 in_array() {
@@ -123,7 +161,7 @@
 	shift 1
 	[ -z "$1" ] && return 1
 	for i in $*; do
-		[ "$i" == "$needle" ] && return 0
+		[ "$i" = "$needle" ] && return 0
 	done
 	return 1
 }
@@ -347,7 +385,7 @@
 		--syncdeps)   DEP_BIN=1 ;;
 		--sudosync)   DEP_SUDO=1 ;;
 		--builddeps)  DEP_SRC=1 ;;
-		--noccache)   USE_CCACHE=0 ;;
+		--noccache)   USE_CCACHE="n" ;;
 		--nodeps)     NODEPS=1 ;;
 		--noextract)  NOEXTRACT=1 ;;
 		--install)    INSTALL=1 ;;
@@ -370,7 +408,7 @@
 		while getopts "bBcCdefghij:Lmop:rRsS-" opt; do
 			case $opt in
 				b) DEP_SRC=1 ;;
-				B) USE_CCACHE=0 ;;
+				B) USE_CCACHE="n" ;;
 				c) CLEANUP=1 ;;
 				C) CLEANCACHE=1 ;;
 				d) NODEPS=1 ;;
@@ -498,7 +536,7 @@
 # Enter the fakeroot environment if necessary.  This will call the makepkg script again
 # as the fake root user.  We detect this by passing a sentinel option (-F) to makepkg
 if [ "$EUID" != "0" ]; then
-	if [ "$USE_FAKEROOT" = "y" -o "$USE_FAKEROOT" = "Y" ]; then
+	if [ "$(check_buildenv fakeroot)" = "y" ]; then
 		if [ $(type -p fakeroot) ]; then
 			msg "Entering fakeroot environment"
 			fakeroot -- $0 -F $ARGLIST
@@ -514,7 +552,7 @@
 	else
 		warning "Running makepkg as an unprivileged user will result in non-root"		
 		plain "ownership of the packaged files.  Try using the fakeroot"
-		plain "environment.  (USE_FAKEROOT=y in makepkg.conf)"
+		plain "environment.  ('fakeroot' in BUILDENV in makepkg.conf)"
 		plain ""
 		sleep 1
 	fi
@@ -746,12 +784,13 @@
 	mkdir -p $startdir/pkg
 
 	# use distcc if requested
-	if [ "$USE_DISTCC" = "y" ]; then
+	if [ "$(check_buildenv distcc)" = "y" ]; then
 		[ -d /usr/lib/distcc/bin ] && export PATH=/usr/lib/distcc/bin:$PATH
 	fi
 
 	# use ccache if it's available
-	if [ "$USE_CCACHE" = "1" ]; then
+	#  USE_CCACHE still here because it is a command line option
+	if [ ! "$USE_CCACHE" = "n" -a "$(check_buildenv ccache)" = "y" ]; then
 		[ -d /usr/lib/ccache/bin ] && export PATH=/usr/lib/ccache/bin:$PATH
 	fi
 
@@ -799,7 +838,7 @@
 	fi
 fi
 
-if [ ! "$(check_option KEEPDOCS)" -a "$KEEPDOCS" = "0" ]; then
+if [ "$(check_option docs)" = "n" ]; then
 	# remove info/doc files
 	msg "Removing info/doc files..."
 	cd $startdir/pkg
@@ -833,7 +872,7 @@
 cd $startdir
 
 # strip binaries
-if [ ! "$(check_option NOSTRIP)" -a "$NOSTRIP" = "0" ]; then
+if [ "$(check_option strip)" = "y" ]; 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 \
@@ -845,15 +884,16 @@
 fi
 
 # remove libtool (.la) files
-if [ "$(check_option NOLIBTOOL)" -a "$NOLIBTOOL" = "1" ]; then
+if [ "$(check_option libtool)" = "n" ]; then
 	msg "Removing libtool .la files..."
 	find pkg -type f -name "*.la" -exec rm -f -- '{}' \;
 fi
 
 # remove empty directories
-if [ "$(check_option NOEMPTYDIRS)" -a "$NOEMPTYDIRS" = 1 ]; then
+if [ "$(check_option emptydirs)" = "n" ]; then
 	msg "Removing empty directories..."
-	find pkg -depth -type d -empty -delete;
+	cd "$startdir/pkg"
+	find -depth -type d -empty -delete;
 fi
 
 # get some package meta info




More information about the pacman-dev mailing list