1 |
– |
# |
2 |
– |
# ConfigArea.pm |
3 |
– |
# |
4 |
– |
# Originally Written by Christopher Williams |
5 |
– |
# |
6 |
– |
# Description |
7 |
– |
# |
8 |
– |
# Interface |
9 |
– |
# --------- |
10 |
– |
# new(ActiveConfig) : A new ConfigArea object |
11 |
– |
# setup() : setup the configuration area |
12 |
– |
# location([dir]) : set/return the location of the area |
13 |
– |
# version([version]) : set/return the version of the area |
14 |
– |
# name([name]) : set/return the name of the area |
15 |
– |
# store(location) : store data in file location |
16 |
– |
# restore(location) : restore data from file location |
17 |
– |
# meta() : return a description string of the area |
18 |
– |
# addconfigitem(url) : add a new item to the area |
19 |
– |
# configitem(@keys) : return a list of fig items that match |
20 |
– |
# the keys - all if left blank |
21 |
– |
# parentstore() : set/return the parent ObjectStore |
22 |
– |
# bootstrapfromlocation([location]): bootstrap the object based on location. |
23 |
– |
# no location specified - cwd used |
24 |
– |
# searchlocation([startdir]) : returns the location directory. search starts |
25 |
– |
# from cwd if not specified |
26 |
– |
# defaultdirname() : return the default directory name string |
27 |
– |
# copy(location) : make a copy of the current area at the |
28 |
– |
# specified location - return an object |
29 |
– |
# representing the area |
30 |
– |
|
1 |
|
package Configuration::ConfigArea; |
32 |
– |
use ActiveDoc::ActiveDoc; |
2 |
|
require 5.004; |
3 |
|
use Utilities::AddDir; |
4 |
< |
use ObjectUtilities::ObjectStore; |
4 |
> |
use Utilities::Verbose; |
5 |
|
use Cwd; |
6 |
< |
@ISA=qw(ActiveDoc::ActiveDoc ObjectUtilities::StorableObject); |
38 |
< |
|
39 |
< |
sub init { |
40 |
< |
my $self=shift; |
6 |
> |
@ISA=qw(Utilities::Verbose); |
7 |
|
|
8 |
< |
$self->newparse("init"); |
9 |
< |
$self->newparse("download"); |
10 |
< |
$self->newparse("setup"); |
11 |
< |
$self->addtag("init","project",\&Project_Start,$self, |
12 |
< |
\&Project_text,$self,"", $self ); |
13 |
< |
$self->addurltags("download"); |
14 |
< |
$self->addtag("download","use",\&Use_download_Start,$self, |
15 |
< |
"", $self, "",$self); |
16 |
< |
$self->addurltags("setup"); |
17 |
< |
$self->addtag("setup","use",\&Use_Start,$self, "", $self, "",$self); |
18 |
< |
} |
19 |
< |
|
20 |
< |
sub defaultdirname { |
21 |
< |
my $self=shift; |
22 |
< |
my $name=$self->name(); |
23 |
< |
my $vers=$self->version(); |
24 |
< |
$vers=~s/^$name_//; |
25 |
< |
$name=$name."_".$vers; |
26 |
< |
return $name; |
27 |
< |
|
8 |
> |
sub new { |
9 |
> |
my $class=shift; |
10 |
> |
my $self={}; |
11 |
> |
bless $self, $class; |
12 |
> |
$self->{admindir}=".SCRAM"; |
13 |
> |
$self->{configurationdir} = "config"; |
14 |
> |
$self->archname($ENV{SCRAM_ARCH}); |
15 |
> |
return $self; |
16 |
> |
} |
17 |
> |
|
18 |
> |
sub toolcachename |
19 |
> |
{ |
20 |
> |
my $self=shift; |
21 |
> |
return ($self->archdir()."/ToolCache.db.gz"); |
22 |
> |
} |
23 |
> |
|
24 |
> |
sub projectcachename |
25 |
> |
{ |
26 |
> |
my $self=shift; |
27 |
> |
return ($self->archdir()."/ProjectCache.db.gz"); |
28 |
> |
} |
29 |
> |
|
30 |
> |
sub symlinks { |
31 |
> |
my $self=shift; |
32 |
> |
if (@_) {$self->{symlinks}=shift;} |
33 |
> |
return $self->{symlinks}; |
34 |
> |
} |
35 |
> |
|
36 |
> |
sub calchksum { |
37 |
> |
my $self=shift; |
38 |
> |
my $dir=$self->location()."/".$self->configurationdir(); |
39 |
> |
push @INC,$dir; |
40 |
> |
require SCRAM::Plugins::ProjectChkSum; |
41 |
> |
my $sum=&SCRAM::Plugins::ProjectChkSum::chksum($dir); |
42 |
> |
pop @INC; |
43 |
> |
return $sum; |
44 |
|
} |
45 |
|
|
46 |
< |
sub setup { |
46 |
> |
sub configchksum { |
47 |
|
my $self=shift; |
48 |
< |
|
49 |
< |
# --- find out the location |
68 |
< |
my $location=$self->requestoption("area_location", |
69 |
< |
"Please Enter the location of the directory"); |
70 |
< |
if ( $location!~/^\// ) { |
71 |
< |
$location=cwd()."/".$location; |
72 |
< |
} |
73 |
< |
|
74 |
< |
# --- find area directory name , default name projectname_version |
75 |
< |
my $name=$self->option("area_name"); |
76 |
< |
if ( ! defined $name ) { |
77 |
< |
$name=$self->defaultdirname(); |
78 |
< |
} |
79 |
< |
$self->location($location."/".$name); |
80 |
< |
|
81 |
< |
# make a new store handler |
82 |
< |
$self->_setupstore(); |
83 |
< |
|
84 |
< |
# --- download everything first |
85 |
< |
# FIX-ME --- cacheing is broken |
86 |
< |
$self->parse("download"); |
87 |
< |
|
88 |
< |
# --- and parse the setup file |
89 |
< |
$self->parse("setup"); |
90 |
< |
|
91 |
< |
# --- store bootstrap info |
92 |
< |
$self->store($self->location()."/.SCRAM/ConfigArea.dat"); |
93 |
< |
|
94 |
< |
# --- store self in original database |
95 |
< |
$self->parentconfig()->store($self,"ConfigArea",$self->name(), |
96 |
< |
$self->version()); |
48 |
> |
if (@_) {$self->{configchksum}=shift;} |
49 |
> |
return $self->{configchksum}; |
50 |
|
} |
51 |
|
|
99 |
– |
sub _setupstore { |
100 |
– |
my $self=shift; |
52 |
|
|
53 |
< |
# --- make a new ActiveStore at the location and add it to the db list |
103 |
< |
my $ad=ActiveDoc::ActiveConfig->new($self->location()."/\.SCRAM"); |
104 |
< |
|
105 |
< |
$self->parentconfig($self->config()); |
106 |
< |
# $self->config(Configuration::ConfigureStore->new()); |
107 |
< |
# $self->config()->db("local",$ad); |
108 |
< |
# $self->config()->db("parent",$self->parentconfig()); |
109 |
< |
# $self->config()->policy("cache","local"); |
110 |
< |
$self->config($ad); |
111 |
< |
$self->config()->basedoc($self->parentconfig()->basedoc()); |
112 |
< |
} |
113 |
< |
|
114 |
< |
sub bootstrapfromlocation { |
53 |
> |
sub name { |
54 |
|
my $self=shift; |
55 |
< |
|
56 |
< |
if ( ! defined $self->location(@_) ) { |
118 |
< |
$self->error("Unable to locate the top of local configuration area"); |
119 |
< |
} |
120 |
< |
print "Found top ".$self->location()."\n"; |
121 |
< |
$self->_setupstore(); |
122 |
< |
$self->restore($self->location()."/.SCRAM/ConfigArea.dat"); |
55 |
> |
@_?$self->{name}=shift |
56 |
> |
:$self->{name}; |
57 |
|
} |
58 |
|
|
59 |
< |
sub parentconfig { |
59 |
> |
sub version { |
60 |
|
my $self=shift; |
61 |
< |
@_?$self->{parentconfig}=shift |
62 |
< |
:$self->{parentconfig}; |
61 |
> |
@_?$self->{version}=shift |
62 |
> |
:$self->{version}; |
63 |
|
} |
64 |
|
|
65 |
< |
sub store { |
65 |
> |
sub setup { |
66 |
|
my $self=shift; |
67 |
|
my $location=shift; |
68 |
< |
|
69 |
< |
my $fh=$self->openfile(">".$location); |
70 |
< |
$self->savevar($fh,"location", $self->location()); |
71 |
< |
$self->savevar($fh,"url", $self->url()); |
72 |
< |
$self->savevar($fh,"name", $self->name()); |
73 |
< |
$self->savevar($fh,"version", $self->version()); |
74 |
< |
$fh->close(); |
68 |
> |
my $areaname=shift || undef; |
69 |
> |
my $symlinks=shift || 0; |
70 |
> |
my $locarea = shift || undef; |
71 |
> |
if ( (! defined $areaname) || ( $areaname eq "" ) ) { |
72 |
> |
$areaname=$self->version(); |
73 |
> |
} |
74 |
> |
$self->location($location."/".$areaname); |
75 |
> |
$self->symlinks($symlinks); |
76 |
> |
if ($self->configchksum() ne "") |
77 |
> |
{ |
78 |
> |
if ((!-defined $locarea) && (-f "${location}/${areaname}/".$self->admindir()."/Environment")) |
79 |
> |
{ |
80 |
> |
$locarea=Configuration::ConfigArea->new(); |
81 |
> |
$locarea->bootstrapfromlocation("${location}/${areaname}"); |
82 |
> |
} |
83 |
> |
if ((defined $locarea) && ($locarea->configchksum() != $self->configchksum())) |
84 |
> |
{ |
85 |
> |
print "ERROR: Can not setup your current working area for SCRAM_ARCH:$ENV{SCRAM_ARCH}.\n", |
86 |
> |
"Your current development area ${location}/${areaname}\n", |
87 |
> |
"is using a different ${areaname}/config then the one used for\n", |
88 |
> |
$self->releasetop(),".\n"; |
89 |
> |
exit 1; |
90 |
> |
} |
91 |
> |
} |
92 |
> |
Utilities::AddDir::adddir($self->archdir()); |
93 |
|
} |
94 |
|
|
95 |
< |
sub copy { |
95 |
> |
sub configurationdir { |
96 |
|
my $self=shift; |
97 |
< |
my $destination=shift; |
98 |
< |
use File::Basename; |
99 |
< |
# create the area |
100 |
< |
|
149 |
< |
AddDir::adddir(dirname($destination)); |
150 |
< |
|
151 |
< |
my @cpcmd=(qw(cp -r), "$self->location()", "$destination"); |
152 |
< |
print "@cpcmd"; |
153 |
< |
# File::Copy::copy("$self->location()", "$destination") or |
154 |
< |
system(@cpcmd) or |
155 |
< |
$self->error("Cannot copy ".$self->location(). |
156 |
< |
" to $destination ".$!); |
157 |
< |
|
158 |
< |
# create a new object based on the new area |
159 |
< |
my $newarea=ref($self)->new($self->parentconfig()); |
160 |
< |
$newarea->bootstrapfromlocation($destination); |
161 |
< |
# save it with the new location info |
162 |
< |
$newarea->store($self->location()."/.SCRAM/ConfigArea.dat"); |
97 |
> |
if ( @_ ) { |
98 |
> |
$self->{configurationdir}=shift; |
99 |
> |
} |
100 |
> |
return (defined $self->{configurationdir})?$self->{configurationdir}:undef; |
101 |
|
} |
102 |
|
|
103 |
< |
sub restore { |
103 |
> |
sub sourcedir { |
104 |
|
my $self=shift; |
105 |
< |
my $location=shift; |
106 |
< |
|
107 |
< |
my $fh=$self->openfile("<".$location); |
108 |
< |
my $varhash={}; |
171 |
< |
$self->restorevars($fh,$varhash); |
172 |
< |
if ( ! defined $self->location() ) { |
173 |
< |
$self->location($$varhash{"location"}); |
174 |
< |
} |
175 |
< |
$self->_setupstore(); |
176 |
< |
$self->url($$varhash{"url"}); |
177 |
< |
$self->name($$varhash{"name"}); |
178 |
< |
$self->version($$varhash{"version"}); |
179 |
< |
$fh->close(); |
105 |
> |
if ( @_ ) { |
106 |
> |
$self->{sourcedir}=shift; |
107 |
> |
} |
108 |
> |
return (defined $self->{sourcedir})?$self->{sourcedir}:undef; |
109 |
|
} |
110 |
|
|
111 |
< |
sub name { |
111 |
> |
sub releasetop { |
112 |
|
my $self=shift; |
113 |
< |
|
114 |
< |
@_?$self->{name}=shift |
115 |
< |
:$self->{name}; |
113 |
> |
if ( @_ ) { |
114 |
> |
$self->{releasetop}=shift; |
115 |
> |
} |
116 |
> |
return (defined $self->{releasetop})?$self->{releasetop}:undef; |
117 |
|
} |
118 |
|
|
119 |
< |
sub version { |
120 |
< |
my $self=shift; |
119 |
> |
sub admindir() |
120 |
> |
{ |
121 |
> |
my $self=shift; |
122 |
> |
|
123 |
> |
@_ ? $self->{admindir} = shift |
124 |
> |
: $self->{admindir}; |
125 |
> |
} |
126 |
|
|
127 |
< |
@_?$self->{version}=shift |
128 |
< |
:$self->{version}; |
127 |
> |
sub bootstrapfromlocation { |
128 |
> |
my $self=shift; |
129 |
> |
my $location = $self->searchlocation(shift); |
130 |
> |
my $rv=0; |
131 |
> |
if ( ! defined $location) { |
132 |
> |
$rv=1; |
133 |
> |
} |
134 |
> |
else { |
135 |
> |
$self->location($location); |
136 |
> |
$self->_LoadEnvFile(); |
137 |
> |
} |
138 |
> |
return $rv; |
139 |
|
} |
140 |
|
|
141 |
|
sub location { |
143 |
|
|
144 |
|
if ( @_ ) { |
145 |
|
$self->{location}=shift; |
146 |
+ |
$self->archname($ENV{SCRAM_ARCH}); |
147 |
|
} |
148 |
|
elsif ( ! defined $self->{location} ) { |
149 |
|
# try and find the release location |
150 |
|
$self->{location}=$self->searchlocation(); |
151 |
+ |
if (defined $self->{location}) |
152 |
+ |
{ |
153 |
+ |
$self->archname($ENV{SCRAM_ARCH}); |
154 |
+ |
} |
155 |
|
} |
156 |
|
return $self->{location}; |
157 |
|
} |
158 |
|
|
159 |
|
sub searchlocation { |
160 |
|
my $self=shift; |
161 |
< |
|
161 |
> |
|
162 |
|
#start search in current directory if not specified |
163 |
|
my $thispath; |
164 |
< |
@_?$thispath=shift |
165 |
< |
:$thispath=cwd(); |
166 |
< |
|
164 |
> |
if ( @_ ) { |
165 |
> |
$thispath=shift |
166 |
> |
} |
167 |
> |
else { |
168 |
> |
$thispath=cwd(); |
169 |
> |
} |
170 |
> |
|
171 |
|
my $rv=0; |
172 |
|
|
173 |
+ |
# chop off any files - we only want dirs |
174 |
+ |
if ( -f $thispath ) { |
175 |
+ |
$thispath=~s/(.*)\/.*/$1/; |
176 |
+ |
} |
177 |
|
Sloop:{ |
178 |
|
do { |
179 |
< |
# print "Searching $thispath\n"; |
180 |
< |
if ( -e "$thispath/.SCRAM" ) { |
181 |
< |
# print "Found\n"; |
179 |
> |
$self->verbose("Searching $thispath"); |
180 |
> |
if ( -e "$thispath/".$self->{admindir} ) { |
181 |
> |
$self->verbose("Found\n"); |
182 |
|
$rv=1; |
183 |
|
last Sloop; |
184 |
|
} |
185 |
|
} while ( ($thispath=~s/(.*)\/.*/$1/)=~/./ ) }; |
186 |
< |
|
186 |
> |
|
187 |
|
return $rv?$thispath:undef; |
188 |
|
} |
189 |
|
|
190 |
< |
sub meta { |
190 |
> |
sub archname { |
191 |
|
my $self=shift; |
192 |
< |
|
193 |
< |
my $string=$self->name()." ".$self->version()." located at :\n ". |
194 |
< |
$self->location; |
192 |
> |
if ( @_ ) { |
193 |
> |
if (defined $self->{location}) { |
194 |
> |
$self->archdir($self->{location}."/".$self->{admindir}."/".$ENV{SCRAM_ARCH}); |
195 |
> |
} |
196 |
> |
} |
197 |
> |
return $ENV{SCRAM_ARCH}; |
198 |
|
} |
199 |
|
|
200 |
< |
sub configitem { |
200 |
> |
sub archdir { |
201 |
|
my $self=shift; |
202 |
< |
|
203 |
< |
return ($self->config()->find("ConfigItem",@_)); |
202 |
> |
if ( @_ ) { |
203 |
> |
$self->{archdir}=shift; |
204 |
> |
} |
205 |
> |
return $self->{archdir}; |
206 |
|
} |
207 |
|
|
208 |
< |
sub addconfigitem { |
208 |
> |
sub satellite { |
209 |
|
my $self=shift; |
210 |
< |
my $url=shift; |
211 |
< |
|
212 |
< |
my $docref=$self->activatedoc($url); |
213 |
< |
# Set up the document |
214 |
< |
$docref->setup(); |
215 |
< |
# $self->config()->storepolicy("local"); |
216 |
< |
$docref->save(); |
210 |
> |
my $relloc = $self->location(); |
211 |
> |
my $sat=Configuration::ConfigArea->new(); |
212 |
> |
$sat->name($self->name()); |
213 |
> |
$sat->version($self->version()); |
214 |
> |
$sat->configurationdir($self->configurationdir()); |
215 |
> |
$sat->sourcedir($self->sourcedir()); |
216 |
> |
$sat->releasetop($relloc); |
217 |
> |
$sat->configchksum($self->configchksum()); |
218 |
> |
$sat->setup(@_); |
219 |
> |
$self->copywithskip($self->archdir(),$sat->archdir(),["InstalledTools","ProjectCache.db.gz","RuntimeCache.db.gz","DirCache.db.gz","MakeData/DirCache","MakeData/DirCache.mk","MakeData/src.mk"]); |
220 |
> |
$envfile = $sat->archdir()."/Environment"; |
221 |
> |
open ( $fh, "> $envfile" ) or $sat->error("Cannot Open \"$envfile\" file to Save\n $!"); |
222 |
> |
print $fh "RELEASETOP=$relloc\n"; |
223 |
> |
close($fh); |
224 |
> |
my $devconf = $sat->location()."/".$sat->configurationdir(); |
225 |
> |
my $relconf = $self->location()."/".$self->configurationdir(); |
226 |
> |
if (!-d $devconf) |
227 |
> |
{ |
228 |
> |
$self->copywithskip($relconf,$devconf,['toolbox']); |
229 |
> |
} |
230 |
> |
$envfile = $sat->location()."/".$self->{admindir}."/Environment"; |
231 |
> |
if (! -f $envfile) |
232 |
> |
{ |
233 |
> |
$sat->save (); |
234 |
> |
} |
235 |
> |
Utilities::AddDir::copydir("${relconf}/toolbox/$ENV{SCRAM_ARCH}","${devconf}/toolbox/$ENV{SCRAM_ARCH}"); |
236 |
> |
Utilities::AddDir::adddir ($sat->location()."/".$sat->sourcedir()); |
237 |
> |
return $sat; |
238 |
> |
} |
239 |
> |
|
240 |
> |
sub copywithskip { |
241 |
> |
my $self=shift; |
242 |
> |
my $src=shift; |
243 |
> |
my $des=shift; |
244 |
> |
my $filetoskip=shift || []; |
245 |
> |
my $rv=1; |
246 |
> |
if ( $src ne $des ) |
247 |
> |
{ |
248 |
> |
if ( -d $src ) |
249 |
> |
{ |
250 |
> |
my $fs=[]; |
251 |
> |
foreach my $f (@$filetoskip) {push @$fs,"${src}/${f}";} |
252 |
> |
Utilities::AddDir::copydirwithskip($src,$des,$fs); |
253 |
> |
$rv=0; |
254 |
> |
} |
255 |
> |
} |
256 |
> |
return $rv; |
257 |
|
} |
258 |
|
|
259 |
< |
# -------------- Tags --------------------------------- |
257 |
< |
# -- init parse |
258 |
< |
sub Project_Start { |
259 |
> |
sub copyenv { |
260 |
|
my $self=shift; |
260 |
– |
my $name=shift; |
261 |
|
my $hashref=shift; |
262 |
< |
|
263 |
< |
$self->checktag($name,$hashref,'name'); |
264 |
< |
$self->checktag($name,$hashref,'version'); |
265 |
< |
|
266 |
< |
$self->name($$hashref{'name'}); |
267 |
< |
$self->version($$hashref{'version'}); |
262 |
> |
|
263 |
> |
foreach $elem ( keys %{$self->{ENV}} ) { |
264 |
> |
$$hashref{$elem}=$self->{ENV}{$elem}; |
265 |
> |
} |
266 |
|
} |
267 |
|
|
268 |
< |
|
271 |
< |
sub Project_text { |
268 |
> |
sub arch { |
269 |
|
my $self=shift; |
270 |
< |
my $name=shift; |
274 |
< |
my $string=shift; |
275 |
< |
|
276 |
< |
print $string; |
270 |
> |
return $ENV{SCRAM_ARCH}; |
271 |
|
} |
272 |
|
|
273 |
< |
# ---- download parse |
280 |
< |
|
281 |
< |
sub Use_download_Start { |
273 |
> |
sub save { |
274 |
|
my $self=shift; |
275 |
< |
my $name=shift; |
284 |
< |
my $hashref=shift; |
285 |
< |
|
286 |
< |
$self->checktag($name,$hashref,'url'); |
287 |
< |
print "Downloading .... ".$$hashref{'url'}."\n"; |
288 |
< |
$self->getfile($$hashref{'url'}); |
275 |
> |
$self->_SaveEnvFile(); |
276 |
|
} |
277 |
|
|
278 |
< |
# --- setup parse |
278 |
> |
# ---- support routines |
279 |
|
|
280 |
< |
sub Use_Start { |
281 |
< |
my $self=shift; |
282 |
< |
my $name=shift; |
283 |
< |
my $hashref=shift; |
280 |
> |
sub _SaveEnvFile |
281 |
> |
{ |
282 |
> |
my $self=shift; |
283 |
> |
|
284 |
> |
my $fh; |
285 |
> |
my $envfile = $self->location()."/".$self->{admindir}."/Environment"; |
286 |
> |
open ( $fh, "> $envfile" ) or $self->error("Cannot Open \"$envfile\" file to Save\n $!"); |
287 |
|
|
288 |
< |
$self->checktag($name,$hashref,'url'); |
289 |
< |
$self->addconfigitem($$hashref{'url'}); |
290 |
< |
} |
291 |
< |
|
288 |
> |
print $fh "SCRAM_PROJECTNAME=".$self->name()."\n"; |
289 |
> |
print $fh "SCRAM_PROJECTVERSION=".$self->version()."\n"; |
290 |
> |
print $fh "SCRAM_CONFIGDIR=".$self->configurationdir()."\n"; |
291 |
> |
print $fh "SCRAM_SOURCEDIR=".$self->sourcedir()."\n"; |
292 |
> |
print $fh "SCRAM_SYMLINKS=",$self->symlinks(),"\n"; |
293 |
> |
print $fh "SCRAM_CONFIGCHKSUM=",$self->configchksum(),"\n"; |
294 |
> |
close($fh); |
295 |
> |
|
296 |
> |
# Set the default permissions (-rw-r--r--): |
297 |
> |
my $filemode = 0644; |
298 |
> |
chmod $filemode, $self->location()."/".$self->{admindir}."/Environment"; |
299 |
> |
} |
300 |
> |
|
301 |
> |
sub _LoadEnvFile |
302 |
> |
{ |
303 |
> |
my $self=shift; |
304 |
> |
|
305 |
> |
my $fh; |
306 |
> |
my $envfile = $self->location()."/".$self->{admindir}."/Environment"; |
307 |
> |
open ( $fh, "< $envfile" ) or $self->error("Cannot open \"$envfile\" file for reading.\n $!"); |
308 |
> |
while ( <$fh> ) |
309 |
> |
{ |
310 |
> |
chomp; |
311 |
> |
next if /^#/; |
312 |
> |
next if /^\s*$/ ; |
313 |
> |
($name, $value)=split /=/; |
314 |
> |
eval "\$self->{ENV}{${name}}=\"$value\""; |
315 |
> |
} |
316 |
> |
close($fh); |
317 |
> |
$envfile = $self->archdir()."/Environment"; |
318 |
> |
if (-f $envfile) |
319 |
> |
{ |
320 |
> |
open ( $fh, "< $envfile" ) or $self->error("Cannot open \"$envfile\" file for reading.\n $!"); |
321 |
> |
while ( <$fh> ) |
322 |
> |
{ |
323 |
> |
chomp; |
324 |
> |
next if /^#/; |
325 |
> |
next if /^\s*$/ ; |
326 |
> |
($name, $value)=split /=/; |
327 |
> |
eval "\$self->{ENV}{${name}}=\"$value\""; |
328 |
> |
} |
329 |
> |
close($fh); |
330 |
> |
} |
331 |
> |
|
332 |
> |
# -- set internal variables appropriately |
333 |
> |
if ( defined $self->{ENV}{"SCRAM_PROJECTNAME"} ) |
334 |
> |
{ |
335 |
> |
$self->name($self->{ENV}{"SCRAM_PROJECTNAME"}); |
336 |
> |
} |
337 |
> |
if ( defined $self->{ENV}{"SCRAM_SYMLINKS"} ) |
338 |
> |
{ |
339 |
> |
$self->symlinks($self->{ENV}{"SCRAM_SYMLINKS"}); |
340 |
> |
} |
341 |
> |
if ( defined $self->{ENV}{"SCRAM_CONFIGCHKSUM"} ) |
342 |
> |
{ |
343 |
> |
$self->configchksum($self->{ENV}{"SCRAM_CONFIGCHKSUM"}); |
344 |
> |
} |
345 |
> |
if ( defined $self->{ENV}{"SCRAM_PROJECTVERSION"} ) |
346 |
> |
{ |
347 |
> |
$self->version($self->{ENV}{"SCRAM_PROJECTVERSION"}); |
348 |
> |
} |
349 |
> |
if ( defined $self->{ENV}{"SCRAM_CONFIGDIR"} ) |
350 |
> |
{ |
351 |
> |
$self->configurationdir($self->{ENV}{"SCRAM_CONFIGDIR"}); |
352 |
> |
} |
353 |
> |
if ( defined $self->{ENV}{"SCRAM_SOURCEDIR"} ) |
354 |
> |
{ |
355 |
> |
$self->sourcedir($self->{ENV}{"SCRAM_SOURCEDIR"}); |
356 |
> |
} |
357 |
> |
if ( defined $self->{ENV}{"RELEASETOP"} ) |
358 |
> |
{ |
359 |
> |
$self->releasetop($self->{ENV}{"RELEASETOP"}); |
360 |
> |
} |
361 |
> |
} |
362 |
> |
1; |