On Mon, Oct 26, 2009 at 9:15 AM, Xavier <[email protected]> wrote: > On Mon, Oct 26, 2009 at 3:03 PM, Ciprian Dorin, Craciun > <[email protected]> wrote: >> >> So based on what I've seen a build system has the following >> responsabilities: >> * compile-time dependency checking; (like ./configure does, but >> without the actual configuration;) >> * build environment preparation; (this includes downloading needed >> source code, checking it, patching, etc.;) >> * configuring the build according to the package specification; >> (invoking ./configure;) >> * building the package; (make;) >> * creating a deployable package; >> >> Now getting back with the problem where we want to reduce the >> snipet of code you've highlighted. We can see that the purpose of that >> code is to "prepare the build environment", more exactly fetching the >> source code, but we are forced to showell it inside the "build stage" >> function. >> >> So the reason why I've created the patch is because I want to >> tread source code comming from Git just like any other source-code >> bundle, without beeing forced to put it inside the build function. >> >> > > That's a very good point, and an idea which has been floating for a > while would be to introduce a prepare() function. > > I think this is actually a requirement for makepkg -e to work in many > cases, where patches are applied or a scm is used. > > Then, for limiting code duplication, we could use another idea which > has been floating for a while : library functions. > http://bugs.archlinux.org/task/10375 > > Just an example of how this could work : > > prepare() { > source $libdir/scm > gitprepare $_gitroot $_gitname > }
Xavier found the thing I was looking for. I've actually thought about this idea for a while as being a good one, it just needs to be done right as once a function gets out there it is hard to pull it back. I'm a much bigger fan of the prepare() approach (and providing some solid utility functions) as opposed to hacking the source array. While the simple case sometimes works, see this example for a time when a bash function would be a lot easier to use: http://repos.archlinux.org/wsvn/packages/libfetch/repos/core-i686/PKGBUILD We're getting close to the point where a few more standard function names could come into play: things like prepare(), build(), package(), test(). With that said, I like your effort you have put into this. It is an area we don't do the best right now, but providing solid footing for development packages is always a good idea. -Dan
