diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2019-08-09 14:31:53 -0400 |
---|---|---|
committer | Levente Polyak <anthraxx@archlinux.org> | 2019-11-07 21:28:21 +0100 |
commit | 751093eff2cbd0df422b69810787b4fcf3d33208 (patch) | |
tree | 1d459c815e8b9506e7775bcf12b0d46cdea7aa86 /makechrootpkg.in | |
parent | f43a86ee8a3a3bfbdc32c2d70516d945afcd8515 (diff) | |
download | devtools32-751093eff2cbd0df422b69810787b4fcf3d33208.tar.xz |
use libmakepkg to find and use variables in makepkg.conf
- drop homebrew function in makechrootpkg
- use better mock to find invoking user's $HOME
- make offload-build respect makepkg.conf to determine where to sync
files, matching the behavior of makechrootpkg
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Diffstat (limited to 'makechrootpkg.in')
-rw-r--r-- | makechrootpkg.in | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in index f5a0e51..b3a1854 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -13,6 +13,8 @@ m4_include(lib/common.sh) m4_include(lib/archroot.sh) +source /usr/share/makepkg/util/config.sh + shopt -s nullglob default_makepkg_args=(--syncdeps --noconfirm --log --holdver --skipinteg) @@ -80,26 +82,6 @@ usage() { } # {{{ functions -# Usage: load_vars $makepkg_conf -# Globals: -# - SRCDEST -# - SRCPKGDEST -# - PKGDEST -# - LOGDEST -# - MAKEFLAGS -# - PACKAGER -load_vars() { - local makepkg_conf="$1" var - - [[ -f $makepkg_conf ]] || return 1 - - for var in {SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER; do - [[ -z ${!var:-} ]] && eval "$(source "$makepkg_conf"; printf "%s='%s'" "$var" "${!var}")" - done - - return 0 -} - # Usage: sync_chroot $chrootdir $copydir [$copy] sync_chroot() { local chrootdir=$1 @@ -338,16 +320,12 @@ for arg in "${@:$OPTIND}"; do esac done -if [[ -n $SUDO_USER ]]; then - eval "USER_HOME=~$SUDO_USER" -else - USER_HOME=$HOME -fi - umask 0022 -load_vars "${XDG_CONFIG_HOME:-$USER_HOME/.config}/pacman/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf" -load_vars /etc/makepkg.conf +ORIG_HOME=$HOME +IFS=: read -r _ _ _ _ _ HOME _ < <(getent passwd "${SUDO_USER:-$USER}") +load_makepkg_config +HOME=$ORIG_HOME # Use PKGBUILD directory if these don't exist [[ -d $PKGDEST ]] || PKGDEST=$PWD |