[pacman-dev] makepkg3 improvements (for pacman-3.1)
Andrew Fyfe
andrew at neptune-one.net
Fri Mar 23 16:47:06 EDT 2007
Hi,
I've been using pacman for over a year now on DIY-Linux
(http://www.diy-linux.org), and to put it simply it's great easy to use
and easy to setup. So I thought it was about time I contribute something
back... an improved version of makepkg. For the impatient :p see the
script attached.
makepkg2's use of fakeroot was a bit hackish, it's now very hackish in
makepkg3. It also kicks up a few strange bugs (flyspray #6208) because
it's being used where it shouldn't be. So I've rewritten/reordered
makepkg to reduce the amount of time spent in fakeroot. Specificly it's
now only used for...
fake_install() (if it exists. See below)
build() (if there's no fake_install)
tidy_install()
- remove docs
- move/compress man pages
- strip binaries/libraries
- remove libtool files
- remove empty directories
create_package()
- create .PKGINFO & .FILELIST
- tar it all up
everything else is run outside of fakeroot.
Over at DIY-Linux we have a patch that adds an extra function to
PKGBUILD (fake_install). This way we can prepare, compile, and test the
package as the user running makepkg. Then fake_install is run inside
fakeroot to install the package. This further reduces the time spent in
fakeroot and the possibility of any weird bugs popping up. If the build
script doesn't contain a fake_install function the build function is
run inside of fakeroot instead (maintaining backwards compatibility with
how things work at the moment).
Other changes...
- reordered the code to reduce the number of if..then..else cases
- renamed a lot of variables so they're a bit more descriptive
- started to add error codes for the different reasons why makepkg exits
- quoted all variables that contain paths so '/home/me/a folder with
spaces' doesn't cause errors. (but build scripts are still a point of
failure as the majority don't have $startdir in quotes.)
- fixed flyspray bug #6468 -- Localized dates for build/install date
- added some more error catching
- added the ability to choose between usr/man and usr/share/man (var
(_MAN_DIR) at the top of the script.)
There are still a few things that need fixed, but some discussion is
probably required.
- Should build deps be removed after a successful build?
At the moment deps are only removed if '-r' is used and it removes build
deps and runtime deps. An extra option to remove build deps?
- Should root be a loud to run makepkg?
IMO running makepkg as root is a hanus crime, and anyone foolish enough
to do so deserves to have their system burn to the ground as the result
of a broken build script. One mistaken key stroke in a build script can
result in a successful build or the destruction of a system :p
I've added a warning that asks the user if they're sure the want to
continue running makepkg as root.
With sudo and fakeroot there's no need to run makepkg as root, but thats
just my opinion.
Andrew
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: makepkg3
URL: <http://archlinux.org/pipermail/pacman-dev/attachments/20070323/244ffc5a/attachment.diff>
More information about the pacman-dev
mailing list