FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 07-08-2011, 04:31 AM
DJ Mills
 
Default remove OPT_TEMP hack in parse_options call

Instead of using var=$(command || echo blah); if [[ $var = *"blah"* ]],
which IMO is a creative hack, but very unnecessary, simply use:
if ! var=$(command); then

This patch gets rid of the hack.

Signed-off-by: DJ Mills <danielmills1@gmail.com>
---
scripts/makepkg.sh.in | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index e215c4b..3152bf1 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1752,9 +1752,7 @@ OPT_LONG+=",install,key:,log,nocolor,nobuild,noche ck,nosign,pkg:,rmdeps"
OPT_LONG+=",repackage,skipinteg,sign,source,syncde ps,version,config:"
# Pacman Options
OPT_LONG+=",noconfirm,noprogressbar"
-OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@" || echo 'PARSE_OPTIONS FAILED')"
-if [[ $OPT_TEMP = *'PARSE_OPTIONS FAILED'* ]]; then
- # This is a small hack to stop the script bailing with 'set -e'
+if ! OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@")"; then
echo; usage; exit 1 # E_INVALID_OPTION;
fi
eval set -- "$OPT_TEMP"
--
1.7.6
 
Old 07-08-2011, 07:05 AM
Allan McRae
 
Default remove OPT_TEMP hack in parse_options call

On 08/07/11 14:31, DJ Mills wrote:

Instead of using var=$(command || echo blah); if [[ $var = *"blah"* ]],
which IMO is a creative hack, but very unnecessary, simply use:
if ! var=$(command); then

This patch gets rid of the hack.

Signed-off-by: DJ Mills<danielmills1@gmail.com>


On my working branch with a changed commit message.

Allan
 

Thread Tools




All times are GMT. The time now is 10:40 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org