ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/ToolManager.pm
(Generate patch)

Comparing COMP/SCRAM/src/BuildSystem/ToolManager.pm (file contents):
Revision 1.20 by muzaffar, Fri Jan 14 17:36:42 2011 UTC vs.
Revision 1.26 by muzaffar, Wed Feb 13 11:44:13 2013 UTC

# Line 3 | Line 3
3   #____________________________________________________________________
4   #  
5   # Author: Shaun Ashby <Shaun.Ashby@cern.ch>
6 # Update: 2003-11-12 15:04:16+0100
7 # Revision: $Id$
8 #
6   # Copyright: 2003 (C) Shaun Ashby
7   #
8   #--------------------------------------------------------------------
# Line 33 | Line 30 | sub new
30     return $self;
31     }
32  
33 + sub initpathvars()
34 +   {
35 +   my $self=shift;
36 +   if (!exists $self->{internal}{path_variables})
37 +      {
38 +      my %pathvars=("PATH", 1, "LD_LIBRARY_PATH", 1, "DYLD_LIBRARY_PATH", 1, "DYLD_FALLBACK_LIBRARY_PATH", 1, "PYTHONPATH", 1);
39 +      my $p = $self->_parsetool($self->{configdir}."/Self.xml");
40 +      if ((exists $p->{content}) && (exists $p->{content}{CLIENT}) && (exists $p->{content}{CLIENT}{FLAGS}))
41 +         {
42 +         if (exists $p->{content}{CLIENT}{FLAGS}{REM_PATH_VARIABLES})
43 +            {
44 +            foreach my $f (@{$p->{content}{CLIENT}{FLAGS}{REM_PATH_VARIABLES}})
45 +               {
46 +               delete $pathvars{$f};
47 +               }
48 +            }
49 +         if (exists $p->{content}{CLIENT}{FLAGS}{PATH_VARIABLES})
50 +            {
51 +            foreach my $f (@{$p->{content}{CLIENT}{FLAGS}{PATH_VARIABLES}})
52 +               {
53 +               $pathvars{$f}=1;
54 +               }
55 +            }
56 +         }
57 +      my $paths = join("|",keys %pathvars);
58 +      if ($paths){$paths = "^($paths)\$";}
59 +      $self->{internal}{path_variables}=$paths;
60 +      }
61 +   }
62 +
63   sub init ()
64     {
65     my $self=shift;
# Line 40 | Line 67 | sub init ()
67     $self->{topdir}=$projectarea->location();
68     $self->{configdir}=$self->{topdir}."/".$projectarea->configurationdir();
69     $self->{archstore}=$projectarea->archdir();
70 <   $self->{toolcache}=$self->{configdir}."/toolbox/".$projectarea->arch()."/tools";
70 >   $self->{toolcache}=$self->{configdir}."/toolbox/$ENV{SCRAM_ARCH}/tools";
71     $self->name($projectarea->toolcachename());
72 +   $self->initpathvars();
73     $self->dirty();
74     }
75    
# Line 63 | Line 91 | sub coresetup()
91     my $self=shift;
92     my ($toolfile) = @_;
93    
94 <   my $toolparser = BuildSystem::ToolParser->new();
95 <   $toolparser->filehead('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><doc type="BuildSystem::ToolDoc" version="1.0">');
68 <   $toolparser->filetail('</doc>');
69 <   $toolparser->parse($toolfile);
94 >   my $toolparser = $self->_parsetool($toolfile);
95 >   my $store = $toolparser->processrawtool();
96     my $toolname = $toolparser->toolname();
97     my $toolversion = $toolparser->toolversion();
98     scramlogmsg("\n",$::bold."Setting up ",$toolname," version ",$toolversion,":  ".$::normal,"\n");
73  
74   # Next, set up the tool:
75   my $store = $toolparser->processrawtool();
99  
77   # Check to see if this tool is a compiler. If so, store it.
78   # Also store the language that this compiler supprots, and a
79   # compiler name (e.g. gcc323) which, in conjunction with a stem
80   # architecture name like slc3_ia32_, can be used to build a complete arch string:
81   if ($store->scram_compiler() == 1)
82      {
83      my @supported_language = $store->flags("SCRAM_LANGUAGE_TYPE");
84      my @compilername = $store->flags("SCRAM_COMPILER_NAME");
85      $self->scram_compiler($supported_language[0],$toolname,$compilername[0]);
86      }
87  
100     # Store the ToolData object in the cache:  
101     $self->storeincache($toolname,$store);
102     my $srcfile=Utilities::AddDir::fixpath($toolfile);
# Line 116 | Line 128 | sub setupself()
128        {
129        scramlogmsg("\n",$::bold."Setting up SELF:".$::normal,"\n");
130        # Self file exists so process it:
131 <      $selfparser = BuildSystem::ToolParser->new();
132 <      $selfparser->filehead ('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><doc type="BuildSystem::ToolDoc" version="1.0">');
121 <      $selfparser->filehead ('</doc>');
122 <      $selfparser->parse($filename);
123 <
124 <      # Next, set up the tool:
125 <      $store = $selfparser->processrawtool();
126 <
131 >      my $selfparser = $self->_parsetool($filename);
132 >      my $store = $selfparser->processrawtool();
133        # If we are in a developer area, also add RELEASETOP paths:
134        if (exists($ENV{RELEASETOP}))
135           {
# Line 138 | Line 144 | sub setupself()
144     else
145        {
146        scramlogdump();
147 <      print "\n";
148 <      print "SCRAM: No file config/Self.xml...nothing to do.";
149 <      print "\n";
147 >      print STDERR "\n";
148 >      print STDERR "SCRAM: No file config/Self.xml...nothing to do.";
149 >      print STDERR "\n";
150        return;
151        }
152     }
# Line 220 | Line 226 | sub toolsdata()
226     return $data;
227     }
228  
229 + sub _parsetool()
230 +   {
231 +   my ($self,$filename)=@_;
232 +   my $p = BuildSystem::ToolParser->new($self->{internal}{path_variables});
233 +   $p->filehead ('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><doc type="BuildSystem::ToolDoc" version="1.0">');
234 +   $p->filetail ('</doc>');
235 +   $p->parse($filename);
236 +   return $p;
237 +   }
238 +
239   sub _toolsdata()
240     {
241     my $self = shift;
# Line 261 | Line 277 | sub _toolsdata_scram()
277     $cache=$self->{SETUP}{$tool}{$cache};
278     if (!-d $cache)
279        {
280 <      print "ERROR: Release area \"$cache\" for \"$tool\" is not available.\n";
280 >      print STDERR "ERROR: Release area \"$cache\" for \"$tool\" is not available.\n";
281        return $order;
282        }
283     my $area=Configuration::ConfigArea->new();
# Line 269 | Line 285 | sub _toolsdata_scram()
285     my $cachefile=$area->toolcachename();
286     if (!-f $cachefile)
287        {
288 <      print "ERROR: Tools cache file for release area \"$cache\" is not available.\n";
288 >      print STDERR "ERROR: Tools cache file for release area \"$cache\" is not available.\n";
289        return $order;
290        }
291     $cache=&Cache::CacheUtilities::read($cachefile);
# Line 303 | Line 319 | sub remove_tool()
319     {
320     my $self=shift;
321     my ($toolname)=@_;
306   my $tool = $self->{SETUP}{$toolname};
307   if ($tool->scram_compiler() == 1)
308      {
309      while (my ($langtype, $ctool) = each %{$self->{SCRAM_COMPILER}})
310         {
311         if ($toolname eq $ctool->[0]){delete $self->{SCRAM_COMPILER}->{$langtype};}
312         }
313      }
322     delete $self->{SETUP}{$toolname};
323     print "Deleting $toolname from cache.","\n";
324     $self->updatetooltimestamp (undef, $toolname);
# Line 340 | Line 348 | sub scram_projects()
348     return $scram_projects;
349     }
350  
343 sub scram_compiler()
344   {
345   my $self=shift;
346   my ($langtype, $toolname, $compilername)=@_;
347
348   if ($langtype)
349      {
350      # Store the compiler info according to supported
351      # language types.
352      #
353      # ---------------------- e.g C++      cxxcompiler    gcc323
354      $self->{SCRAM_COMPILER}->{$langtype}=[ $toolname, $compilername ];
355      }
356   else
357      {
358      return $self->{SCRAM_COMPILER};
359      }
360   }
361
351   sub updatetooltimestamp ()
352     {
353     my $self=shift;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines