Hello,

On antradienis 17 Lapkritis 2009 03:11:32 Joey Hess wrote:
>> +               # Now look for a more specific build system that is
>> auto-buildable in +               # both any previous and current steps.
>
>So says the comment, and the commit message, but not the code:

Now I see that this comment is confusing, I didn't express myself too well 
here.

>> +                     for my $prevstep (BUILD_STEPS) {
>> +                             last if ($prevstep eq $step);
>> +
>> +                             # Find the first build system that is
>> auto-buildable in $prevstep. +                             for $system
>> (@buildsystems) {
>> +                                     next unless defined $system;
>> +                                     $system =
>> create_buildsystem_instance($system, @_) unless ref $system; +            
>>                         if ($system->check_auto_buildable($prevstep)) { + 
>>                                            # If a candidate build system
>> is both more specific than the +                                          
>>   # base build system, and auto-buildable in current step, it's +         
>>                                    # the one we are looking for. +        
>>                                     if ($system->isa(ref $base) &&
>> $system->check_auto_buildable($step)) { +                                 
>>                    return $system;
>
>This may return a system before it has tested every prior step in
>BUILD_STEPS

The idea was to get an auto-buildable match on any (i.e. a single, but not 
all) prior step as well as current step. But that does not matter any more 
because this method is based on the flaw you pointed out.

> This may return a system before it has tested every prior step in
> BUILD_STEPS.
> 
> > +                                           }
> > +                                           else {
> > +                                                   # It's pointless to 
> > consider this build system 
once again
> > +                                                   $system = undef;
> 
> BTW,
> This mutates @buildsystems via the binding established via the foreach.
> But that is a) too far above for that the be clear on first reading, and
> b) one of perl's absolute worst features for code maintainability, which
> I prefer to avoid.

Ok, I won't use this technique again. 

> So, when cmake support was added to debhelper 7.3.0, the behavior of
> dh_auto_configure for such a package actually changed. In retrospect,
> then, we failed to get that right, and are only lucky that it seems to
> have broken nothing.
>
> It also means that if another build system is added to @BUILDSYSTEMS in
> the future, we again risk breakage, even if it is added after makefile.

This basically means that current check_auto_buildable() API has hit its 
limits and was wrongly designed from the start. Fortunately, we can freely 
change it as it does not concern 3rd party build systems.

I have a couple of thoughts how to solve this unfortunate problem. I'll try to 
write code and post a patch later today. Hopefully, I get things right this 
time, hrrr... This auto-selection thing is really so complicated...

-- 
Modestas Vainius <modes...@vainius.eu>

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to