[pacman-dev] [patch] Cleanup makepkg.conf options and loading of makepkg.conf.
Dan McGee
dpmcgee at gmail.com
Fri Mar 30 14:39:10 EDT 2007
On 3/29/07, Andrew Fyfe <andrew at neptune-one.net> wrote:
> Moved the following vars in /etc/makepkg.conf
> * BUILDSCRIPT
> * PKGEXT
> * DB_COMPRESSION
> * DB_CHECKSUMS
>
> Cleaned up sourcing of /etc/makepkg.conf in scripts and source
> ~/.makepkg.conf if it exists.
>
> Signed-off-by: Andrew Fyfe <andrew at neptune-one.net>
> -#Source makepkg.conf; fail if it is not found
> -if [ -f /etc/makepkg.conf ]; then
> +# Source makepkg.conf; fail if it is not found
> +if [ -r /etc/makepkg.conf ]; then
> source /etc/makepkg.conf
> else
> error "/etc/makepkg.conf not found. cannot continue"
> - exit 1
> + exit 1 # $E_CONFIG_ERROR # TODO: error codes
> fi
>
> -#Source user-specific makepkg.conf overrides
> -if [ -f ~/.makepkg.conf ]; then
> - source ~/.makepkg.conf
> -fi
> +# Source user-specific makepkg.conf overrides
> +[ -r ~/.makepkg.conf ] && source ~/.makepkg.conf
Quick comments on this. First, great catch on switching from -f to -r.
We should do this in all our scripts if necessary, just to catch
stupid mistakes. I did have to look up what -r did but now it makes
perfect sense (file exists and read permission is granted).
Although that one line source of ~/.makepkg.conf is nice, I personally
prefer the longer more drawn out way- it is immediately clear what is
happening, the second one uses bash semantics a bit too much for my
taste. It also doesn't allow for easy addition of an else clause
should that ever arise. Basically I'm saying keep it the way it was
(besides the -r).
-Dan
More information about the pacman-dev
mailing list