On 11/20/2009 05:14 AM, Allan McRae wrote:
Cedric Staniewski wrote:
If PACMAN environment variable is set, makepkg will try to use this command to check for installed dependencies and to install or remove packages. Otherwise, makepkg will fall back to pacman.
Implements FS#13028.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Looks good. A couple of comments below. We also need to document the behaviour of the PACMAN environmental variable in the makepkg man page.
First of all, thanks for your comments and sorry for the late response. I will send a new patch which addresses the remaining issues later on today.
--- scripts/makepkg.sh.in | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 3b7966e..d05b608 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -333,10 +333,10 @@ download_file() {
run_pacman() { local ret=0 - if (( ! ASROOT )) && [[ $1 != "-T" ]]; then - sudo pacman $PACMAN_OPTS "$@" || ret=$? + if (( ! ASROOT )) && [[ $1 != "-T" ]] && sudo -l $PACMAN &>/dev/null; then
This change is behaviour in checking for sudo privileges needs to be a separate patch.
Ok.
+ sudo $PACMAN $PACMAN_OPTS "$@" || ret=$? else - pacman $PACMAN_OPTS "$@" || ret=$? + $PACMAN $PACMAN_OPTS "$@" || ret=$? fi return $ret } @@ -350,7 +350,7 @@ check_deps() { if (( ret == 127 )); then #unresolved deps echo "$pmout" elif (( ret )); then - error "$(gettext "Pacman returned a fatal error (%i): %s")" "$ret" "$pmout" + error "$(gettext "%s returned a fatal error (%i): %s")" "${PACMAN##*/}" "$ret" "$pmout"
Should we also strip any flags provided in the PACMAN variable? e.g. I could set PACMAN="pacman -v" for verbose output. I guess some wrappers might have flags that would be useful to specify.
See http://mailman.archlinux.org/pipermail/pacman-dev/2009-December/010208.html