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

Andrew Fyfe andrew at neptune-one.net
Fri Jun 1 12:06:21 EDT 2007


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
> 
> _______________________________________________
> pacman-dev mailing list
> pacman-dev at archlinux.org
> http://archlinux.org/mailman/listinfo/pacman-dev

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)
- 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
}
- 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.
- remove clean cache, does it get used? I rather write a separate script 
and put it in contrib/
- Remove '--usesudo', Always use sudo unless '--asroot' is passed.
- Remove '--log', Always create a build log.
- Remove '--nocolor', This depends on the new isatty in initscripts

Thoughts, comments and ideas welcome?

Andrew




More information about the pacman-dev mailing list