On Nov 8, 2007 6:20 PM, Nathan Jones <nathanj@insightbb.com> wrote:
On Thu, Nov 08, 2007 at 03:50:12PM -0600, Dan McGee wrote:
When I suggested this, I was thinking of the following type code that is already in makepkg (line 659): # use ccache if it is requested (check buildenv and PKGBUILD opts) if [ "$(check_buildenv ccache)" = "y" -a "$(check_option ccache)" != "n" ]; then [ -d /usr/lib/ccache/bin ] && export PATH="/usr/lib/ccache/bin:$PATH" fi
Note that ccache is a BUILDENV var in makepkg.conf, but can still be denied in a PKGBUILD by using !ccache (for those packages that don't build correctly with it). I feel like a if clause just like the above would work for xdelta as well (and cut your patch from -1/+3 to -1/+1).
After looking at it some more, I don't think this if statement will work for the xdelta option. This is because the ccache statement only allows the option to be disabled, not enabled, in the PKGBUILD. Consider the scenario where you have !ccache is makepkg.conf, but ccache in PKGBUILD: ccache will _not_ be used. It seems possible to me that some people will disable delta creation for most packages but enable it only for the large ones.
You definitely bring up some interesting points here. Do we every really want to create deltas for packages under some size limit? Should we make this some kind of configuration setting? I agree with your statement of plausibility as well. My only concern is that currently, an option that is disabled in makepkg.conf cannot be reenabled in a PKGBUILD, which I think is the right way to do things. We don't want only xdelta breaking this rule. However, it would make sense that if someone had no xdelta option at all in their BUILDENV, then a package could choose to turn it on? Mostly thinking aloud here.
It is still possible to turn my if statement into one line, but it will be a long line :). I don't think it would be any better than the patch I've already submitted.
Another option would be to do something like this: (untested)
local opt=$(check_option xdelta) [ "$opt" = "?" ] && opt=$(check_buildenv xdelta)
if [ "$opt" != "y" ]; then return fi
Or, check_buildenv could be changed to first look in the PKGBUILD options, like check_option does.
Hmm. This does mess with the precedence thing I described above, so I don't know. It is one thing for a PKGBUILD to mess with packaging options, but quite another to play with the build environment. -Dan