# # perl project cgimake.conf file for Safari # Copyright (c) 1999 by Barrie Slaymaker, rbs@telerama.com # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # # %env_override = ( P4PORT => '10.144.1.60:1666', P4CLIENT => 'barries', P4USER => 'barries', PERL5LIB => '/home/barries/src/safari/lib', SAF_CONF_DIR => "$config_dir/$project" , SAF_PROJECT => $project , ) ; sub target_fixup { $_ = '/' . $_ unless m@^/@ ; error( "No '..' allowed in target" ) if m@(^|/)\.\.(/|$)@ ; # # Publish a few things in the environment for the Makefile and # for safari-aware scripts. There are two sets of variables: # those for the actual target, and those for the target passed # with PATH_INFO. This is because links in the resulting web page # will be relative to PATH_INFO, not necessarily to the file # being built (which may have been specified with a targets= entry # in the QUERY_STRING). # my ( $path_project, $path_rev, $path_filter, $file ) = split( '/', $_, 4 ) ; $ENV{SAF_PATH_PROJECT} = $project ; $ENV{SAF_PATH_REV} = $path_rev ; $ENV{SAF_PATH_FILTER} = $path_filter ; $ENV{SAF_PATH_FILE} = $path_file ; my ( undef, $rev, $filter, $file ) = split( '/', $_, 4 ) ; $filter = $cgi->param( 'filter' ) if defined $cgi->param( 'filter' ) ; $rev = $cgi->param( 'rev' ) if defined $cgi->param( 'rev' ) ; $file = $cgi->param( 'file' ) if defined $cgi->param( 'file' ) ; $_ = "/$rev" ; $_ .= "/$filter" if defined( $filter ) ; $_ .= "/$file" if defined ( $file ) ; $ENV{SAF_REV} = $rev ; $ENV{SAF_FILTER} = $filter ; $ENV{SAF_FILE} = $file ; $ENV{SAF_TARGET} = $_ ; # # Special hack since perforce wisely chose to use '#' as the # type specifier indicating a revision number. # my $p4_rev = $rev ; $p4_rev =~ s/^_/#/ ; $ENV{SAF_P4_REV} = $p4_rev ; my $target = $_ ; # trim off trailing filename. Assumes all directory requests end in a '/' $target =~ s@[^/]+$@@ ; my @chunks = split( '/', $target ) ; my $up_to_project = '../' x ( @chunks - 1 ) ; my $up_to_rev = '../' x ( @chunks - 2 ) ; my $up_to_filter = '../' x ( @chunks - 3 ) ; $ENV{SAF_UP_TO_PROJECT} = $up_to_project ; $ENV{SAF_UP_TO_REV} = $up_to_rev ; $ENV{SAF_UP_TO_FILTER} = $up_to_filter ; return $_ ; }