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

version 1.52, 2003/09/11 22:01:48 version 1.56, 2011/01/10 21:24:36
Line 313  my $targets; Line 313  my $targets;
 my $target;  my $target;
 my $source;  my $source;
 my $note;  my $note;
   my $installscript;
 my $build;  my $build;
 my $buildlink;  my $buildlink;
 my $commands;  my $commands;
Line 384  $parser->{textify}={ Line 385  $parser->{textify}={
     target => \&format_target,      target => \&format_target,
     note => \&format_note,      note => \&format_note,
     build => \&format_build,      build => \&format_build,
       installscript => \&format_installscript,
     status => \&format_status,      status => \&format_status,
     dependencies => \&format_dependencies,      dependencies => \&format_dependencies,
     privatedependencies => \&format_privatedependencies,      privatedependencies => \&format_privatedependencies,
Line 529  END Line 531  END
  print ' by Scott Harrison 2001'."\n";   print ' by Scott Harrison 2001'."\n";
  print '# This file was automatically generated on '.`date`;   print '# This file was automatically generated on '.`date`;
  print "\n".$invocation;   print "\n".$invocation;
  $lpml .= "SHELL=\"/bin/bash\"\n\n";   $lpml .= "\n";
     }      }
     elsif ($mode eq 'configinstall') {      elsif ($mode eq 'configinstall') {
  print '# LPML configuration file targets (configinstall).'."\n";   print '# LPML configuration file targets (configinstall).'."\n";
Line 537  END Line 539  END
  print ' by Scott Harrison 2001'."\n";   print ' by Scott Harrison 2001'."\n";
  print '# This file was automatically generated on '.`date`;   print '# This file was automatically generated on '.`date`;
  print "\n".$invocation;   print "\n".$invocation;
  $lpml .= "SHELL=\"/bin/bash\"\n\n";   $lpml .= "\n";
     }      }
     elsif ($mode eq 'build') {      elsif ($mode eq 'build') {
  $lpml = "# LPML build targets. Linux Packaging Markup Language,";   $lpml = "# LPML build targets. Linux Packaging Markup Language,";
  $lpml .= ' by Scott Harrison 2001'."\n";   $lpml .= ' by Scott Harrison 2001'."\n";
  $lpml .= '# This file was automatically generated on '.`date`;   $lpml .= '# This file was automatically generated on '.`date`;
  $lpml .= "\n".$invocation;   $lpml .= "\n".$invocation;
  $lpml .= "SHELL=\"/bin/sh\"\n\n";   $lpml .= "\n";
     }      }
     else {      else {
  return '';   return '';
Line 643  sub format_category { Line 645  sub format_category {
     my ($user,$group)=split(/\:/,$chown);      my ($user,$group)=split(/\:/,$chown);
     $categoryhash{$category_att_name}='-o '.$user.' -g '.$group.      $categoryhash{$category_att_name}='-o '.$user.' -g '.$group.
  ' -m '.$chmod;   ' -m '.$chmod;
       $categoryhash{"chmod.".$category_att_name}=$chmod;
       $categoryhash{"chown.".$category_att_name}=$chown;
  }   }
  return '';   return '';
     }      }
Line 1218  sub format_links { Line 1222  sub format_links {
 sub format_file {  sub format_file {
     my @tokeninfo=@_;      my @tokeninfo=@_;
     $file=''; $source=''; $target=''; $categoryname=''; $description='';      $file=''; $source=''; $target=''; $categoryname=''; $description='';
     $note=''; $build=''; $status=''; $dependencies='';      $note=''; $build=''; $status=''; $dependencies=''; $installscript='';
     my $text=&trim($parser->get_text('/file'));      my $text=&trim($parser->get_text('/file'));
     my $buildtest;      my $buildtest;
     $file_count++;      $file_count++;
Line 1262  sub format_file { Line 1266  sub format_file {
 # "$build $status $dependencies" .  # "$build $status $dependencies" .
 # "\nEND FILE");  # "\nEND FILE");
  }   }
  elsif ($mode eq 'install' && $categoryname ne 'conf') {   elsif (($mode eq 'install') && (($categoryname ne 'conf') && 
    ($categoryname ne 'www conf'))) {
     if ($build) {      if ($build) {
  my $bi=$sourceroot.'/'.$source.';'.$build.';'.   my $bi=$sourceroot.'/'.$source.';'.$build.';'.
     $dependencies;      $dependencies;
Line 1293  END Line 1298  END
                 $buildtest.=<<END;                  $buildtest.=<<END;
  fi   fi
 END  END
               }
       if ($installscript) {
    my $dir = $sourceroot.'/'.$source;
    $dir =~ s|/([^/]*)$||;
    my $result =" 
   $buildtest cd $dir ; sh $installscript";
    if ($categoryname 
       && exists($categoryhash{"chmod.$categoryname"}) ) {
       $result .="\\\n";
       $result .=<<"END"
    chmod -R $categoryhash{"chmod.$categoryname"} ${targetroot}/${target} \\
    chown -R $categoryhash{"chown.$categoryname"} ${targetroot}/${target} 
   END
                   } else {
       $result.="\n";
    }
    return $result;
     }      }
             my $bflag='-b1';              my $bflag='-b1';
             $bflag='-b3' if $dependencies or $buildlink;              $bflag='-b3' if $dependencies or $buildlink;
Line 1314  $buildtest \@if !(test -e "${sourceroot} Line 1336  $buildtest \@if !(test -e "${sourceroot}
  fi   fi
 END  END
  }   }
  elsif ($mode eq 'configinstall' && $categoryname eq 'conf') {   elsif ($mode eq 'configinstall' && (($categoryname eq 'conf') ||
       ($categoryname eq 'www conf'))) {
     push @configall,$targetroot.'/'.$target;      push @configall,$targetroot.'/'.$target;
     return $targetroot.'/'.$target.': alwaysrun'."\n".      return $targetroot.'/'.$target.': alwaysrun'."\n".
  "\t".'@# Compare source with target and intelligently respond'.   "\t".'@# Compare source with target and intelligently respond'.
Line 1597  sub format_build { Line 1620  sub format_build {
     }      }
     return '';      return '';
 }  }
   # ------------------------------------------------ Format installscript section
   sub format_installscript {
       my @tokeninfo=@_;
       $installscript= &trim($parser->get_text('/installscript'));
       if ($installscript) {
    $parser->get_tag('/installscript');
    $installscript=~s/([^\\])\\\s+/$1/g; # allow for lines split onto new lines
       }
       return '';
   }
 # -------------------------------------------------------- Format build section  # -------------------------------------------------------- Format build section
 sub format_buildlink {  sub format_buildlink {
     my @tokeninfo=@_;      my @tokeninfo=@_;

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


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