[pacman-dev] [patch] makepkg3 -- cleanup dep check functions

Dan McGee dpmcgee at gmail.com
Fri Jun 1 12:16:25 EDT 2007


On 6/1/07, Andrew Fyfe <andrew at neptune-one.net> wrote:
> Dan McGee wrote:
> > On 6/1/07, Andrew Fyfe <andrew at neptune-one.net> wrote:
> >> Oops, I was using working for something else, I've put the makepkg
> >> branch up, all the patches are there.
> >>
> >> Andrew
> >
> > While looking this over, I've noticed that we are calling exit an
> > awful lot from the functions. Shouldn't we contain the exit calls to
> > the main body of code, and use return statements to get the control
> > back to there to do the actual exiting? Just a thought, comments
> > welcome.
> >
> > -Dan
>
> Yeah, you're right. There's some serious restructuring required in
> makepkg. As more and more features have been hacked into makepkg it has
> become rather messy. The fakeroot patches and the patches I pushed to my
> makepkg branch clean up most of the functions, I've still to tidy up
> check_{option,buildenv}. Here's a list of other changes that I think
> need made to makepkg...
>
> - limit exit calls to the main() body (as you suggested)
Obviously I agree.

> - replace the exit calls with a call to a clean up function eg
> die() {
>         local EXIT_CODE=$1; shift
>         if [ $EXIT_CODE -gt 0 ]; then
>                 error "$@"
>         fi
>
>         if [ RMDEPS && DEPS_INSTALLED ]; then
>                 remove_deps
>         fi
>
>         ...
>
>         exit $EXIT_CODE
> }
Probably not a bad idea, although let's get some other opinions. die
is an awfully harsh name, perhaps just cleanup. :P

> - move download source, checksum check/generate, and extract source into
> functions, this should make it a little easier to follow the flow of the
> script.
Functions = good IMO, so go for it.

> - remove clean cache, does it get used? I rather write a separate script
> and put it in contrib/
Wait for now, although I personally agree I'm sure some use it.

> - Remove '--usesudo', Always use sudo unless '--asroot' is passed.
I'll take care of this one, makes sense now.

> - Remove '--log', Always create a build log.
Some people may not want logs cluttering their build area, so lets get
some opinions.
> - Remove '--nocolor', This depends on the new isatty in initscripts
I know a lot of scripts use it now, so wait for now.

-Dan




More information about the pacman-dev mailing list