ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/ToolCache.pm
Revision: 1.1.2.1
Committed: Fri Feb 27 15:34:55 2004 UTC (21 years, 2 months ago) by sashby
Content type: text/plain
Branch: SCRAM_V1_BRANCH
CVS Tags: V1_pre0, SCRAM_V1, SCRAMV1_IMPORT
Branch point for: V1_pre1
Changes since 1.1: +109 -0 lines
Log Message:
First import of new SCRAM packages into CMS cvs repos.

File Contents

# User Rev Content
1 sashby 1.1.2.1 #____________________________________________________________________
2     # File: ToolCache.pm
3     #____________________________________________________________________
4     #
5     # Author: Shaun Ashby <Shaun.Ashby@cern.ch>
6     # Update: 2003-10-28 10:14:08+0100
7     # Revision: $Id: ToolCache.pm,v 1.3 2004/02/20 16:40:34 sashby Exp $
8     #
9     # Copyright: 2003 (C) Shaun Ashby
10     #
11     #--------------------------------------------------------------------
12     package BuildSystem::ToolCache;
13     require 5.004;
14    
15     use Exporter;
16     @ISA=qw(Exporter);
17     #
18     sub new()
19     {
20     my $proto=shift;
21     my $class=ref($proto) || $proto;
22     my $self =
23     {
24     DOWNLOADED => { tools => undef, url => undef }, # Downloaded tool infos;
25     SELECTED => undef, # The selected tools (info from RequirementsDoc);
26     DEFAULTVERSIONS => {}, # Hash of tools and their default version;
27     RAW => [], # The tools to be set up (the raw data from the tool docs);
28     SETUP => {}, # The saved set-up data;
29     STAMP => undef # The last time the cache was modified
30     };
31    
32     bless $self,$class;
33     return $self;
34     }
35    
36     sub downloadedtools()
37     {
38     my $self=shift;
39     # Returns an array of downloaded tools, basically all
40     # those listed in configuration:
41     @_ ? $self->{DOWNLOADED}{tools} = shift #
42     : $self->{DOWNLOADED}{tools};
43     }
44    
45     sub defaultversions()
46     {
47     my $self=shift;
48     # Returns a hash of tools and their default versions:
49     @_ ? $self->{DEFAULTVERSIONS} = shift #
50     : $self->{DEFAULTVERSIONS};
51     }
52    
53     sub toolurls()
54     {
55     my $self=shift;
56     # Returns a hash of tools and their URLs:
57     @_ ? $self->{DOWNLOADED}->{url} = shift #
58     : $self->{DOWNLOADED}->{url};
59     }
60    
61     sub selected()
62     {
63     my $self=shift;
64     # Returns array of selected tools:
65     @_ ? push(@{$self->{SELECTED}},@_) #
66     : @{$self->{SELECTED}};
67     }
68    
69     sub store()
70     {
71     my $self=shift;
72     # Store ToolParser objects (tools not set up yet):
73     @_ ? push(@{$self->{RAW}},@_) #
74     : @{$self->{RAW}};
75     }
76    
77     sub rawtools()
78     {
79     my $self=shift;
80     # Return a list of tools
81     return @{$self->{RAW}};
82     }
83    
84     sub setup()
85     {
86     my $self=shift;
87     # Returns a hash of toolname/ToolParser objects (set-up tools):
88     return $self->{SETUP};
89     }
90    
91     ### Read/write from/to cachefile:
92     sub name()
93     {
94     my $self = shift;
95     # Set the name of the cache file:
96     @_ ? $self->{CACHENAME} = shift #
97     : $self->{CACHENAME};
98    
99     }
100    
101     sub writecache()
102     {
103     my $self=shift;
104     use Cache::CacheUtilities;
105     &write($self,$self->{CACHENAME});
106     }
107    
108     1;
109