[pacman-dev] makepkg: keep PACMAN_OPTS in environment
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. --- pacman-3.5.3_/scripts/makepkg.sh.in 2011-06-07 10:49:28.000000000 -0500 +++ pacman-3.5.3/scripts/makepkg.sh.in 2011-07-27 09:33:11.413361098 -0500 @@ -80,8 +80,6 @@ # when dealing with svn/cvs/etc PKGBUILDs. FORCE_VER="" -PACMAN_OPTS= - ### SUBROUTINES ### plain() { Cheers, Matthew Farkas-Dyck
On Wed, Jul 27, 2011 at 10:31:30AM -0500, Matthew Farkas-Dyck wrote:
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.
--- pacman-3.5.3_/scripts/makepkg.sh.in 2011-06-07 10:49:28.000000000 -0500 +++ pacman-3.5.3/scripts/makepkg.sh.in 2011-07-27 09:33:11.413361098 -0500 @@ -80,8 +80,6 @@ # when dealing with svn/cvs/etc PKGBUILDs. FORCE_VER=""
-PACMAN_OPTS= - ### SUBROUTINES ###
plain() {
Cheers, Matthew Farkas-Dyck
A few things: 1) We accept properly formatted patches against our git repository: http://www.archlinux.org/pacman/submitting-patches.html The source of makepkg has changed significantly as since v3.5.3, there's been 505 commits with 10% of those going to makepkg. 2) This would be an undocumented feature that should be called out in the man page. 3) Not sure I agree with this change in execution as randomly pulling in environment variables can and will cause trouble. I'd rather see this implemented as an additional flag to makepkg. dave
On 28/07/11 01:49, Dave Reisner wrote:
On Wed, Jul 27, 2011 at 10:31:30AM -0500, Matthew Farkas-Dyck wrote:
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.
--- pacman-3.5.3_/scripts/makepkg.sh.in 2011-06-07 10:49:28.000000000 -0500 +++ pacman-3.5.3/scripts/makepkg.sh.in 2011-07-27 09:33:11.413361098 -0500 @@ -80,8 +80,6 @@ # when dealing with svn/cvs/etc PKGBUILDs. FORCE_VER=""
-PACMAN_OPTS= - ### SUBROUTINES ###
plain() {
Cheers, Matthew Farkas-Dyck
A few things:
1) We accept properly formatted patches against our git repository:
http://www.archlinux.org/pacman/submitting-patches.html
The source of makepkg has changed significantly as since v3.5.3, there's been 505 commits with 10% of those going to makepkg.
2) This would be an undocumented feature that should be called out in the man page.
3) Not sure I agree with this change in execution as randomly pulling in environment variables can and will cause trouble. I'd rather see this implemented as an additional flag to makepkg.
PACMAN="pacman --asdep" makepkg -i ==> WARNING: A package has already been built, installing existing
Hmm.... I thought we maybe already had this feature... package... ==> Installing package python-six with pacman --asdep -U... sudo: pacman --asdep: command not found So that does not work... but it would be probably be a very minimal change to make it do so. But I am still not entirely sure what is trying to be achieved here. If you want to build and install packages on a mounted filesystem, you need to chroot to that filesystem. Otherwise, you a building locally. So using --root as a flag is probably not enough anyway... Allan
If the filesystem is not of the same architecture, then one cannot use the chroot method. However, one could cross-compile with an alternate makepkg.conf and then install to the guest system with "pacman -r guest_path". On 29 July 2011 03:33, Allan McRae <allan@archlinux.org> wrote:
On 28/07/11 01:49, Dave Reisner wrote:
On Wed, Jul 27, 2011 at 10:31:30AM -0500, Matthew Farkas-Dyck wrote:
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.
--- pacman-3.5.3_/scripts/makepkg.sh.in 2011-06-07 10:49:28.000000000 -0500 +++ pacman-3.5.3/scripts/makepkg.sh.in 2011-07-27 09:33:11.413361098 -0500 @@ -80,8 +80,6 @@ # when dealing with svn/cvs/etc PKGBUILDs. FORCE_VER=""
-PACMAN_OPTS= - ### SUBROUTINES ###
plain() {
Cheers, Matthew Farkas-Dyck
A few things:
1) We accept properly formatted patches against our git repository:
http://www.archlinux.org/pacman/submitting-patches.html
The source of makepkg has changed significantly as since v3.5.3, there's been 505 commits with 10% of those going to makepkg.
2) This would be an undocumented feature that should be called out in the man page.
3) Not sure I agree with this change in execution as randomly pulling in environment variables can and will cause trouble. I'd rather see this implemented as an additional flag to makepkg.
Hmm.... I thought we maybe already had this feature...
PACMAN="pacman --asdep" makepkg -i ==> WARNING: A package has already been built, installing existing package... ==> Installing package python-six with pacman --asdep -U... sudo: pacman --asdep: command not found
So that does not work... but it would be probably be a very minimal change to make it do so.
But I am still not entirely sure what is trying to be achieved here. If you want to build and install packages on a mounted filesystem, you need to chroot to that filesystem. Otherwise, you a building locally. So using --root as a flag is probably not enough anyway...
Allan
-- Matthew Farkas-Dyck
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
participants (3)
-
Allan McRae
-
Dave Reisner
-
Matthew Farkas-Dyck