summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-02-04 19:28:21 +0100
committerDan McGee <dan@archlinux.org>2007-02-04 19:28:21 +0100
commitb1cc72ebb3226f300c7432b742b05942f050532f (patch)
treeaa846f0393ddedb482667a8ce064f49bb25ee2f2
parent1bb3cd34bfc8c00809e42b4ff084f56b59093fb5 (diff)
downloadpacman-b1cc72ebb3226f300c7432b742b05942f050532f.tar.gz
pacman-b1cc72ebb3226f300c7432b742b05942f050532f.tar.xz
* 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.
-rw-r--r--AUTHORS2
-rw-r--r--TODO.dan58
-rw-r--r--etc/makepkg.conf.in48
-rwxr-xr-xscripts/makepkg82
4 files changed, 117 insertions, 73 deletions
diff --git a/AUTHORS b/AUTHORS
index e01c9097..df16a8df 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,6 +1,7 @@
Judd Vinet <jvinet@zeroflux.org>
Aurelien Foret <aurelien@archlinux.org>
Aaron Griffin <aaron@archlinux.org>
+Dan McGee <dan@archlinux.org>
Miklós Vajna <vmiklos@frugalware.org>
Christian Hamar <krics@linuxforum.hu>
@@ -8,6 +9,5 @@ Christian Hamar <krics@linuxforum.hu>
Josh Wheeler <deltalima@gmail.com>
David Kimpe <DNAku@frugalware.org>
-Dan McGee <dpmcgee@gmail.com>
James Rosten <seinfeld90@gmail.com>
Roman Kyrylych <Roman.Kyrylych@gmail.com>
diff --git a/TODO.dan b/TODO.dan
index 36c2c79e..e3186e69 100644
--- a/TODO.dan
+++ b/TODO.dan
@@ -2,12 +2,6 @@ TODO.dan
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 @@ This is my personal TODO list. No guarantees if it is out of date and things
* 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_*)
+* 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.
-* 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 @@ This is my personal TODO list. No guarantees if it is out of date and things
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
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index 393205f6..127e79a5 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -1,4 +1,4 @@
-# vim: set ft=sh ts=2 sw=2 et:
+#
# /etc/makepkg.conf
#
@@ -31,36 +31,38 @@ CXXFLAGS="-@MARCHFLAG@=@CARCHFLAGS@ -O2 -pipe"
# 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 @@ DOC_DIRS=(usr/{,share/}{info,doc} opt/gnome/{,share/}{info,doc,gtk-doc})
#SRCDEST=/var/cache/pacman/src
#-- Packager: name/email of the person or organization building packages
#PACKAGER="John Doe <john@doe.com>"
+
+# vim: set ft=sh ts=2 sw=2 et:
diff --git a/scripts/makepkg b/scripts/makepkg
index ec1b2267..b5732433 100755
--- a/scripts/makepkg
+++ b/scripts/makepkg
@@ -32,7 +32,7 @@ BUILDSCRIPT="PKGBUILD"
PKGEXT="pkg.tar.gz"
source "/etc/abs/abs.conf"
-SRCROOT=$ABSROOT
+SRCROOT="$ABSROOT"
# Options
CLEANUP=0
@@ -63,7 +63,7 @@ fi
### 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 @@ plain() {
}
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 @@ msg() {
}
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 @@ msg2() {
}
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 @@ warning() {
}
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 @@ strip_url() {
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 @@ in_array() {
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 @@ while [ "$#" -ne "0" ]; do
--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 [ "$#" -ne "0" ]; do
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 @@ fi
# 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 @@ if [ "$EUID" != "0" ]; then
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 @@ else
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 @@ else
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 @@ done
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 @@ if [ ! "$(check_option NOSTRIP)" -a "$NOSTRIP" = "0" ]; then
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