summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2019-08-09 14:31:53 -0400
committerLevente Polyak <anthraxx@archlinux.org>2019-11-07 21:28:21 +0100
commit751093eff2cbd0df422b69810787b4fcf3d33208 (patch)
tree1d459c815e8b9506e7775bcf12b0d46cdea7aa86
parentf43a86ee8a3a3bfbdc32c2d70516d945afcd8515 (diff)
downloaddevtools32-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>
-rw-r--r--makechrootpkg.in34
-rwxr-xr-xoffload-build9
2 files changed, 14 insertions, 29 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
diff --git a/offload-build b/offload-build
index 7a07b15..078796a 100755
--- a/offload-build
+++ b/offload-build
@@ -18,6 +18,8 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
+source /usr/share/makepkg/util/config.sh
+
# global defaults suitable for use by Arch staff
repo=extra
@@ -105,4 +107,9 @@ mapfile -t files < <(
makepkg --packagelist
')
-(( ${#files[@]} )) && printf '%s\n' '' '-> copying files...' && scp "${files[@]/#/$server:}" .
+
+if (( ${#files[@]} )); then
+ printf '%s\n' '' '-> copying files...'
+ load_makepkg_config
+ scp "${files[@]/#/$server:}" "${PKGDEST:-${PWD}}/"
+fi