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 |
477 |
|
|
478 |
|
sub copysetup { |
479 |
|
my $self=shift; |
480 |
< |
my $dest=shift; |
434 |
< |
|
480 |
> |
my $dest=shift; |
481 |
|
my $rv=1; |
482 |
|
# copy across the admin dir |
483 |
|
my $temp=$self->location()."/".$self->{admindir}."/".$self->arch(); |
491 |
|
return $rv; |
492 |
|
} |
493 |
|
|
494 |
+ |
sub copywithskip { |
495 |
+ |
my $self=shift; |
496 |
+ |
my $dest=shift; |
497 |
+ |
my ($filetoskip)=@_; |
498 |
+ |
my $rv=1; |
499 |
+ |
# copy across the admin dir |
500 |
+ |
my $temp=$self->location()."/".$self->{admindir}."/".$self->arch(); |
501 |
+ |
my $temp2=$dest."/".$self->{admindir}."/".$self->arch(); |
502 |
+ |
if ( $temp ne $temp2 ) { |
503 |
+ |
if ( -d $temp ) { |
504 |
+ |
AddDir::copydirwithskip($temp,$temp2,$filetoskip); |
505 |
+ |
$rv=0; |
506 |
+ |
} |
507 |
+ |
} |
508 |
+ |
return $rv; |
509 |
+ |
} |
510 |
+ |
|
511 |
|
sub copyenv { |
512 |
|
my $self=shift; |
513 |
|
my $hashref=shift; |
525 |
|
sub linkto { |
526 |
|
my $self=shift; |
527 |
|
my $location=shift; |
528 |
+ |
|
529 |
|
if ( -d $location ) { |
530 |
|
my $area=Configuration::ConfigArea->new(); |
531 |
|
$area->bootstrapfromlocation($location); |
572 |
|
|
573 |
|
print $fh "SCRAM_PROJECTNAME=".$self->name()."\n"; |
574 |
|
print $fh "SCRAM_PROJECTVERSION=".$self->version()."\n"; |
575 |
< |
print $fh "projconfigdir=".$self->configurationdir()."\n"; |
575 |
> |
print $fh "SCRAM_CONFIGDIR=".$self->configurationdir()."\n"; |
576 |
> |
print $fh "SCRAM_SOURCEDIR=".$self->sourcedir()."\n"; |
577 |
|
print $fh "SCRAM_ProjReqsDoc=".$self->{reqdoc}."\n"; |
578 |
+ |
print $fh "SCRAM_TOOLBOXVERSION=".$self->{toolboxversion}."\n"; |
579 |
|
if ( defined $self->linkarea() ) { |
580 |
|
my $area=$self->linkarea()->location(); |
581 |
|
if ( $area ne "" ) { |
586 |
|
} |
587 |
|
|
588 |
|
|
589 |
< |
sub _LoadEnvFile { |
590 |
< |
my $self=shift; |
589 |
> |
sub _LoadEnvFile |
590 |
> |
{ |
591 |
> |
my $self=shift; |
592 |
|
|
593 |
< |
use FileHandle; |
594 |
< |
my $fh=FileHandle->new(); |
595 |
< |
open ( $fh, "<".$self->location()."/".$self->{admindir}."/". |
596 |
< |
"Environment" ) or |
597 |
< |
$self->error("Cannot find Environment file. Area Corrupted? (" |
598 |
< |
.$self->location().")\n $!"); |
599 |
< |
while ( <$fh> ) { |
600 |
< |
chomp; |
601 |
< |
next if /^#/; |
602 |
< |
next if /^\s*$/ ; |
603 |
< |
($name, $value)=split /=/; |
604 |
< |
eval "\$self->{ENV}{${name}}=\"$value\""; |
605 |
< |
} |
606 |
< |
undef $fh; |
593 |
> |
use FileHandle; |
594 |
> |
my $fh=FileHandle->new(); |
595 |
> |
open ( $fh, "<".$self->location()."/".$self->{admindir}."/". |
596 |
> |
"Environment" ) or |
597 |
> |
$self->error("Cannot find Environment file. Area Corrupted? (" |
598 |
> |
.$self->location().")\n $!"); |
599 |
> |
while ( <$fh> ) |
600 |
> |
{ |
601 |
> |
chomp; |
602 |
> |
next if /^#/; |
603 |
> |
next if /^\s*$/ ; |
604 |
> |
($name, $value)=split /=/; |
605 |
> |
eval "\$self->{ENV}{${name}}=\"$value\""; |
606 |
> |
} |
607 |
> |
undef $fh; |
608 |
|
|
609 |
< |
# -- set internal variables appropriately |
610 |
< |
if ( defined $self->{ENV}{"SCRAM_PROJECTNAME"} ) { |
611 |
< |
$self->name($self->{ENV}{"SCRAM_PROJECTNAME"}); |
612 |
< |
} |
613 |
< |
if ( defined $self->{ENV}{"SCRAM_PROJECTVERSION"} ) { |
614 |
< |
$self->version($self->{ENV}{"SCRAM_PROJECTVERSION"}); |
615 |
< |
} |
616 |
< |
if ( defined $self->{ENV}{"projconfigdir"} ) { |
617 |
< |
$self->configurationdir($self->{ENV}{projconfigdir}); |
618 |
< |
} |
619 |
< |
if ( defined $self->{ENV}{"SCRAM_ProjReqsDoc"} ) { |
620 |
< |
$self->requirementsdoc($self->{ENV}{SCRAM_ProjReqsDoc}); |
621 |
< |
} |
622 |
< |
if ( ( defined $self->{ENV}{"RELEASETOP"} ) && |
623 |
< |
($self->{ENV}{"RELEASETOP"} ne $self->location())) { |
624 |
< |
$self->linkto($self->{ENV}{"RELEASETOP"}); |
625 |
< |
} |
626 |
< |
else { |
627 |
< |
$self->{ENV}{"RELEASETOP"}=$self->location(); |
628 |
< |
} |
629 |
< |
} |
609 |
> |
# -- set internal variables appropriately |
610 |
> |
if ( defined $self->{ENV}{"SCRAM_PROJECTNAME"} ) |
611 |
> |
{ |
612 |
> |
$self->name($self->{ENV}{"SCRAM_PROJECTNAME"}); |
613 |
> |
} |
614 |
> |
if ( defined $self->{ENV}{"SCRAM_PROJECTVERSION"} ) |
615 |
> |
{ |
616 |
> |
$self->version($self->{ENV}{"SCRAM_PROJECTVERSION"}); |
617 |
> |
} |
618 |
> |
if ( defined $self->{ENV}{"SCRAM_CONFIGDIR"} ) |
619 |
> |
{ |
620 |
> |
$self->configurationdir($self->{ENV}{"SCRAM_CONFIGDIR"}); |
621 |
> |
} |
622 |
> |
if ( defined $self->{ENV}{"SCRAM_SOURCEDIR"} ) |
623 |
> |
{ |
624 |
> |
$self->sourcedir($self->{ENV}{"SCRAM_SOURCEDIR"}); |
625 |
> |
} |
626 |
> |
if ( defined $self->{ENV}{"SCRAM_ProjReqsDoc"} ) |
627 |
> |
{ |
628 |
> |
$self->requirementsdoc($self->{ENV}{"SCRAM_ProjReqsDoc"}); |
629 |
> |
} |
630 |
> |
if ( defined $self->{ENV}{"SCRAM_TOOLBOXVERSION"} ) |
631 |
> |
{ |
632 |
> |
$self->toolboxversion($self->{ENV}{"SCRAM_TOOLBOXVERSION"}); |
633 |
> |
} |
634 |
> |
|
635 |
> |
if ( ( defined $self->{ENV}{"RELEASETOP"} ) && |
636 |
> |
($self->{ENV}{"RELEASETOP"} ne $self->location())) |
637 |
> |
{ |
638 |
> |
$self->linkto($self->{ENV}{"RELEASETOP"}); |
639 |
> |
} |
640 |
> |
} |