Patch to make makepkg keep PACMAN_OPTS environment variable, thus allowing operation to be better controlled, e.g. by an AUR- or other helper script to build packages on and install packages to a mounted guest filesystem. Signed-off-by: strake <strake888@gmail.com> --- doc/makepkg.8.txt | 3 ++ scripts/makepkg.sh.in | 75 +++++++++++++++++++++++++----------------------- 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index ffc01cd..cc10e3a 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -118,6 +118,9 @@ Options Read the package script `buildscript` instead of the `PKGBUILD` default; see linkman:PKGBUILD[5]. +*--pass-pacman_opts*:: + Pass PACMAN_OPTS environment variable to `pacman` as arguments. + *-r, \--rmdeps*:: Upon successful build, remove any dependencies installed by makepkg during dependency auto-resolution and installation when using `-s`. diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index a4e7156..c8bebce 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -78,6 +78,8 @@ SIGNPKG='' # when dealing with svn/cvs/etc PKGBUILDs. FORCE_VER="" +# Keep pacman opts in case user should tell us to pass them through +PACMAN_OPTS_ENV=${PACMAN_OPTS} PACMAN_OPTS= ### SUBROUTINES ### @@ -1764,45 +1766,46 @@ unset OPT_SHORT OPT_LONG OPT_TEMP while true; do case "$1" in # Pacman Options - --noconfirm) PACMAN_OPTS+=" --noconfirm" ;; - --noprogressbar) PACMAN_OPTS+=" --noprogressbar" ;; + --noconfirm) PACMAN_OPTS+=" --noconfirm" ;; + --noprogressbar) PACMAN_OPTS+=" --noprogressbar" ;; # Makepkg Options - --allsource) SOURCEONLY=2 ;; - --asroot) ASROOT=1 ;; - -A|--ignorearch) IGNOREARCH=1 ;; - -c|--clean) CLEANUP=1 ;; - --check) RUN_CHECK='y' ;; - --config) shift; MAKEPKG_CONF=$1 ;; - -d|--nodeps) NODEPS=1 ;; - -e|--noextract) NOEXTRACT=1 ;; - -f|--force) FORCE=1 ;; + --allsource) SOURCEONLY=2 ;; + --asroot) ASROOT=1 ;; + -A|--ignorearch) IGNOREARCH=1 ;; + -c|--clean) CLEANUP=1 ;; + --check) RUN_CHECK='y' ;; + --config) shift; MAKEPKG_CONF=$1 ;; + -d|--nodeps) NODEPS=1 ;; + -e|--noextract) NOEXTRACT=1 ;; + -f|--force) FORCE=1 ;; #hidden opt used by fakeroot call for svn/cvs/etc PKGBUILDs to set pkgver - --forcever) shift; FORCE_VER=$1;; - -F) INFAKEROOT=1 ;; - -g|--geninteg) GENINTEG=1 ;; - --holdver) HOLDVER=1 ;; - -i|--install) INSTALL=1 ;; - --key) shift; GPGKEY=$1 ;; - -L|--log) LOGGING=1 ;; - -m|--nocolor) USE_COLOR='n' ;; - --nocheck) RUN_CHECK='n' ;; - --nosign) SIGNPKG='n' ;; - -o|--nobuild) NOBUILD=1 ;; - -p) shift; BUILDFILE=$1 ;; - --pkg) shift; PKGLIST=($1) ;; - -r|--rmdeps) RMDEPS=1 ;; - -R|--repackage) REPKG=1 ;; - --skipinteg) SKIPINTEG=1 ;; - --sign) SIGNPKG='y' ;; - --source) SOURCEONLY=1 ;; - -s|--syncdeps) DEP_BIN=1 ;; - - -h|--help) usage; exit 0 ;; # E_OK - -V|--version) version; exit 0 ;; # E_OK - - --) OPT_IND=0; shift; break;; - *) usage; exit 1 ;; # E_INVALID_OPTION + --forcever) shift; FORCE_VER=$1;; + -F) INFAKEROOT=1 ;; + -g|--geninteg) GENINTEG=1 ;; + --holdver) HOLDVER=1 ;; + -i|--install) INSTALL=1 ;; + --key) shift; GPGKEY=$1 ;; + -L|--log) LOGGING=1 ;; + -m|--nocolor) USE_COLOR='n' ;; + --nocheck) RUN_CHECK='n' ;; + --nosign) SIGNPKG='n' ;; + -o|--nobuild) NOBUILD=1 ;; + -p) shift; BUILDFILE=$1 ;; + --pass-pacman_opts) shift; PACMAN_OPTS+=" ${PACMAN_OPTS_ENV}" ;; + --pkg) shift; PKGLIST=($1) ;; + -r|--rmdeps) RMDEPS=1 ;; + -R|--repackage) REPKG=1 ;; + --skipinteg) SKIPINTEG=1 ;; + --sign) SIGNPKG='y' ;; + --source) SOURCEONLY=1 ;; + -s|--syncdeps) DEP_BIN=1 ;; + + -h|--help) usage; exit 0 ;; # E_OK + -V|--version) version; exit 0 ;; # E_OK + + --) OPT_IND=0; shift; break;; + *) usage; exit 1 ;; # E_INVALID_OPTION esac shift done -- 1.7.6