[pacman-dev] [PATCH] makepkg: fix error on unnecessary -r

Allan McRae allan at archlinux.org
Sun Jan 22 21:48:37 EST 2012


On 23/01/12 12:13, Dave Reisner wrote:
> On Mon, Jan 23, 2012 at 12:08:14PM +1000, Allan McRae wrote:
>> On 20/01/12 23:59, Dave Reisner wrote:
>>> On Fri, Jan 20, 2012 at 11:24:23PM +1000, Allan McRae wrote:
>>>> The grep statement used to check for a difference between the
>>>> installed package list before and after resolving dependencies
>>>> returns 1 if there is no difference.  This sets of the error
>>>> trap when "-r" is used "unnecessarily".
>>>>
>>>> Signed-off-by: Allan McRae <allan at archlinux.org>
>>>> ---
>>>>
...
>>>>  
>>>>  	local deplist
>>>> -	if ! deplist=($(grep -xvFf <(printf "%s\n" "${original_pkglist[@]}") \
>>>> -			<(printf "%s\n" "${current_pkglist[@]}"))); then
>>>> +	deplist=($(grep -xvFf <(printf "%s\n" "${original_pkglist[@]}") \
>>>> +			<(printf "%s\n" "${current_pkglist[@]}") || true))
>>>> +	if [[ -n deplist ]]; then
>>>
>>> My brain tells me there's a way to avoid this, but I'm not sure I trust
>>> it right now.
>>>
>>
>> I have not thought of one...  let me know if your brain is working
>> better now and has come up with the answer!
>>
>>
> 
> What about something like...
> 
>   local dep deplist
>   while read -r dep; do
>     deplist+=("$dep")
>   done < <(grep -xvFf <(printf "%s\n" "${original_pkglist[@]}") \
>       <(printf "%s\n" "${current_pkglist[@]}"))
> 
>   if (( ${#deplist[*]} )); then
>     return
>   fi

I'm not sure the whole "while read" construct is worth it to get rid of
the || true.   I'll just leave my patch as it is for now unless you
really feel strongly that I should not do it that way...

Allan


More information about the pacman-dev mailing list