ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/Build.pm
Revision: 1.4
Committed: Fri Sep 29 06:45:51 2000 UTC (24 years, 7 months ago) by williamc
Content type: text/plain
Branch: MAIN
Changes since 1.3: +12 -0 lines
Log Message:
update from laptop

File Contents

# User Rev Content
1 williamc 1.1 #
2     # Build.pm
3     #
4     # Originally Written by Christopher Williams
5     #
6     # Description
7     #
8     # Interface
9     # ---------
10     # new(ConfigArea) : A new Build object
11     # build(dir,[@targets]) : Build relevant target for a given directory
12     # dir relative to top. Returns a BuildReport
13    
14     package BuildSystem::Build;
15     use BuildSystem::BuildReport;
16 williamc 1.4 use BuildSystem::BuildSetup;
17 williamc 1.1 use Utilities::Verbose;
18     require 5.004;
19     @ISA=qw(Utilities::Verbose);
20    
21     sub new {
22     my $class=shift;
23     my $self={};
24 williamc 1.2 bless $self, $class;
25 williamc 1.1 $self->{area}=shift;
26 williamc 1.2 $self->{area}->copyenv(\%ENV);
27     $ENV{LOCALTOP}=$self->{area}->location();
28 williamc 1.4
29     # -- set RELEASTOP
30     my $rarea=$self->{area}->linkarea();
31     if ( ! defined $rarea ) {
32     $ENV{RELEASETOP}=$ENV{LOCALTOP};
33     }
34     else {
35     $ENV{RELEASETOP}=$rarea->location();
36     }
37    
38 williamc 1.2 $self->verbose("LOCALTOP=".$ENV{LOCALTOP});
39 williamc 1.4 $self->verbose("RELEASETOP=".$ENV{RELEASETOP});
40 williamc 1.1 return $self;
41     }
42    
43     sub build {
44     my $self=shift;
45     my $dir=shift;
46    
47     # -- set up a report
48     my $report=BuildSystem::BuildReport->new();
49    
50     # -- interface with old system
51     my $fulldir=$self->{area}->location()."/".$dir;
52     if ( ! -d $fulldir ) {
53     $report->error("$fulldir does not exist");
54 williamc 1.3 $report->status(1); # set to fail
55 williamc 1.1 }
56     else {
57     chdir $fulldir;
58 williamc 1.3 # -- initialise BuildSystem if we dont already have it
59     if ( ! defined $self->{bs} ) {
60     $self->{bs}=BuildSystem::BuildSetup->new($self->{area});
61     $self->{bs}->verbosity(1);
62     }
63 williamc 1.2 $self->verbose("Calling build module with $dir, @_");
64 williamc 1.3 my $rv=$self->{bs}->BuildDir($dir,@_);
65 williamc 1.2 $report->status($rv);
66 williamc 1.1 }
67     return $report;
68     }