63 |
|
$self->{admindir}=".SCRAM"; |
64 |
|
$self->{cachedir}="cache"; |
65 |
|
$self->{dbdir}="ObjectDB"; |
66 |
+ |
$self->{tbupdate}=0; |
67 |
|
undef $self->{linkarea}; |
68 |
|
|
69 |
|
return $self; |
87 |
|
return $self->{cache}; |
88 |
|
} |
89 |
|
|
90 |
+ |
# Tool and project cache info: |
91 |
+ |
sub cacheinfo |
92 |
+ |
{ |
93 |
+ |
my $self=shift; |
94 |
+ |
print "\n","<ConfigArea> cacheinfo: ToolCache = ",$self->{toolcachefile}, |
95 |
+ |
", ProjectCache = ",$self->{projectcachefile},"\n"; |
96 |
+ |
} |
97 |
+ |
|
98 |
+ |
sub toolcachename |
99 |
+ |
{ |
100 |
+ |
my $self=shift; |
101 |
+ |
return ($self->location()."/".$self->{admindir}."/".$ENV{SCRAM_ARCH}."/ToolCache.db"); |
102 |
+ |
} |
103 |
+ |
|
104 |
+ |
sub projectcachename |
105 |
+ |
{ |
106 |
+ |
my $self=shift; |
107 |
+ |
return ($self->location()."/".$self->{admindir}."/".$ENV{SCRAM_ARCH}."/ProjectCache.db"); |
108 |
+ |
} |
109 |
+ |
|
110 |
+ |
sub _tbupdate |
111 |
+ |
{ |
112 |
+ |
# Update toolbox relative to new RequirementsDoc: |
113 |
+ |
my $self=shift; |
114 |
+ |
@_?$self->{tbupdate}=shift |
115 |
+ |
:$self->{tbupdate}; |
116 |
+ |
} |
117 |
+ |
|
118 |
|
sub _newcache { |
119 |
|
my $self=shift; |
120 |
|
my $loc=$self->location()."/".$self->{admindir}."/".$self->{cachedir}; |
167 |
|
# -- check we have a project name and version |
168 |
|
my $name=$self->name(); |
169 |
|
my $vers=$self->version(); |
170 |
+ |
|
171 |
|
if ( ( ! defined $name ) && ( ! defined $version )) { |
172 |
|
$self->error("Set ConfigArea name and version before setup"); |
173 |
|
} |
211 |
|
return (defined $self->{configurationdir})?$self->{configurationdir}:undef; |
212 |
|
} |
213 |
|
|
214 |
+ |
sub sourcedir { |
215 |
+ |
my $self=shift; |
216 |
+ |
if ( @_ ) { |
217 |
+ |
$self->{sourcedir}=shift; |
218 |
+ |
} |
219 |
+ |
return (defined $self->{sourcedir})?$self->{sourcedir}:undef; |
220 |
+ |
} |
221 |
+ |
|
222 |
|
sub toolbox { |
223 |
|
my $self=shift; |
224 |
|
if ( ! defined $self->{toolbox} ) { |
227 |
|
return $self->{toolbox}; |
228 |
|
} |
229 |
|
|
230 |
+ |
sub toolboxversion { |
231 |
+ |
my $self=shift; |
232 |
+ |
if ( @_ ) { |
233 |
+ |
$self->{toolboxversion}=shift; |
234 |
+ |
} |
235 |
+ |
return (defined $self->{toolboxversion})?$self->{toolboxversion}:undef; |
236 |
+ |
} |
237 |
+ |
|
238 |
|
sub requirementsdoc { |
239 |
|
my $self=shift; |
240 |
|
if ( @_ ) { |
325 |
|
else { |
326 |
|
$self->location($location); |
327 |
|
$self->verbose("Found top ".$self->location()); |
282 |
– |
my $infofile=$self->location()."/".$self->{admindir}."/ConfigArea.dat"; |
328 |
|
$self->_LoadEnvFile(); |
329 |
|
} |
330 |
|
return $rv; |
409 |
|
$sat->version($self->version()); |
410 |
|
$sat->requirementsdoc($self->{reqdoc}); |
411 |
|
$sat->configurationdir($self->configurationdir()); |
412 |
+ |
$sat->sourcedir($self->sourcedir()); |
413 |
+ |
$sat->toolboxversion($self->toolboxversion()); |
414 |
|
$sat->setup(@_); |
415 |
|
|
416 |
|
# -- copy across the cache and ObjectStore |
509 |
|
sub linkto { |
510 |
|
my $self=shift; |
511 |
|
my $location=shift; |
512 |
+ |
|
513 |
|
if ( -d $location ) { |
514 |
|
my $area=Configuration::ConfigArea->new(); |
515 |
|
$area->bootstrapfromlocation($location); |
556 |
|
|
557 |
|
print $fh "SCRAM_PROJECTNAME=".$self->name()."\n"; |
558 |
|
print $fh "SCRAM_PROJECTVERSION=".$self->version()."\n"; |
559 |
< |
print $fh "projconfigdir=".$self->configurationdir()."\n"; |
559 |
> |
print $fh "SCRAM_CONFIGDIR=".$self->configurationdir()."\n"; |
560 |
> |
print $fh "SCRAM_SOURCEDIR=".$self->sourcedir()."\n"; |
561 |
|
print $fh "SCRAM_ProjReqsDoc=".$self->{reqdoc}."\n"; |
562 |
+ |
print $fh "SCRAM_TOOLBOXVERSION=".$self->{toolboxversion}."\n"; |
563 |
|
if ( defined $self->linkarea() ) { |
564 |
|
my $area=$self->linkarea()->location(); |
565 |
|
if ( $area ne "" ) { |
570 |
|
} |
571 |
|
|
572 |
|
|
573 |
< |
sub _LoadEnvFile { |
574 |
< |
my $self=shift; |
573 |
> |
sub _LoadEnvFile |
574 |
> |
{ |
575 |
> |
my $self=shift; |
576 |
|
|
577 |
< |
use FileHandle; |
578 |
< |
my $fh=FileHandle->new(); |
579 |
< |
open ( $fh, "<".$self->location()."/".$self->{admindir}."/". |
580 |
< |
"Environment" ) or |
581 |
< |
$self->error("Cannot find Environment file. Area Corrupted? (" |
582 |
< |
.$self->location().")\n $!"); |
583 |
< |
while ( <$fh> ) { |
584 |
< |
chomp; |
585 |
< |
next if /^#/; |
586 |
< |
next if /^\s*$/ ; |
587 |
< |
($name, $value)=split /=/; |
588 |
< |
eval "\$self->{ENV}{${name}}=\"$value\""; |
589 |
< |
} |
590 |
< |
undef $fh; |
577 |
> |
use FileHandle; |
578 |
> |
my $fh=FileHandle->new(); |
579 |
> |
open ( $fh, "<".$self->location()."/".$self->{admindir}."/". |
580 |
> |
"Environment" ) or |
581 |
> |
$self->error("Cannot find Environment file. Area Corrupted? (" |
582 |
> |
.$self->location().")\n $!"); |
583 |
> |
while ( <$fh> ) |
584 |
> |
{ |
585 |
> |
chomp; |
586 |
> |
next if /^#/; |
587 |
> |
next if /^\s*$/ ; |
588 |
> |
($name, $value)=split /=/; |
589 |
> |
eval "\$self->{ENV}{${name}}=\"$value\""; |
590 |
> |
} |
591 |
> |
undef $fh; |
592 |
|
|
593 |
< |
# -- set internal variables appropriately |
594 |
< |
if ( defined $self->{ENV}{"SCRAM_PROJECTNAME"} ) { |
595 |
< |
$self->name($self->{ENV}{"SCRAM_PROJECTNAME"}); |
596 |
< |
} |
597 |
< |
if ( defined $self->{ENV}{"SCRAM_PROJECTVERSION"} ) { |
598 |
< |
$self->version($self->{ENV}{"SCRAM_PROJECTVERSION"}); |
599 |
< |
} |
600 |
< |
if ( defined $self->{ENV}{"projconfigdir"} ) { |
601 |
< |
$self->configurationdir($self->{ENV}{projconfigdir}); |
602 |
< |
} |
603 |
< |
if ( defined $self->{ENV}{"SCRAM_ProjReqsDoc"} ) { |
604 |
< |
$self->requirementsdoc($self->{ENV}{SCRAM_ProjReqsDoc}); |
605 |
< |
} |
606 |
< |
if ( ( defined $self->{ENV}{"RELEASETOP"} ) && |
607 |
< |
($self->{ENV}{"RELEASETOP"} ne $self->location())) { |
608 |
< |
$self->linkto($self->{ENV}{"RELEASETOP"}); |
609 |
< |
} |
610 |
< |
else { |
611 |
< |
$self->{ENV}{"RELEASETOP"}=$self->location(); |
612 |
< |
} |
613 |
< |
} |
593 |
> |
# -- set internal variables appropriately |
594 |
> |
if ( defined $self->{ENV}{"SCRAM_PROJECTNAME"} ) |
595 |
> |
{ |
596 |
> |
$self->name($self->{ENV}{"SCRAM_PROJECTNAME"}); |
597 |
> |
} |
598 |
> |
if ( defined $self->{ENV}{"SCRAM_PROJECTVERSION"} ) |
599 |
> |
{ |
600 |
> |
$self->version($self->{ENV}{"SCRAM_PROJECTVERSION"}); |
601 |
> |
} |
602 |
> |
if ( defined $self->{ENV}{"SCRAM_CONFIGDIR"} ) |
603 |
> |
{ |
604 |
> |
$self->configurationdir($self->{ENV}{"SCRAM_CONFIGDIR"}); |
605 |
> |
} |
606 |
> |
if ( defined $self->{ENV}{"SCRAM_SOURCEDIR"} ) |
607 |
> |
{ |
608 |
> |
$self->sourcedir($self->{ENV}{"SCRAM_SOURCEDIR"}); |
609 |
> |
} |
610 |
> |
if ( defined $self->{ENV}{"SCRAM_ProjReqsDoc"} ) |
611 |
> |
{ |
612 |
> |
$self->requirementsdoc($self->{ENV}{"SCRAM_ProjReqsDoc"}); |
613 |
> |
} |
614 |
> |
if ( defined $self->{ENV}{"SCRAM_TOOLBOXVERSION"} ) |
615 |
> |
{ |
616 |
> |
$self->toolboxversion($self->{ENV}{"SCRAM_TOOLBOXVERSION"}); |
617 |
> |
} |
618 |
> |
|
619 |
> |
if ( ( defined $self->{ENV}{"RELEASETOP"} ) && |
620 |
> |
($self->{ENV}{"RELEASETOP"} ne $self->location())) |
621 |
> |
{ |
622 |
> |
$self->linkto($self->{ENV}{"RELEASETOP"}); |
623 |
> |
} |
624 |
> |
} |