Diff for /loncom/build/lpml_parse.pl between versions 1.56 and 1.58

version 1.56, 2011/01/10 21:24:36 version 1.58, 2012/01/23 03:32:43
Line 86  Usage is for lpml file to come in throug Line 86  Usage is for lpml file to come in throug
     typical choices: default,redhat6.2,debian2.2,redhat7      typical choices: default,redhat6.2,debian2.2,redhat7
 4th argument is to manually specify a sourceroot.  4th argument is to manually specify a sourceroot.
 5th argument is to manually specify a targetroot.  5th argument is to manually specify a targetroot.
   6th argument is to manually specify a shell.
   
 Only the 1st argument is mandatory for the program to run.  Only the 1st argument is mandatory for the program to run.
   
Line 100  END Line 101  END
 # ------------------------------------------------- Grab command line arguments  # ------------------------------------------------- Grab command line arguments
   
 my $mode='';  my $mode='';
 if (@ARGV==5) {  if (@ARGV == 6 || @ARGV == 5) {
     $mode = shift @ARGV;      $mode = shift @ARGV;
 }  }
 else {  else {
Line 135  $targetroot=~s/\/$//; # remove trailing Line 136  $targetroot=~s/\/$//; # remove trailing
 $sourcerootarg=$sourceroot;  $sourcerootarg=$sourceroot;
 $targetrootarg=$targetroot;  $targetrootarg=$targetroot;
   
   my $shell = 'sh';
   if (@ARGV) {
       $shell = shift @ARGV;
   }
   
 my $logcmd='| tee -a WARNINGS';  my $logcmd='| tee -a WARNINGS';
   
 my $invocation; # Record how the program was invoked  my $invocation; # Record how the program was invoked
Line 147  if ($mode eq 'install' or $mode eq 'conf Line 153  if ($mode eq 'install' or $mode eq 'conf
 #             3rd argument (distribution) is: $dist  #             3rd argument (distribution) is: $dist
 #             4th argument (sourceroot) is: described below  #             4th argument (sourceroot) is: described below
 #             5th argument (targetroot) is: described below  #             5th argument (targetroot) is: described below
   #             6th argument (shell) is: $shell
 END  END
 }  }
   
Line 1151  sub format_files { Line 1158  sub format_files {
     $tword=''; $tword=' alwaysrun' if $trigger eq 'always run';       $tword=''; $tword=' alwaysrun' if $trigger eq 'always run'; 
     if ($command!~/\s/) {      if ($command!~/\s/) {
  $command=~s/\/([^\/]*)$//;   $command=~s/\/([^\/]*)$//;
  $command2="cd $command; sh ./$1;\\";   $command2="cd $command; $shell ./$1;\\";
     }      }
     else {      else {
  $command=~s/(.*?\/)([^\/]+\s+.*)$/$1/;   $command=~s/(.*?\/)([^\/]+\s+.*)$/$1/;
  $command2="cd $command; sh ./$2;\\";   $command2="cd $command; $shell ./$2;\\";
     }      }
     my $depstring;      my $depstring;
     my $depstring2="\t\t\@echo '';\\\n";      my $depstring2="\t\t\@echo '';\\\n";
Line 1274  sub format_file { Line 1281  sub format_file {
  my ($source2,$command,$trigger,@deps)=split(/\;/,$bi);   my ($source2,$command,$trigger,@deps)=split(/\;/,$bi);
  $tword=''; $tword=' alwaysrun' if $trigger eq 'always run';    $tword=''; $tword=' alwaysrun' if $trigger eq 'always run'; 
  $command=~s/\/([^\/]*)$//;   $command=~s/\/([^\/]*)$//;
  $command2="cd $command; sh ./$1;\\";   $command2="cd $command; $shell ./$1;\\";
  my $depstring;   my $depstring;
  foreach my $dep (@deps) {   foreach my $dep (@deps) {
     $depstring.=<<END;      $depstring.=<<END;
Line 1303  END Line 1310  END
  my $dir = $sourceroot.'/'.$source;   my $dir = $sourceroot.'/'.$source;
  $dir =~ s|/([^/]*)$||;   $dir =~ s|/([^/]*)$||;
  my $result ="    my $result =" 
 $buildtest cd $dir ; sh $installscript";  $buildtest cd $dir ; $shell $installscript";
  if ($categoryname    if ($categoryname 
     && exists($categoryhash{"chmod.$categoryname"}) ) {      && exists($categoryhash{"chmod.$categoryname"}) ) {
     $result .="\\\n";      $result .="\\\n";
Line 1318  END Line 1325  END
     }      }
             my $bflag='-b1';              my $bflag='-b1';
             $bflag='-b3' if $dependencies or $buildlink;              $bflag='-b3' if $dependencies or $buildlink;
     return <<END;      if ($tokeninfo[2]{type} eq 'private') {
    return <<END;
   $buildtest \@if (test -e "${sourceroot}/${source}") && (test -e "${targetroot}/${target}"); then \\
    ECODE=0; \\
    perl filecompare.pl $bflag ${sourceroot}/${source} ${targetroot}/${target} || ECODE=\$\$?; \\
    case "\$\$ECODE" in \\
    1) echo "${targetroot}/${target} is unchanged";; \\
    2) echo "**** WARNING **** target file ${targetroot}/${target} is newer than CVS source; saving current (old) target file to ${targetroot}/${target}.lpmlsave and then overwriting"$logcmd && install -o www -g www -m 0600 ${targetroot}/${target} ${targetroot}/${target}.lpmlsave && install $categoryhash{$categoryname} ${sourceroot}/${source} ${targetroot}/${target};; \\
    0) echo "install $categoryhash{$categoryname} ${sourceroot}/${source} ${targetroot}/${target}" && install $categoryhash{$categoryname} ${sourceroot}/${source} ${targetroot}/${target};; \\
                   esac; \\
    elif (test -e "${sourceroot}/${source}") && !(test -e "${targetroot}/${target}"); then\\
    echo "install $categoryhash{$categoryname} ${sourceroot}/${source} ${targetroot}/${target}" && install $categoryhash{$categoryname} ${sourceroot}/${source} ${targetroot}/${target}; \\
    fi
    \@if (test -e "${targetroot}/${target}"); then \\
    perl verifymodown.pl ${targetroot}/${target} "$categoryhash{$categoryname}"$logcmd; \\
    fi
   END
               } else {
           return <<END;
 $buildtest \@if !(test -e "${sourceroot}/${source}") && !(test -e "${targetroot}/${target}"); then \\  $buildtest \@if !(test -e "${sourceroot}/${source}") && !(test -e "${targetroot}/${target}"); then \\
  echo "**** ERROR **** CVS source file does not exist: ${sourceroot}/${source} and neither does target: ${targetroot}/${target}"$logcmd; \\   echo "**** ERROR **** CVS source file does not exist: ${sourceroot}/${source} and neither does target: ${targetroot}/${target}"$logcmd; \\
  elif !(test -e "${sourceroot}/${source}"); then \\   elif !(test -e "${sourceroot}/${source}"); then \\
Line 1335  $buildtest \@if !(test -e "${sourceroot} Line 1360  $buildtest \@if !(test -e "${sourceroot}
  perl verifymodown.pl ${targetroot}/${target} "$categoryhash{$categoryname}"$logcmd; \\   perl verifymodown.pl ${targetroot}/${target} "$categoryhash{$categoryname}"$logcmd; \\
  fi   fi
 END  END
               }
  }   }
  elsif ($mode eq 'configinstall' && (($categoryname eq 'conf') ||   elsif ($mode eq 'configinstall' && (($categoryname eq 'conf') ||
     ($categoryname eq 'www conf'))) {      ($categoryname eq 'www conf'))) {

Removed from v.1.56  
changed lines
  Added in v.1.58


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