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 05-19-2008, 03:54 PM
Sebastian Nowicki
 
Default Fix command line argument parsing in makepkg

On some systems, namely Mac OSX, command line parsing simply does not
work. It appears $@ gets altered at some stage. This patch uses $ARGLIST
instead, which contains the actual command line arguments

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

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index cc44c68..f56bcda 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1143,8 +1143,8 @@ fi
eval set -- "$OPT_TEMP"
unset OPT_SHORT OPT_LONG OPT_TEMP

-while true; do
- case "$1" in
+for arg in ${ARGLIST[@]}; do
+ case "$arg" in
# Pacman Options
--noconfirm) PACMAN_OPTS="$PACMAN_OPTS --noconfirm" ;;
--noprogressbar) PACMAN_OPTS="$PACMAN_OPTS --noprogressbar" ;;
@@ -1180,10 +1180,9 @@ while true; do
-h|--help) usage; exit 0 ;; # E_OK
-V|--version) version; exit 0 ;; # E_OK

- --) OPT_IND=0; shift; break;;
+ --) OPT_IND=0; continue; break;;
*) usage; exit 1 ;; # E_INVALID_OPTION
esac
- shift
done

if [ "$HOLDVER" = "1" -a "$FORCE_VER" != "" ]; then
--
1.5.4.5


_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-28-2008, 01:04 PM
Mark Constable
 
Default Fix command line argument parsing in makepkg

On 2008-05-28, Xavier wrote:
> > --source = -S
> > --noconfirm = -n
> > --noprogressbar = -N
> > --holdver = -H
> > --forcever = ?
> > --asroot = ?

Someone else suggested -0 and -F. The only extra I would
suggest is an additional check for "--help" so for those
occasions when longopts do get used, for assistance, that
both -h and --help shows the new shortopts usage list.

> So what do people think about a short opt only makepkg?

I think it's a great idea and would simplify the argument
passing in makepkg. Longopts are politcially correct but
shortopts, especially if it streamlines code, still works
just fine once the changes are understood by end users.

There are 62 possibilities... a-zA-Z0-9.

> I would like more feedbacks on the idea as I have a patch mostly
> working but there is no reason to polish it if the idea is wrong and
> if the patch will be rejected in any cases.

Not that my vote counts for anything but I'm all for it.

+1 as they say

--markc

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-28-2008, 01:48 PM
Allan McRae
 
Default Fix command line argument parsing in makepkg

Mark Constable wrote:
> On 2008-05-28, Xavier wrote:
>
>>> --source = -S
>>> --noconfirm = -n
>>> --noprogressbar = -N
>>> --holdver = -H
>>> --forcever = ?
>>> --asroot = ?
>>>
>
> Someone else suggested -0 and -F. The only extra I would
> suggest is an additional check for "--help" so for those
> occasions when longopts do get used, for assistance, that
> both -h and --help shows the new shortopts usage list.
>

I just did a grep though my history and I tend to always use long
options for --help and --version. So I am not so sure about a short
option only makepkg. I'd get used to it, but I expect all software to
have those long options. Also, I would find it a bit weird passing only
short options for --noprogressbar and --noconfirm which do not have
short options in pacman which is their eventual target.

I went back through the thread and looked at the reason for switching to
short options only and it seems the cleanest solution to the problem.
However, I just am not a fan of the idea. I really need to think on
this some more but I'd be in favour of a dirtier solution (perhaps the
addition of a specific option parser function) in order to keep them.
As already discovered, you can only go so far before the one letter
abbreviations become a bit obscure.

Allan



_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-28-2008, 01:48 PM
Xavier
 
Default Fix command line argument parsing in makepkg

On Wed, May 28, 2008 at 3:04 PM, Mark Constable <markc@renta.net> wrote:
> On 2008-05-28, Xavier wrote:
>> > --source = -S
>> > --noconfirm = -n
>> > --noprogressbar = -N
>> > --holdver = -H
>> > --forcever = ?
>> > --asroot = ?
>
> Someone else suggested -0 and -F. The only extra I would
> suggest is an additional check for "--help" so for those
> occasions when longopts do get used, for assistance, that
> both -h and --help shows the new shortopts usage list.
>

Yeah, I used -O and -F for the two missing ones.
Oh wait, I just realize there is a confusion here between O and 0.
Here is what Allan said :
"We could use -O for --asroot because root tends to have user id 0."

He suggested using the o letter because it looks like 0 number.
In my mind, short opts were always letter too, so I followed his suggestion.

I renamed the internal fakeroot -F option to -X.

About --help : as long as you write an invalid option, usage will be displayed.
And when using a longopt, I guess it will try to use the second - as
an option which is invalid.

>> So what do people think about a short opt only makepkg?
>
> I think it's a great idea and would simplify the argument
> passing in makepkg. Longopts are politcially correct but
> shortopts, especially if it streamlines code, still works
> just fine once the changes are understood by end users.
>
> There are 62 possibilities... a-zA-Z0-9.
>
>> I would like more feedbacks on the idea as I have a patch mostly
>> working but there is no reason to polish it if the idea is wrong and
>> if the patch will be rejected in any cases.
>
> Not that my vote counts for anything but I'm all for it.
>
> +1 as they say
>

ok, thanks for the comments.

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-28-2008, 02:58 PM
Mark Constable
 
Default Fix command line argument parsing in makepkg

On 2008-05-28, Allan McRae wrote:
> Also, I would find it a bit weird passing only
> short options for --noprogressbar and --noconfirm which do not have
> short options in pacman which is their eventual target.

. an experienced user will get used to any new options

. a new user will always have to refer to the usage or man
page so whether they are intuitive or not doesn't really
matter, they are whatever they are when viewing usage

For example, -e and -o always confuse me and after a year I
still have to look at usage to make sure what to use to not
extract the the tarball or the opposite. In other words I
rely on the usage to guide me constantly for less frequently
used options so what ever the options are doesn't matter (to me).
It's only the first most used options that have any chance of
being intuitive or natural, anything after that usually, in my
experience, becomes more and more obscure and requires a lookup.

I simply never use longopts anyway, but that just my 2c POV.

--markc

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 05:26 PM.

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