[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Environment variables, debian/rules and dpkg-buildpackage



On Mon, Mar 16 2009, Raphael Hertzog wrote:

> On Mon, 16 Mar 2009, Bdale Garbee wrote:
>> 
>> > I think he ment that you can not know wether the setting comes from
>> > dpkg-buildpackage or the user. If it comes from dpkg-buildpackage then
>> > debian/rules should be free to override it as needed. If it comes from
>> > the user then that is another story. At least that is my take on it.
>> 
>> This is a great point.  It must be possible to craft a rules file that overrides 
>> system or distribution wide defaults and which can be over-ridden by an individual 
>> building the package.
>
> I don't see why it's needed, it's the job of the rules file to adjust the
> flags if there's a reason to deviate (like using -O0 instead of -O2 for
> some arch with compiler problems) but in general the package should not
> override completely the default flags but just complete them and/or
> adjust/fix them if needed.

        But while overriding the project wide default makes sense,
 overriding the human doing hte building does not.

>
> However, if the caller really wish that his build options prevail in
> all cases, he can use "make -e" (and dpkg-buildpackage has the -R
> option that let him call "debian/rules" as "make -e -f debian/rules"
> instead).

        We do not want to override *EVERYTHING* in the Makefile, just
 the CFLAGS.  This blunt instrument of the -e flag is not a good
 solution. 

> If necessary we can add a new option --force-flags to dpkg-bp or similar
> to make this even easier.

        Making a bad solution easy is not a good thing either.

>> That seems to require the ability for the code in a rules file to
>> distinguish between things in the environment because they're defaults
>> and things in the environment that are attempting to override defaults.
>
> Apparently there's no way to know from where the variable value come in
> make. That's true for environment variables like for command line
> variables.
> (at least according to my lookup of info make)

        Err, I think you need to get more conversant with Make. Yes,
 there is no way to know whether or not the environment variables were
 set by dpkg or the user; but it is itrivial to make it so that the
 project wide defaults can be overridden by the site wide stuff, and
 each being overridden by the package at will. We can even make it so
 that the package can tell which one set the value, and override only
 the project wide one and not the site variable.

> So if we really want the rules files to be able to know, we have to
> add yet another requirement to create this information. This is not
> desirable IMO.

        Given how trivial it is, I think it is eminently desirable. It
 is just that dpkg is not the right place for such subtleties.

        manoj
-- 
Though many hands make light work, too many cooks spoil the broth.
Manoj Srivastava <srivasta@debian.org> <http://www.debian.org/~srivasta/>  
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C


Reply to: