[pacman-dev] [PATCH 2/2 v2] Save path to $PACMAN, to avoid losing access due to --syncdeps
Allan McRae
allan at archlinux.org
Sun Nov 11 18:54:55 EST 2012
On 12/11/12 09:51, Martin Panter wrote:
> On 11 November 2012 23:21, Allan McRae <allan at archlinux.org> wrote:
>> On 12/11/12 08:37, Martin Panter wrote:
>>> Unmangled version: https://github.com/vadmium/pacman-arch/commit/3992a1d.patch
>>>
>>> From 3992a1dc7a40c4eefed99ae82e7c682babb4d01b Mon Sep 17 00:00:00 2001
>>> From: Martin Panter <vadmium à gmail·com>
>>> Date: Wed, 31 Oct 2012 02:45:36 +0000
>>> Subject: [PATCH] Save path to $PACMAN, to avoid losing access due to
>>> --syncdeps
>>>
>>> ---
>>> scripts/makepkg.sh.in | 7 ++++++-
>>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>> index 0f266df..9c6c0ae 100644
>>> --- a/scripts/makepkg.sh.in
>>> +++ b/scripts/makepkg.sh.in
>>> @@ -2728,7 +2728,12 @@ if (( NODEPS || (NOBUILD && !DEP_BIN ) )); then
>>> if (( NODEPS )); then
>>> warning "$(gettext "Skipping dependency checks.")"
>>> fi
>>> -elif type -p "$PACMAN" >/dev/null; then
>>> +elif output="$(command -v "$PACMAN")"; then
>>
>> NACK.
>>
>>> command -v pacman
>> alias pacman='sudo pacman'
>
> Hi Allan, do you really use that alias inside “makepkg”? Where do you
> have that alias defined? I can’t see how it could get inside the
> script, unless there’s some magic way of exporting aliases or
> something. A quick read of the Bash man page suggests that ~/.bashrc,
> ~/.profile, etc are only read for interactive (or non-interactive
> login) mode.
>
> If it is a problem though, would using the “which” command as you
> originally suggested be better? Does this project already depend on
> the “which” command?
use "type -P $PACMAN"
>>> + # Save full path in case the --syncdeps operation resets the $PATH by
>>> + # invoking /etc/profile. If $PACMAN refers to a command in ~/bin/ it
>>> + # could become inaccessible.
>>> + PACMAN="$output"
>>> +
>>> if (( RMDEPS && ! INSTALL )); then
>>> original_pkglist=($(run_pacman -Qq)) # required by remove_dep
>>> fi
>
More information about the pacman-dev
mailing list