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

Comparing COMP/SCRAM/src/Configuration/ConfigArea.pm (file contents):
Revision 1.23 by sashby, Fri Dec 10 13:41:40 2004 UTC vs.
Revision 1.27 by sashby, Fri Mar 4 17:46:58 2005 UTC

# Line 477 | Line 477 | sub align {
477  
478   sub copysetup {
479          my $self=shift;
480 <        my $dest=shift;
481 <
480 >        my $dest=shift;
481          my $rv=1;
482          # copy across the admin dir
483          my $temp=$self->location()."/".$self->{admindir}."/".$self->arch();
# Line 492 | Line 491 | sub copysetup {
491          return $rv;
492   }
493  
494 + sub copyurlcache {
495 +        my $self=shift;
496 +        my $dest=shift;
497 +        my $rv=1;
498 +        # copy across the admin dir
499 +        my $temp=$self->location()."/".$self->{admindir}."/cache";
500 +        my $temp2=$dest."/".$self->{admindir}."/cache";
501 +        if ( $temp ne $temp2 ) {
502 +         if ( -d $temp ) {
503 +          AddDir::copydir($temp,$temp2);
504 +          $rv=0;
505 +         }
506 +        }
507 +        return $rv;
508 + }
509 +
510 + sub copywithskip {
511 +        my $self=shift;
512 +        my $dest=shift;
513 +        my ($filetoskip)=@_;            
514 +        my $rv=1;
515 +        # copy across the admin dir
516 +        my $temp=$self->location()."/".$self->{admindir}."/".$self->arch();
517 +        my $temp2=$dest."/".$self->{admindir}."/".$self->arch();
518 +        if ( $temp ne $temp2 ) {
519 +         if ( -d $temp ) {
520 +          AddDir::copydirwithskip($temp,$temp2,$filetoskip);
521 +          $rv=0;
522 +         }
523 +        }
524 +        return $rv;
525 + }
526 +
527   sub copyenv {
528          my $self=shift;
529          my $hashref=shift;
# Line 543 | Line 575 | sub save {
575          $self->_SaveEnvFile();
576   }
577  
578 + sub reqdoc()
579 +   {
580 +   my $self=shift;
581 +   my ($path)=@_;
582 +   return $path."/".$self->{reqdoc};
583 +   }
584 +
585 + sub creationtime()
586 +   {
587 +   my $self=shift;
588 +   my ($location)= @_;
589 +   $location||=$self->location();
590 +   my $requirementsdoc = $self->reqdoc($location);
591 +   my ($mode, $time) = (stat($requirementsdoc))[2, 9];
592 +   my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time);
593 +
594 +   ($sec < 10) ? ($sec = "0".$sec) : $sec;
595 +   ($min < 10) ? ($min = "0".$min) : $min;
596 +
597 +   $year += 1900;
598 +   my $months =
599 +      {
600 +      0 => "Jan", 1 => "Feb",
601 +      2 => "Mar", 3 => "Apr",
602 +      4 => "May", 5 => "Jun",
603 +      6 => "Jul", 7 => "Aug",
604 +      8 => "Sept", 9 => "Oct",
605 +      10 => "Nov", 11 => "Dec" };
606 +  
607 +   my $days = { 1 => "Mon", 2 => "Tue", 3 => "Wed", 4 => "Thu", 5 => "Fri", 6 => "Sat", 7 => "Sun"};
608 +  
609 +   # Return the timestamp (as string) of the requirementsdoc:
610 +   return $days->{$wday}."-".$mday."-".$months->{$mon}."-".$year." ".$hour.":".$min.":".$sec;
611 +   }
612 +
613   # ---- support routines
614  
615 < sub _SaveEnvFile {
616 <        my $self=shift;
617 <        use FileHandle;
618 <        my $fh=FileHandle->new();
619 <        open ( $fh, ">".$self->location()."/".$self->{admindir}."/".
620 <                "Environment" ) or
621 <                $self->error("Cannot Open Environment file to Save ("
622 <                                .$self->location().")\n $!");
615 > sub _SaveEnvFile
616 >   {
617 >   my $self=shift;
618 >   my $filemode = 0644;
619 >  
620 >   use FileHandle;
621 >   my $fh=FileHandle->new();
622 >   open ( $fh, ">".$self->location()."/".$self->{admindir}."/".
623 >          "Environment" ) or
624 >          $self->error("Cannot Open Environment file to Save ("
625 >                       .$self->location().")\n $!");
626          
627 <        print $fh "SCRAM_PROJECTNAME=".$self->name()."\n";
628 <        print $fh "SCRAM_PROJECTVERSION=".$self->version()."\n";
629 <        print $fh "SCRAM_CONFIGDIR=".$self->configurationdir()."\n";
630 <        print $fh "SCRAM_SOURCEDIR=".$self->sourcedir()."\n";
631 <        print $fh "SCRAM_ProjReqsDoc=".$self->{reqdoc}."\n";
632 <        print $fh "SCRAM_TOOLBOXVERSION=".$self->{toolboxversion}."\n";
633 <        if ( defined $self->linkarea() ) {
634 <          my $area=$self->linkarea()->location();
635 <          if ( $area ne "" ) {
636 <          print $fh "RELEASETOP=".$area."\n";
637 <          }
638 <        }
639 <        undef $fh;
640 < }
641 <
627 >   print $fh "SCRAM_PROJECTNAME=".$self->name()."\n";
628 >   print $fh "SCRAM_PROJECTVERSION=".$self->version()."\n";
629 >   print $fh "SCRAM_CONFIGDIR=".$self->configurationdir()."\n";
630 >   print $fh "SCRAM_SOURCEDIR=".$self->sourcedir()."\n";
631 >   print $fh "SCRAM_ProjReqsDoc=".$self->{reqdoc}."\n";
632 >   print $fh "SCRAM_TOOLBOXVERSION=".$self->{toolboxversion}."\n";
633 >
634 >   if ( defined $self->linkarea() )
635 >      {
636 >      my $area=$self->linkarea()->location();
637 >      if ( $area ne "" )
638 >         {
639 >         print $fh "RELEASETOP=".$area."\n";
640 >         }
641 >      }
642 >  
643 >   undef $fh;
644 >  
645 >   # Set the default permissions (-rw-r--r--):
646 >   chmod $filemode, $self->location()."/".$self->{admindir}."/Environment";
647 >   }
648  
649   sub _LoadEnvFile
650     {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines