From 9c9e18ef32c0cf3fe33ed251d28c70651bb85f65 Mon Sep 17 00:00:00 2001 From: Andrew Fyfe Date: Mon, 2 Apr 2007 00:55:01 +0100 Subject: Tidy up usage of makepkg.conf Moved the following variables into /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 Signed-off-by: Dan McGee --- etc/makepkg.conf.in | 12 ++++++++++++ scripts/gensync | 22 +++++++++++++++++----- scripts/makepkg.in | 25 +++++++++++++++---------- scripts/repo-add | 15 ++++++++++++--- scripts/repo-remove | 15 ++++++++++++--- scripts/updatesync | 21 ++++++++++++++++----- 6 files changed, 84 insertions(+), 26 deletions(-) diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 9ac0ef2d..6f9e9776 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -75,4 +75,16 @@ DOC_DIRS=(usr/{,share/}{info,doc,gtk-doc} opt/gnome/{,share/}{info,doc,gtk-doc}) #-- Packager: name/email of the person or organization building packages #PACKAGER="John Doe " +######################################################################### +# BUILDSCRIPT/EXTENSION DEFAULTS +######################################################################### +# +# WARNING: Do NOT modify these variables unless you know what you are +# doing. +# +BUILDSCRIPT="PKGBUILD" +PKGEXT=".pkg.tar.gz" +DB_COMPRESSION="gz" +DB_CHECKSUMS=(md5) + # vim: set ft=sh ts=2 sw=2 et: diff --git a/scripts/gensync b/scripts/gensync index 5a3dab88..f99cf597 100755 --- a/scripts/gensync +++ b/scripts/gensync @@ -22,6 +22,8 @@ myver='3.0.0' +# functions + usage() { echo "gensync $myver" echo "usage: $0 [package_directory]" @@ -45,11 +47,6 @@ usage() { exit 0 } -BUILDSCRIPT="PKGBUILD" -PKGEXT="pkg.tar.gz" - -source /etc/makepkg.conf - error () { echo "==> ERROR: $*" >&2 } @@ -70,6 +67,8 @@ check_force () { false } +# PROGRAM START + if [ $# -lt 2 ]; then usage exit 1 @@ -80,6 +79,19 @@ if [ "$1" = "-h" -o "$1" = "--help" ]; then exit 0 fi +# source system and user makepkg.conf +if [ -r /etc/makepkg.conf ]; then + source /etc/makepkg.conf +else + echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2 + exit 1 # $E_CONFIG_ERROR # TODO: error codes +fi + +if [ -r ~/.makepkg.conf ]; then + source ~/.makepkg.conf +fi + + d=$(dirname $1) rootdir="$(cd $d && pwd)/$(basename $1)" d="$(dirname $2)" diff --git a/scripts/makepkg.in b/scripts/makepkg.in index 17a500bc..62a2a444 100755 --- a/scripts/makepkg.in +++ b/scripts/makepkg.in @@ -36,11 +36,16 @@ export TEXTDOMAINDIR myver='3.0.0' startdir=$(pwd) -BUILDSCRIPT="PKGBUILD" -PKGEXT="pkg.tar.gz" - -source "/etc/abs/abs.conf" -SRCROOT="$ABSROOT" +# Only use ABSROOT if we haven't been passed a SRCROOT on the command line. +if [ -z "$SRCROOT" ]; then + if [ -r /etc/abs/abs.conf ]; then + source /etc/abs/abs.conf + fi + if [ -r ~/.abs.conf ]; then + source ~/.abs.conf + fi + SRCROOT=$ABSROOT +fi # Options CLEANUP=0 @@ -418,16 +423,16 @@ ARGLIST=$@ _PKGDEST=${PKGDEST} _SRCDEST=${SRCDEST} -#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 "$(gettext "/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 user-specific makepkg.conf overrides +if [ -r ~/.makepkg.conf ]; then source ~/.makepkg.conf fi diff --git a/scripts/repo-add b/scripts/repo-add index dc280161..8b81c34e 100755 --- a/scripts/repo-add +++ b/scripts/repo-add @@ -23,9 +23,6 @@ myver='3.0.0' FORCE=0 REPO_DB_FILE="" - -DB_COMPRESSION="gz" #TODO this is gross -DB_CHECKSUMS=(md5) TMP_DIR="" # print usage instructions @@ -224,6 +221,18 @@ if [ $# -lt 2 ]; then exit 1 fi +# source system and user makepkg.conf +if [ -r /etc/makepkg.conf ]; then + source /etc/makepkg.conf +else + echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2 + exit 1 # $E_CONFIG_ERROR # TODO: error codes +fi + +if [ -r ~/.makepkg.conf ]; then + source ~/.makepkg.conf +fi + # main routine if [ $# -gt 1 ]; then gstmpdir=$(mktemp -d /tmp/gensync.XXXXXXXXXX) || (\ diff --git a/scripts/repo-remove b/scripts/repo-remove index eeee2406..37079d99 100755 --- a/scripts/repo-remove +++ b/scripts/repo-remove @@ -23,9 +23,6 @@ myver='3.0.0' FORCE=0 REPO_DB_FILE="" - -DB_COMPRESSION="gz" #TODO this is gross -DB_CHECKSUMS=(md5) TMP_DIR="" # print usage instructions @@ -80,6 +77,18 @@ if [ $# -lt 2 ]; then exit 1 fi +# source system and user makepkg.conf +if [ -r /etc/makepkg.conf ]; then + source /etc/makepkg.conf +else + echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2 + exit 1 # $E_CONFIG_ERROR # TODO: error codes +fi + +if [ -r ~/.makepkg.conf ]; then + source ~/.makepkg.conf +fi + # main routine if [ $# -gt 1 ]; then gstmpdir=$(mktemp -d /tmp/gensync.XXXXXXXXXX) || (\ diff --git a/scripts/updatesync b/scripts/updatesync index a4a6847f..7c6dab27 100755 --- a/scripts/updatesync +++ b/scripts/updatesync @@ -23,6 +23,8 @@ myver='3.0.0' +# functions + usage() { echo "updatesync $myver" echo "usage: $0