FIX for command dependencies

[email protected] Fri, 6 Sep 2002 19:41:21 -0700
Newsgroups gmane.comp.gnu.cons.general
Message-ID <[email protected]>
After many months of setting up a very large scale DevStudio environment 
using CONS we are finally coming to the rollout.  Through this tour we 
have run into and solved dependencies problems, well sort of, more like 
patched the problem.  Well, it was finally time to fix it once and for all 
and this is what I came up with, and it works reliably at last.

In package file, the subroutine sigtype, built objects were showing up 
here that had a signature, but no sigtype value.  So the major change here 
is that I search for bsig and then csig keys and if they exist, that 
becomes the sigtype, should it not already exist.  Then near the end of 
the routine, should there still be no value for sigtype, I set it to csig 
as a default.  I left the "elsif  (grep($_ =~ /content$/, @sigarray))" 
conditional and code in here, even though it isn't needed in this 
implementation.  See source below.

I'll would like to hear if I'm making a wrong assumption as I must admit, 
I have spent most of my time developing what goes on around CONS, like a 
new package called DSProject.pm that really is a rewrite of 
ConsExtensions.pm that works with CONS 2.3.0 and adds the reading of DSP 
files and many other new methods.  If the over 100 developers that are 
depending on this new stuff have not lynched me in the next couple of 
weeks I hope to be able to share the work we have done.

package file;

sub sigtype 
{
    my $self = shift;

    my $sigtype;
    $sigtype = $self->{sigtype} if $self->{sigtype};
 
    unless ($sigtype)
    {
        foreach (qw(bsig csig))
        {
            if ($self->{$_})
            {
                $sigtype = $_;
                last;
            }
        }
    }
 
    unless ($sigtype)
    {
        my @sigarray = $self->sigarray;
        if (grep($_ eq "build", @sigarray))
        {
            $sigtype = 'bsig';
        } elsif (grep($_ =~ /content$/, @sigarray))
        {
            $sigtype = 'csig';
        }
    }
 
    $sigtype ||= 'csig';
 
    return $self->{sigtype} = $sigtype;
}