pacman/scripts
Eli Schwartz c50ce453dc makepkg: reorganize the restoration of settings by precedence
The extra variables on the commandline were inconsistently applied. They
should override anything else, instead, most were overridden by
environment variables with the exception of BUILDDIR (and this was not
sanity-checked to see if it had write permissions).

e.g. given the commandline:
`PKGDEST="$(pwd)"` BUILDDIR="$(pwd)" makepkg PKGDEST=/doesnt/exist BUILDDIR=/doesnt/exist`

We would incorrectly use the current working directory for PKGDEST.
Meanwhile, we checked the wrong directory for BUILDDIR, and later
errored when we tried to create $srcdir inside the non-writable
directory "/doesnt/exist".

In order to fix this, use the preferred bash builtin for saving variable
definitions, similar to how we restore traps etc. rather than tediously
redefining each one by hand, and restore this immediately after
makepkg.conf is sourced. Finally, the `make`-style commandline overrides
are applied.

Also canonicalize_path is applied only on the final paths we try to use.
While it is unlikely the value in makepkg.conf will be a relative path,
since we now properly respect commandline overrides, they should be
canonicalized as well.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2017-12-07 15:06:10 +10:00
..
completion Move bash/zsh completion out of contrib 2016-10-10 10:38:05 +10:00
libmakepkg makepkg: implement error codes 2017-12-07 14:55:35 +10:00
library makepkg: Move parseopts from library to libmakepkg 2016-10-22 20:50:54 +10:00
po makepkg: warn about dotfiles in package root 2017-01-04 13:59:14 +10:00
.gitignore makepkg: Move parseopts from library to libmakepkg 2016-10-22 20:50:54 +10:00
Makefile.am makepkg: implement error codes 2017-12-07 14:55:35 +10:00
makepkg-template.pl.in Update copyright years 2017-01-04 13:59:14 +10:00
makepkg.sh.in makepkg: reorganize the restoration of settings by precedence 2017-12-07 15:06:10 +10:00
pacman-db-upgrade.sh.in Update copyright years 2017-01-04 13:59:14 +10:00
pacman-key.sh.in Update copyright years 2017-01-04 13:59:14 +10:00
pkgdelta.sh.in Replace @SIZECMD@ with POSIX-compatible command 2017-04-04 12:21:20 +10:00
repo-add.sh.in Replace @SIZECMD@ with POSIX-compatible command 2017-04-04 12:21:20 +10:00
wrapper.sh.in Update copyright years 2017-01-04 13:59:14 +10:00