Diff for /loncom/build/Attic/parse.pl between versions 1.26 and 1.40

version 1.26, 2001/01/23 16:12:56 version 1.40, 2001/05/21 21:56:35
Line 2 Line 2
   
 # Scott Harrison  # Scott Harrison
 # November 2000  # November 2000
   # 12/5/2000,12/7,12/8,12/9,12/10,12/11,12/12,12/13,12/14,12/21 Scott Harrison
 # Read in loncapa tags and metagroup tags  # 1/8/2001,1/10/2001,1/13/2001,1/16/2001,1/18/2001,1/23/2001 Scott Harrison
   # 2/26/2001,2/27/2001,3/5/2001,4/10/2001,4/11,2001,4/13,2001 Scott Harrison
   # 4/17/2001 Scott Harrison
   
   # Read in loncapa tags and metagroup tags.  Output various
   # useful files for viewing, compiling, monitoring, updating,
   # and installing.
   
   # This code works well.  HOWEVER, I was in a rush when I
   # wrote it.  Future plans are that the parsing should be
   # much more event-state based and the input should be
   # more XML-ish. -Scott
   
 # ---------------------------------------------- Read in command line arguments  # ---------------------------------------------- Read in command line arguments
 my ($file,$mode)=@ARGV;  my ($file,$mode)=@ARGV;
Line 171  www:!!:500:500:www:/home/www:/bin/bash Line 182  www:!!:500:500:www:/home/www:/bin/bash
 END  END
 close OUT;  close OUT;
     open OUT,">>setup_file_list.txt";      open OUT,">>setup_file_list.txt";
       print OUT "BinaryRoot/etc/group\n";
       close OUT;
       open OUT,">BinaryRoot/etc/group";
       print OUT<<END;
   root::0:root
   bin::1:root,bin,daemon
   daemon::2:root,bin,daemon
   sys::3:root,bin,adm
   adm::4:root,adm,daemon
   tty::5:
   disk::6:root
   lp::7:daemon,lp
   mem::8:
   kmem::9:
   wheel::10:root
   mail::12:mail
   news::13:news
   uucp::14:uucp
   man::15:
   games::20:
   gopher::30:
   dip::40:
   ftp::50:
   nobody::99:
   users::100:
   www::500:
   END
   close OUT;
       open OUT,">>setup_file_list.txt";
     print OUT "BinaryRoot/etc/hosts.deny\n";      print OUT "BinaryRoot/etc/hosts.deny\n";
     close OUT;      close OUT;
     open OUT,">BinaryRoot/etc/hosts.deny";      open OUT,">BinaryRoot/etc/hosts.deny";
Line 179  ALL: ALL Line 219  ALL: ALL
 END  END
 close OUT;  close OUT;
           
       `install -o www -g users -m 0700 -d BinaryRoot/home/www`;
       open OUT,">>setup_file_list.txt";
       print OUT "BinaryRoot/home/www\n";
       close OUT;
     `install -d BinaryRoot/etc/pam.d`;      `install -d BinaryRoot/etc/pam.d`;
     `install -o 500 -g 500 -m 0700 -d BinaryRoot/home/www`;  
     open OUT,">>setup_file_list.txt";      open OUT,">>setup_file_list.txt";
     print OUT "BinaryRoot/etc/pam.d/passwd\n";      print OUT "BinaryRoot/etc/pam.d/passwd\n";
     close OUT;      close OUT;
Line 565  sub make_files_build_segment { Line 608  sub make_files_build_segment {
     my $description;      my $description;
     my @allfiles=keys %{$info{'LOCATION'}{$distribution}};      my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
     my $tab="\t";      my $tab="\t";
     my $sources="all: ";      my $sources="# Dynamic Makefile generated by LON-CAPA build process\n\n";
       $sources.="SHELL=\"/bin/sh\"\n\n";
       $sources.="\nall: ";
     foreach my $d (@$dirs) {      foreach my $d (@$dirs) {
  # set other values   # set other values
  my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};   my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
Line 588  sub make_files_build_segment { Line 633  sub make_files_build_segment {
  if ($build) {   if ($build) {
     my $dependencies=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'DEPENDENCIES'};      my $dependencies=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'DEPENDENCIES'};
     my $source2=$source;      my $source2=$source;
     $source2=~s/^[^\/]+\///;  #    $source2=~s/^[^\/]+\///;
      $source2="../" . $source2;       $source2="../../" . $source2;
     $sources.="$source2 ";      $sources.="$source2 ";
     my $directory=$build;      my $directory=$build;
     $directory=~s/^[^\/]+\///;  #    $directory=~s/^[^\/]+\///;
     $directory=~s/([^\/]+)$//;      $directory=~s/([^\/]+)$//;
      $directory="../" . $directory;       $directory="../../" . $directory;
     my $buildfile=$1;      my $buildfile=$1;
     my $sdir=$source;      my $sdir=$source;
     $sdir=~s/^[^\/]+\///;  #    $sdir=~s/^[^\/]+\///;
     $sdir=~s/([^\/]+)$//;      $sdir=~s/([^\/]+)$//;
      $sdir="../" . $sdir;       $sdir="../../" . $sdir;
     $dependencies=~s/\s+$//;      $dependencies=~s/\s+$//;
     my $depstat="";      my $depstat="";
     if ($dependencies=~s/\s+\[ALWAYS_RUN_BUILD_COMMAND\]//) {      if ($dependencies=~s/\s+\[ALWAYS_RUN_BUILD_COMMAND\]//) {
  $depstat=" alwaysrun";   $depstat=" alwaysrun";
     }      }
     $dependencies=~s/\s+/ $sdir/gs;      $dependencies=~s/\s+/ $sdir/gs;
       my @deps=split(/\s+/,$dependencies);
       shift @deps;
       my $testing=<<END;
    \@if !(echo "");\\
           then echo "**** LON-CAPA WARNING **** Strange shell. Check your path settings.";\\
   END
       foreach my $d (@deps) {
    $testing.=<<END;
    elif !(test -r $d);\\
    then echo "**** LON-CAPA WARNING **** missing the file: $d";\\
   END
       }
       chop $testing;
     $description.=<<END;      $description.=<<END;
 $source2: $dependencies$depstat  $source2: $depstat
 ${tab}cd $directory; sh ./$buildfile  $testing
           else \\
       ${tab}cd $directory; sh ./$buildfile;\\
           fi
   
 END  END
  }   }
Line 671  END Line 732  END
  my $rot=$filesfull[$i];   my $rot=$filesfull[$i];
  $rot=~s/[^\/]+$/\./ if $rot=~/\*/;   $rot=~s/[^\/]+$/\./ if $rot=~/\*/;
  my ($owner,$group)=split(/\:/,$devchown);   my ($owner,$group)=split(/\:/,$devchown);
  if ($category ne 'conf') {   if ($category ne 'conf' && $category ne 'symbolic link') {
     $description.=<<END if $category ne 'symbolic link';      if ($source!~/\*/) {
    $description.=<<END;
   \ttest -e \$(SOURCE)/$source \&\& install -o $owner -g $group -m $devchmod \$(SOURCE)/$source \$(TARGET)/$rot || echo "**** LON-CAPA WARNING **** CVS source file does not exist: \$(SOURCE)/$source"
   END
                       }
       else {
    $description.=<<END;
 \tinstall -o $owner -g $group -m $devchmod \$(SOURCE)/$source \$(TARGET)/$rot  \tinstall -o $owner -g $group -m $devchmod \$(SOURCE)/$source \$(TARGET)/$rot
 END  END
       }
                 }                  }
     }      }
  }   }
Line 724  END Line 792  END
  my ($owner,$group)=split(/\:/,$devchown);   my ($owner,$group)=split(/\:/,$devchown);
  if ($category eq 'conf') {   if ($category eq 'conf') {
     $description.=<<END;      $description.=<<END;
 \tinstall -b -S `date +'.\%Y\%m\%d\%H\%M\%S'` -o $owner -g $group -m $devchmod \$(SOURCE)/$source \$(TARGET)/$rot  \tcp -p \$(TARGET)/$rot \$(TARGET)/$rot`date +'.\%Y\%m\%d\%H\%M\%S'` 2>/dev/null; install -o $owner -g $group -m $devchmod \$(SOURCE)/$source \$(TARGET)/$rot
 END  END
                 }                  }
     }      }
Line 1326  END Line 1394  END
  my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};   my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
  my $fdescription=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'DESCRIPTION'};   my $fdescription=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'DESCRIPTION'};
  my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};   my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
    my $source2=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
  my $note=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'NOTE'};   my $note=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'NOTE'};
  $note.="<BR>" if $note;   $note.="<BR>" if $note;
  my $listing=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'FILES'};   my $listing=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'FILES'};
Line 1358  END Line 1427  END
  $source="<FONT COLOR=#FF0000>$source</FONT>";   $source="<FONT COLOR=#FF0000>$source</FONT>";
     }      }
  }   }
    my $checksum;
    my $checksum_source;
    my $checksum_target;
  if ($mode eq 'status') {   if ($mode eq 'status') {
     $filestatus='';      $filestatus='';
     my $fs;      my $fs;
Line 1380  END Line 1452  END
     }      }
     else {      else {
  $fs=`find /$filesfull[$i] -prune -printf "\%m\t\%u\t\%g" 2>/dev/null`;   $fs=`find /$filesfull[$i] -prune -printf "\%m\t\%u\t\%g" 2>/dev/null`;
    if (-f "/$filesfull[$i]" && !(-l "/$filesfull[$i]")) {
       $checksum_source=`md5sum ../../$source2 | cut -d ' ' -f1`;
       chop $checksum_source;
       $checksum_target=`md5sum /$filesfull[$i] | cut -d ' ' -f1`;
       chop $checksum_target;
   #    warn ("CS: $checksum_source, CT: $checksum_target\n");
       unless ($checksum_source eq $checksum_target) {
    $checksum="<BR><B><U>CHECKSUM DIFFERENCE</U></B>";
       }
    }
     }      }
     my $fsl=`find /$filesfull[$i] -type l -prune -printf "\%m\t\%u\t\%g" 2>/dev/null`;      my $fsl=`find /$filesfull[$i] -type l -prune -printf "\%m\t\%u\t\%g" 2>/dev/null`;
     unless ($fs || $filestatus) {      unless ($fs || $filestatus) {
Line 1403  END Line 1485  END
     $s='';      $s='';
  }   }
  if ($fs eq "$chmod$s$chown" && $fs eq "$devchmod$s$devchown") {   if ($fs eq "$chmod$s$chown" && $fs eq "$devchmod$s$devchown") {
     $filestatus='<TD BGCOLOR=#FFFFFF>runtime+development</TD>';      $filestatus="<TD BGCOLOR=#FFFFFF>runtime+development$checksum</TD>";
  }   }
  elsif ($fs eq "$chmod$s$chown") {   elsif ($fs eq "$chmod$s$chown") {
     $filestatus='<TD BGCOLOR=#FFFFFF>runtime</TD>';      $filestatus="<TD BGCOLOR=#FFFFFF>runtime$checksum</TD>";
  }   }
  elsif ($fs eq "$devchmod$s$devchown") {   elsif ($fs eq "$devchmod$s$devchown") {
     $filestatus='<TD BGCOLOR=#FFFFFF>development</TD>';      $filestatus="<TD BGCOLOR=#FFFFFF>development$checksum</TD>";
  }   }
  else {   else {
     $filestatus="<TD BGCOLOR=#FFFFFF><B><U>ERROR</U></B><BR>$fs</TD>";      $filestatus="<TD BGCOLOR=#FFFFFF><B><U>ERROR</U></B><BR>$fs</TD>";

Removed from v.1.26  
changed lines
  Added in v.1.40


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>