consolidate attach and build

This commit is contained in:
David Rose 2004-06-04 05:00:51 +00:00
parent b54cb887e9
commit a3a8f29253
11 changed files with 1 additions and 626 deletions

View File

@ -14,7 +14,7 @@
#define INSTALL_HEADERS \
ctattch.pl ctattch.pl.rnd ctunattach.pl ctquery.pl ctdelta.pl \
ctdelta.pl.rnd unco.pl ctvspec.pl ctcm.pl ctccase.pl ctntool.pl \
ctcvs.pl
ctcvs.pl ctproj.pl ctutils.pl
#define INSTALL_SCRIPTS \
ctattach.drv ctunattach.drv ctquery ctdelta ctihave ctallihave \

View File

@ -1,22 +0,0 @@
// This directory defines the ctattach tools, which are completely
// undocumented and are only intended for use by the VR Studio as a
// convenient way to manage development by multiple people within the
// various Panda source trees. These tools are not recommended for
// use by the rest of the world; it's probably not worth the headache
// of learning how to set them up.
// Therefore, we only install the stuff in this directory if the
// builder is already using the ctattach tools. Otherwise, it's safe
// to assume s/he doesn't need the ctattach tools.
#define BUILD_DIRECTORY $[CTPROJS]
#if $[CTPROJS]
#define INSTALL_HEADERS \
ctinstmake.pl ctproj.pl ctutils.pl
#define INSTALL_SCRIPTS \
ctaddpkg ctaddtgt ctinitproj ctproj ctpathadjust
#define EXTRA_DIST \
initialize
#endif

View File

@ -1,92 +0,0 @@
#!/usr/local/bin/perl
if ($#ARGV != 0) {
exit print "Usage: ctaddpkg package-name\n" ;
}
$pkgname = $ARGV[0] ;
$tool = $ENV{"DTOOL"} ;
if ( $tool eq "" ) {
die "Environment not configured for CTtools" ;
}
#pull in tools for getting information on the project
require "$tool/include/ctproj.pl" ;
require "$tool/include/ctvspec.pl" ;
require "$tool/include/ctquery.pl" ;
#get what project we're currently in, and where it's root is.
$proj = &CTProj ;
$projroot = &CTProjRoot($proj) ;
$projname = $proj ;
$projname =~ tr/A-Z/a-z/ ;
$flav = &CTQueryProj( $projname ) ;
$spec = &CTResolveSpec( $projname, $flav ) ;
#see if such a package already exists, if so STOP
if ( -e "$projroot/src/all/$pkgname" ) {
die "Package '$pkgname' already exists in this project ('$proj')" ;
}
#make sure there is a project-wide makefile
if ( ! -e "$projroot/Makefile" ) {
die "No project-wide Makefile for project '$proj'" ;
}
#make sure there is a package Makefile template
if ( ! -e "$tool/lib/Makefile.meta.template" ) {
die "No package Makefile template in $tool/lib/." ;
}
#make sure there is a package install Makefile template
if ( ! -e "$tool/lib/Makefile.install.template" ) {
die "No package install Makefile template in $tool/lib/." ;
}
#make the package directory
require "$tool/include/ctcm.pl" ;
$item = "$projroot/src/all/$pkgname" ;
if ( ! -e $item ) {
if ( ! &CTCMMkdir( $item, $projname, $spec ) ) {
die "Could not create directory '" . $item . "'\n" ;
}
}
#pull in tools for installing Makefiles
require "$tool/include/ctinstmake.pl" ;
#install a package makefile and package install makefile into the package
$item = "$projroot/src/all/$pkgname/Makefile" ;
&CTInstallMake( "$tool/lib/Makefile.meta.template", $item ) ;
if ( ! &CTCMMkelem( $item, $projname, $spec ) ) {
die "Could not make a verioned element of the project makefile\n" ;
}
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta '" . $item . "'\n" ;
}
$item = "$projroot/src/all/$pkgname/Makefile.install" ;
&CTInstallMake( "$tool/lib/Makefile.install.template", $item ) ;
if ( ! &CTCMMkelem( $item, $projname, $spec ) ) {
die "Could not make a verioned element of the project install makefile\n" ;
}
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta '" . $item . "'\n" ;
}
# delta the package in
$item = "$projroot/src/all/$pkgname" ;
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta '" . $item . "'\n" ;
}
# update the master makefile
$item = "$projroot/Makefile" ;
if ( ! &CTCMCheckout( $item, $projname, $spec ) ) {
die "Could not checkout master project makefile\n" ;
}
&CTInstallScanMake( $item ) ;
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta master project makefile\n" ;
}

View File

@ -1,91 +0,0 @@
#!/usr/local/bin/perl
$tool = $ENV{"DTOOL"} ;
if ( $tool eq "" ) {
die "Environment not configured to run CTtools" ;
}
if ($#ARGV == -1) {
exit print "Usage: ctaddtgt [{bin,a,so,ss,foreign}] target-name ...\n" ;
}
require "$tool/include/ctproj.pl" ;
require "$tool/include/ctvspec.pl" ;
require "$tool/include/ctquery.pl" ;
@arglist = @ARGV ;
$projname = &CTProj ;
$projname =~ tr/A-Z/a-z/ ;
$projroot = &CTProjRoot( $projname ) ;
$pkgname = &CTProjPkg( $projname ) ;
$flav = &CTQueryProj( $projname ) ;
$spec = &CTResolveSpec( $projname, $flav ) ;
# check for package makefile and package install makefile
while ( @arglist != () ) {
# initialize target type to default
$type = "bin" ;
# potentially get the target type
if ( $arglist[0] eq "bin" ) {
shift( @arglist ) ; # already set
} elsif (( $arglist[0] eq "foreign" ) || ( $arglist[0] eq "a" ) ||
( $arglist[0] eq "so" ) || ( $arglist[0] eq "ss" )) {
$type = $arglist[0] ;
shift( @arglist ) ;
}
# get the target name
$tgtname = $arglist[0] ;
$fulltgtname = $tgtname ;
shift( @arglist ) ;
require "$tool/include/ctinstmake.pl" ;
require "$tool/include/ctcm.pl" ;
$item = "$projroot/src/$pkgname" ;
if ( ! &CTCMCheckout( $item, $projname, $spec )) {
die "Could not checkout package '" . $pkgname . "'\n" ;
}
$item = "$projroot/src/$pkgname/Makefile" ;
if ( ! &CTCMCheckout( $item, $projname, $spec )) {
die "Could not checkout package '" . $pkgname . "' Makefile\n" ;
}
$curdir = "$projroot/src/$pkgname" ;
# install target makefile, and update package makefile
if ( $type eq "bin" ) {
&CTInstallMake( "$tool/lib/Makefile.bin.template",
"$curdir/Makefile.$tgtname" ) ;
&CTInstallScanMake( "$curdir/Makefile" ) ;
} elsif ( $type eq "a" ) {
$fulltgtname = "lib" . $tgtname ;
&CTInstallMake( "$tool/lib/Makefile.a.template",
"$curdir/Makefile.$tgtname" ) ;
&CTInstallScanMake( "$curdir/Makefile" ) ;
} elsif ( $type eq "so" ) {
$fulltgtname = "lib" . $tgtname ;
&CTInstallMake( "$tool/lib/Makefile.so.template",
"$curdir/Makefile.$tgtname" ) ;
&CTInstallScanMake( "$curdir/Makefile" ) ;
} elsif ( $type eq "ss" ) {
&CTInstallMake( "$tool/lib/Makefile.ss.template",
"$curdir/Makefile.$tgtname" ) ;
&CTInstallScanMake( "$curdir/Makefile" ) ;
} elsif ( $type eq "foreign" ) {
&CTInstallMake( "$tool/lib/Makefile.foreign.template",
"$curdir/Makefile.$tgtname" ) ;
&CTInstallScanMake( "$curdir/Makefile" ) ;
}
$item = "$curdir/Makefile.$tgtname" ;
if ( ! &CTCMMkelem( $item, $projname, $spec ) ) {
die "Could not make a verioned element of the target makefile\n" ;
}
}
print "You will want to edit Makefile, Makefile.install, and the target makefile(s)\n" ;
print "manually. Also, do not forget to delta the Makefile, target Makefile, and\n" ;
print "directory when you are done.\n" ;

View File

@ -1,128 +0,0 @@
#!/usr/local/bin/perl
if ( $#ARGV != 1 ) {
print "Usage: ctinitproj project-name project-root\n" ;
print " You should already be attached to the project\n" ;
exit print " ex: ctinitproj dtool $DTOOL\n" ;
}
$tool = $ENV{"DTOOL"} ;
if ( $tool eq "" ) {
die "Environment not configured for CTtools" ;
}
require "$tool/include/ctutils.pl" ;
require "$tool/include/ctvspec.pl" ;
require "$tool/include/ctquery.pl" ;
$projname = $ARGV[0] ;
$projroot = &CTUShellEval( $ARGV[1] );
$flav = &CTQueryProj( $projname ) ;
$spec = &CTResolveSpec( $projname, $flav ) ;
# make sure the directory exists
if ( ! -e $projroot ) {
die "Project root ('$projroot') does not exist" ;
}
require "$tool/include/ctcm.pl" ;
# make all the default subdirectories
$item = "$projroot/bin" ;
if ( ! -e $item ) {
if ( ! &CTCMMkdir( $item, $projname, $spec ) ) {
die "Could not create directory '" . $item . "'\n" ;
}
}
$item = "$projroot/etc" ;
if ( ! -e $item ) {
if ( ! &CTCMMkdir( $item, $projname, $spec ) ) {
die "Could not create directory '" . $item . "'\n" ;
}
}
$item = "$projroot/include" ;
if ( ! -e $item ) {
if ( ! &CTCMMkdir( $item, $projname, $spec ) ) {
die "Could not create directory '" . $item . "'\n" ;
}
}
$item = "$projroot/lib" ;
if ( ! -e $item ) {
if ( ! &CTCMMkdir( $item, $projname, $spec ) ) {
die "Could not create directory '" . $item . "'\n" ;
}
}
$item = "$projroot/lib/ss" ;
if ( ! -e $item ) {
if ( ! &CTCMMkdir( $item, $projname, $spec ) ) {
die "Could not create directory '" . $item . "'\n" ;
}
}
$item = "$projroot/lib/stk" ;
if ( ! -e $item ) {
if ( ! &CTCMMkdir( $item, $projname, $spec ) ) {
die "Could not create directory '" . $item . "'\n" ;
}
}
$item = "$projroot/src" ;
if ( ! -e "$projroot/src" ) {
if ( ! &CTCMMkdir( $item, $projname, $spec ) ) {
die "Could not create directory '" . $item . "'\n" ;
}
}
$item = "$projroot/src/all" ;
if ( ! -e "$projroot/src/all" ) {
if ( ! &CTCMMkdir( $item, $projname, $spec ) ) {
die "Could not create directory '" . $item . "'\n" ;
}
}
# install the project-wide Makefile
require "$tool/include/ctinstmake.pl" ;
$item = "$projroot/Makefile" ;
&CTInstallMake( "$tool/lib/Makefile.project.template", $item ) ;
if ( ! &CTCMMkelem( $item, $projname, $spec ) ) {
die "Could not make a versioned element of the master makefile\n" ;
}
# now delta everything in
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta '" . $item . "'\n" ;
}
$item = "$projroot/src/all" ;
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta '" . $item . "'\n" ;
}
$item = "$projroot/src" ;
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta '" . $item . "'\n" ;
}
$item = "$projroot/lib/stk" ;
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta '" . $item . "'\n" ;
}
$item = "$projroot/lib/ss" ;
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta '" . $item . "'\n" ;
}
$item = "$projroot/lib" ;
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta '" . $item . "'\n" ;
}
$item = "$projroot/include" ;
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta '" . $item . "'\n" ;
}
$item = "$projroot/etc" ;
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta '" . $item . "'\n" ;
}
$item = "$projroot/bin" ;
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta '" . $item . "'\n" ;
}
$item = "$projroot" ;
if ( ! &CTCMDelta( $item, $projname, $spec ) ) {
die "Could not delta '" . $item . "'\n" ;
}

View File

@ -1,54 +0,0 @@
# copy the template makefile to output, recursively expanding marked inclusions
sub CTInstallMakeWrite {
local( *INMAKE ) ;
open( INMAKE, "<$_[0]" ) ;
while ( <INMAKE> ) {
if ( /^#CTINCLUDE/ ) {
s/\n$// ;
local( @CTIMWlist ) ;
@CTIMWlist = split ;
local( $tool ) = $ENV{ "DTOOL" } ;
require "$tool/include/ctutils.pl" ;
local( $CTIMWtmp ) = &CTUShellEval( $CTIMWlist[1] ) ;
&CTInstallMakeWrite( $CTIMWtmp ) ;
} elsif (( /^#CTPROJECT/ ) && ( $projname ne "" )){
local( $CTIMWtmp ) = $projname ;
$CTIMWtmp =~ tr/A-Z/a-z/ ; # tolower
print OUTMAKE "CTPROJECT = $CTIMWtmp\n" ;
} elsif (( /^#CTPROJROOT/ ) && ( $projname ne "" )) {
local( $CTIMWtmp ) = $projname ;
$CTIMWtmp =~ tr/a-z/A-Z/ ; # toupper
print OUTMAKE "CTPROJROOT = \$($CTIMWtmp)\n" ;
} elsif (( /^#CTPACKAGE/ ) && ( $pkgname ne "" )) {
print OUTMAKE "PACKAGE = $pkgname\n" ;
} elsif (( /^#CTINSTPKG/ ) && ( $pkgname ne "" )) {
print OUTMAKE "include src/all/$pkgname/Makefile.install\n" ;
print OUTMAKE "#CTINSTPKG\n" ;
} elsif (( /^#CTTARGET/ ) && ( $fulltgtname ne "" )) {
print OUTMAKE "TARGET = $fulltgtname\n" ;
} elsif (( /^SUBMAKES/ ) && ( $tgtname ne "" )) {
s/\n$// ;
print OUTMAKE "$_ $tgtname\n" ;
} else {
print OUTMAKE $_ ;
}
}
close( INMAKE ) ;
}
# install a given makefile template, expanding any internal directives
sub CTInstallMake {
local( *OUTMAKE ) ;
open( OUTMAKE, ">$_[1]" ) ;
&CTInstallMakeWrite( $_[0] ) ;
close( OUTMAKE );
}
# Scan the given makefile for CT markers to be expanded
sub CTInstallScanMake {
local( $CTISMname ) = "/tmp/make.$$" ;
&CTInstallMake( $_[0], $CTISMname ) ;
system( "mv $CTISMname $_[0]" ) ;
}
1;

View File

@ -1,74 +0,0 @@
#!/usr/local/bin/perl
# find the longest common directory prefix of the 2 input paths
# input is:
# $_[0] = path 1
# $_[1] = path 2
#
# output is:
# relative path
sub CTCommonPrefix {
local( @path1 ) ;
local( @path2 ) ;
local( $count ) = 0 ;
local( $thresh ) ;
local( $tmp ) = $_[0] ;
$tmp =~ s/^\/// ;
@path1 = split ( /\//, $tmp ) ;
$tmp = $_[1] ;
$tmp =~ s/^\/// ;
@path2 = split ( /\//, $tmp ) ;
if ( $path1[0] eq "view" ) {
$thresh = 1 ;
} else {
$thresh = 0 ;
}
while (( $path1[0] eq $path2[0] ) &&
( $#path1 >= 0 ) &&
( $#path2 > 0 )) {
shift @path1;
shift @path2;
$count++ ;
}
local( $ret ) ;
if ( $count > $thresh ) {
while ( $#path1 >= 0 ) {
$ret = $ret . "../" ;
shift @path1 ;
}
while ( $#path2 >= 0 ) {
$ret = $ret . $path2[0] . "/" ;
shift @path2 ;
}
$ret =~ s/\/$// ;
} else {
$ret = $_[1] ;
}
$ret ;
}
# $pwd = $ENV{"PWD"} ;
# sometimes the PWD environment variable lies, and getcwd by itself doesn't
# report the view extention.
use Cwd ;
$pwd = getcwd() ;
if ( $pwd =~ /^\/vobs/ ) {
open( VFILE, "/usr/atria/bin/cleartool pwv -short |" ) ;
$view = <VFILE> ;
close( VFILE ) ;
$view =~ s/\n$// ;
$pwd = "/view/" . $view . $pwd ;
}
$output = "" ;
foreach $item ( @ARGV ) {
$common = &CTCommonPrefix( $pwd, $item ) ;
if ( length( $common ) > 0 ) {
if ( $output ne "" ) {
$output = $output . " " ;
}
$output = $output . $common ;
}
}
print $output . "\n" ;

View File

@ -1,35 +0,0 @@
#!/usr/local/bin/perl
$tool = $ENV{"DTOOL"} ;
if ( $tool eq "" ) {
die "Environment not configured to run CTtools" ;
}
require "$tool/include/ctproj.pl" ;
@arglist = @ARGV ;
$prntroot = 0 ;
if ( $arglist[0] =~ /^-r/ ) {
$prntroot = 1 ;
shift( @arglist ) ;
} elsif ( $arglist[0] =~ /^-p/ ) {
$prntpkg = 1 ;
shift( @arglist ) ;
}
if ( @arglist == () ) {
$proj = &CTProj ;
} else {
$proj = &CTProj( $arglist[0] ) ;
}
if ( $prntroot ) {
print &CTProjRoot( $proj ) ;
} elsif ( $prntpkg ) {
print &CTProjPkg( $proj ) ;
} else {
print $proj ;
}
print "\n" ;

View File

@ -1,60 +0,0 @@
require "$tool/include/ctutils.pl" ;
# return the root of the given project.
sub CTProjRoot {
local( $CTPRtmp ) = $_[0] ;
$CTPRtmp =~ tr/a-z/A-Z/ ;
local( $CTPRret ) = $ENV{ $CTPRtmp } ;
$CTPRret ;
}
# return the package we're currently in.
# input:
# $_[0] = project
sub CTProjPkg {
local( $CTPPret ) = &CTUCurrDir() ;
local( $CTPPtmp ) = $_[0] ;
$CTPPtmp =~ tr/a-z/A-Z/ ;
$CTPPret =~ s/$ENV{ $CTPPtmp }// ;
$CTPPret =~ s/\/src\/// ;
$CTPPret =~ s/\/metalibs\/// ;
$CTPPret ;
}
# reutrn the project containing the given directory. If no directory is given,
# return the project containing the current directory.
sub CTProj {
local( $CTPdir ) ;
if ($_[0] eq "") {
$CTPdir = &CTUCurrDir() ;
} else {
# provided directory
$CTPdir = $_[0] ;
}
local( $CTPprojs ) = $ENV{"CTPROJS"} ;
local( $CTPdone ) = "" ;
local( @CTPlist ) ;
@CTPlist = split( / /, $CTPprojs ) ;
local( @CTPlist2 ) ;
local( $CTPtry ) ;
while (( $CTPdone eq "" ) && ( @CTPlist != () )){
# pop the first one off the list
$CTPtmp = $CTPlist[0] ;
shift( @CTPlist ) ;
# split the project from it's flavor
@CTPlist2 = split( /:/, $CTPtmp );
$CTPtry = &CTProjRoot( $CTPlist2[0] ) ;
# is CTPtry prefix of CTPdir? if so we have our winner
if ( $CTPdir =~ /^$CTPtry/ ) {
$CTPdone = "yep" ;
}
}
if ( $CTPdone eq "" ) {
$CTPtry = "" ;
} else {
$CTPtry = $CTPlist2[0] ;
}
$CTPtry ;
}
1;

View File

@ -1,47 +0,0 @@
# evaluate the given parameter to expand shell variables
sub CTUShellEval {
local( *CTUSEFILE ) ;
open( CTUSEFILE, "echo $_[0] |" ) ;
local( $CTUSEret ) = <CTUSEFILE> ;
close( CTUSEFILE ) ;
$CTUSEret =~ s/\n$// ;
$CTUSEret ;
}
# if debug is on, print the argument
sub CTUDebug {
if ( $ctdebug ) {
print STDERR $_[0] ;
}
}
use Cwd ;
# get current directory
sub CTUCurrDir {
local( $pwd ) = getcwd() ;
if ( $pwd =~ /^\/vobs/ ) {
local( *VFILE ) ;
open( VFILE, "cleartool pwv -short |" ) ;
local( $view ) = <VFILE> ;
close( VFILE ) ;
$view =~ s/\n$// ;
$pwd = "/view/" . $view . $pwd ;
}
$pwd ;
}
# turn a shell return code into a success/fail flag
sub CTURetCode {
local( $ret ) ;
if ( $_[0] == 0 ) {
$ret = 1 ;
} else {
$ret = 0 ;
}
$ret ;
}
$ctdebug = $ENV{"CTATTACH_DEBUG"} ;
$ctvspec_path = '/usr/local/etc' unless $ctvspec_path = $ENV{'CTVSPEC_PATH'};
1;

View File

@ -1,22 +0,0 @@
#! /bin/sh
if test "$1" = ""; then
echo "must give a make command as the argument."
echo "(eg: initialize /usr/atria/bin/clearmake -C gnu)"
exit 1
fi
test -d ../../include || mkdir ../../include
test -d ../../bin || mkdir ../../bin
cp Makefile.install.rules Makefile.meta.rules Makefile.install.vars Makefile.project.vars Makefile.penv.vars Makefile.o.vars ctproj.pl ../../include
cp ctproj ctpathadjust ../../bin
cd ../..
if test "$DTOOL" = ""; then
DTOOL=`pwd`
export DTOOL
fi
PATH=$DTOOL/bin:$PATH
export PATH
ppremake
$* build attach