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

Comparing COMP/SCRAM/src/clientfile.pm (file contents):
Revision 1.4 by williamc, Thu Mar 18 10:32:03 1999 UTC vs.
Revision 1.7 by williamc, Wed Mar 24 15:52:42 1999 UTC

# Line 14 | Line 14 | push @ARCHBLOCK, $Arch;
14  
15   sub BuildClientFile {
16          my $projectfile=shift;
17 +        use ToolBox;
18 +
19 +        openclientfile('new') and return;
20 +        $toolbox=ToolBox->new();
21 +        print CLIENT "# Machine Generated File - do not edit\n";
22 +        _ParseProjectReqs($projectfile);
23 +        &closeclientfile;
24 + }
25 +
26 + sub closeclienfile {
27 +        close INSTALLLOG;
28 +        close CLIENT;
29 +        close CLIENT2;
30 + }
31 +
32 + sub openclientfile {
33 +        my $action=shift;
34          my $archdir=".SCRAM/$ENV{SCRAM_ARCH}";
35          my $clientfile="$archdir/clientsettings";
36          use Utilities::AddDir;
20        use ToolBox;
37  
38          AddDir::adddir($archdir);
39 <        initialiseclient($clientfile) or return; # get out if it already exists
40 <        $toolbox=ToolBox->new();
41 <        open ( CLIENT, ">$ENV{LOCALTOP}/$clientfile" ) ||
39 >        if ( $action=~/add/i ) {
40 >          $actionop='>>';
41 >          initialiseclient($clientfile);
42 >        }
43 >        else { #default is new
44 >          $actionop='>';
45 >          initialiseclient($clientfile) or return 1; # get out if it already exists
46 >        }
47 >        open ( CLIENT, "$actionop$ENV{LOCALTOP}/$clientfile" ) ||
48                  die "clientfile: Cannot open clientsettings file "
49                          ."$clientfile $!\n";
50 <        open ( CLIENT2, ">$ENV{LOCALTOP}/".$clientfile."_reqs" ) ||
50 >        open ( CLIENT2, "$actionop$ENV{LOCALTOP}/".$clientfile."_reqs" ) ||
51                  die "clientfile: Cannot open clientsettings file "
52                          ."$clientfile $!\n";
53 <        open (INSTALLLOG, ">$archdir/installation_log")
53 >        open (INSTALLLOG, "$actionop$archdir/installation_log")
54                          || die "clientfile: Cannot open log file $!\n";
55 <        print CLIENT "# Machine Generated File - do not edit\n";
34 <        _ParseProjectReqs($projectfile);
35 <        close INSTALLLOG;
36 <        close CLIENT;
37 <        close CLIENT2;
55 >        return 0;
56   }
57  
58   sub _ParseProjectReqs {
# Line 156 | Line 174 | sub External_client {
174          $toolswitch->checkparam( $hashref, $name, 'ref' );
175          print CLIENT2 <<ENDTEXT;
176   ifdef $toolname
177 < $$hashref{ref}=true\n";
177 > $$hashref{ref}=true
178   endif
179   ENDTEXT
180   }
# Line 572 | Line 590 | sub initialiseclient {
590          if ( ! (-f "$ENV{LOCALTOP}/$clientfile" ) ) {
591            copy ( "$ENV{RELEASETOP}/$clientfile","$ENV{LOCALTOP}/$clientfile" );
592          }
593 +        if ( ! (-f "$ENV{LOCALTOP}/".$clientfile."_reqs" ) ) {
594 +          copy ( "$ENV{RELEASETOP}/".$clientfile."_reqs","$ENV{LOCALTOP}/".$clientfile."_reqs" );
595 +        }
596          # now read it in to memory for future reference
597          open (CLIENTFILEIN, "<$ENV{LOCALTOP}/$clientfile") or return 1;
598            ($name, $version, $var, @rest ) = split /:/;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines