Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,144 @@
#! /usr/local/bin/perl
eval "exec /usr/local/bin/perl -S $0 $*"
if $running_under_some_shell;
################################################################################
#
# File: ListTheTree <source tree>
# RCS: $XConsortium: ListTheTree /main/3 1995/10/30 13:43:24 rswiston $
# Author: Jim Andreas Hewlett-Packard, OSSD-CV
# Created: 1/15/92
# Modified by: Marc Ayotte Hewlett-Packard, OSSD-CV (perlizer)
# Language: N/A
# Package: N/A
# Status: CDE distributed
#
# (c) Copyright 1993, Hewlett-Packard Company, all rights reserved.
#
# Description: This file does 2 things:
# 1) List the source tree's structure.
# This structure is placed into the source tree's
# directory as :TreeListing.
# 2) Creates a listing of all of the files locked in the
# source tree and places it in :TreeListing.locks.
################################################################################
if ($ARGV[0]) {
$TREE = $ARGV[0];
#
# if not / relative get pwd path
#
if ($TREE !~ m%^\/%) {
print STDERR " Must be a / related path e.g -> /foo. Sorry!\n";
exit 1;
}
}
else {
die " USAGE ListTheTree <source directory>\n";
}
# put /usr/local/bin in the path for Rcslocks
$ENV{'PATH'} = "/x/cdesrc/admin/bin:/usr/local/bin:$ENV{'PATH'}";
if (! chdir("$TREE")) {
die " ERROR -> Couldn't change directory to $TREE.\n";
}
######################
# get the tree listing
######################
system ("find . -print > :TreeListing.new");
unlink(":TreeListing");
if (! rename(":TreeListing.new",":TreeListing")) {
print " WARNING -> couldn't mv :TreeListing.new to :TreeListing.\n";
}
###################################
# find the locked files in the tree
###################################
unlink(":TreeListing.locks.new");
open(NLOCK,">>$TREE/:TreeListing.locks.new");
print NLOCK "List of locked files in $TREE\n\n";
@dirs=(`find . -type d -print`);
foreach $dir (@dirs) {
undef(@rcsLocks);
chop($dir);
if (chdir("$dir")) {
@rcsLocks = (`Rcslocks -v`);
# only list directory if there are locks
if (@rcsLocks) {
print NLOCK "$dir\n";
while (@rcsLocks) {
$lock = shift(@rcsLocks);
print NLOCK " $lock";
}
print NLOCK "\n";
}
}
else {
print " WARNING -> could not cd to ${TREE}/${dir}\n";
print " $!\n";
}
chdir("$TREE");
}
unlink("$TREE/:TreeListing.locks");
rename("$TREE/:TreeListing.locks.new","$TREE/:TreeListing.locks");
#
# get changes from last listing
# check file $TREE/changestamp
#
$cstamp = "${TREE}/changestamp";
if ( -f "${TREE}/changestamp" ) {
$laststamp = `cat $cstamp`;
chop $laststamp;
}
else {
$date = `date +%y%m%d`;
chop $date;
$laststamp = "${date}0001";
$dip = `echo "$laststamp" >$cstamp`;
$date = `date +%m%d0001`;
chop $date;
system "touch $date $cstamp";
}
$curstamp = `date +%y%m%d%H%M`;
chop $curstamp;
unlink("$TREE/:TreeListing.changes.new");
open(NCHANGE,">>$TREE/:TreeListing.changes.new");
print NCHANGE "List of changed files in $TREE\n\n";
@allfiles=(`find . -follow -name "*,v" -newer $cstamp -print`);
foreach $file (@allfiles) {
chop $file;
if (open($RCSFILE,"$file")) {
NEXTLINE:
while ($line = <$RCSFILE>) {
chop $line;
if ($line !~ m%^date%) {
next NEXTLINE;
}
else {
$lastdate = $line;
$author = $line;
$lastdate =~ s%^.* (\d+\.\d+\.\d+\.\d+\.\d+).*$%\1%;
$lastdate =~ s%\.%%g;
if ($lastdate > $laststamp) {
$author =~ s%^.*author (.*); .*;$%\1%;
print NCHANGE "$file <-> $author\n";
}
}
}
close($RCSFILE);
}
}
$dip = `echo "$curstamp" >$cstamp`;
unlink("$TREE/:TreeListing.changes");
rename("$TREE/:TreeListing.changes.new","$TREE/:TreeListing.changes");

View File

@@ -0,0 +1,54 @@
#!/bin/ksh
TMPFILE=/tmp/xxIIee$$
TMPFILE300=${TMPFILE}300
TMPFILE700=${TMPFILE}700
TMPFILEOTHER=${TMPFILE}OTHER
TMPFILEEMPTY=${TMPFILE}EMPTY
if (( $# < 1 ))
then
PWDIR=`/bin/pwd`
DATEDIR=`basename $PWDIR`
DIR=/x/logs/build/$DATEDIR
else
DIR=/x/logs/build/$1
fi
echo >$TMPFILEEMPTY
echo >>$TMPFILEEMPTY
echo >>$TMPFILEEMPTY
echo "300 Build Machines in $DIR" > $TMPFILE300
echo >> $TMPFILE300
echo "700 Build Machines in $DIR" > $TMPFILE700
echo >> $TMPFILE700
echo "Other Build Machines in $DIR" > $TMPFILEOTHER
echo >> $TMPFILEOTHER
find $DIR -name summar\* -exec grep master_build {} \; > $TMPFILE
grep 300 $TMPFILE | sort -k 6,6 >> $TMPFILE300
grep 700 $TMPFILE | sort -k 6,6 >> $TMPFILE700
grep -v 300 $TMPFILE | grep -v 700 | sort -k 6,6 >> $TMPFILEOTHER
cat $TMPFILE700 $TMPFILEEMPTY $TMPFILEOTHER $TMPFILEEMPTY $TMPFILE300
rm $TMPFILE
rm $TMPFILE300
rm $TMPFILE700
rm $TMPFILEOTHER
rm $TMPFILEEMPTY

View File

@@ -0,0 +1,121 @@
#! /usr/local/bin/perl
eval "exec /usr/local/bin/perl -S $0 $*"
if $running_under_some_shell;
################################################################################
#
# File: cleanLinks <source tree>
# RCS: $XConsortium: cleanLinks /main/3 1995/10/30 13:43:35 rswiston $
# Author: Marc Ayotte Hewlett-Packard, OSSD-CV
# Created: Sun Jul 4 17:57:13 PDT 1993
# Language: perl
# Package: N/A
# Status: CDE distributed
#
# (c) Copyright 1993, Hewlett-Packard Company, all rights reserved.
#
# Usage: cleanLinks <directory>
#
# Description: This script removes symbolic links to nowhere in
# <directory>. It does not remove anything with RCS
# in its path.
#
################################################################################
if ($ARGV[0]) {
$TREE = $ARGV[0];
}
else {
die " USAGE CleanLinks <source directory>\n";
}
if (! chdir("$TREE")) {
die " ERROR -> Couldn't change directory to $TREE.\n";
}
#######################################################
# define local subroutines
#######################################################
sub dokill {
die "\n left on INTR \n";
exit 1;
}
########################################################
# Catch signals
########################################################
$SIG{'INT'} = 'dokill';
##############################
# get the symlinks in the tree
##############################
if (! open(FIND,"find . -type d ! -type l -print|")) {
print STDERR " ERROR failure in open used for find.\n";
die "You may have to contact your build administrator\n";
}
#
# don't buffer find output
#
$| = 1;
print "************ List of symlinks to nowhere removed **********\n";
##################################################################
# go through the directories and examine each symlink.
# resolve the symlink and, if the file at the end doesn't exist,
# remove the original symlink. Don't do anything that ends in RCS.
##################################################################
FILE:
while ($new = <FIND>) {
chop $new;
if (! opendir(THISDIR,"$new")) {
print STDERR " WARNING -> could not process directory $new\n";
next FILE;
}
else {
if (! chdir("$new")) {
print STDERR " WARNING -> could not change directory to $new\n";
next FILE;
}
}
# remove . from $new path for cuteness of output
$new =~ s%^\.%%;
@allfiles = grep(!/^\.\.?$/, readdir(THISDIR));
foreach $file (@allfiles) {
if (( -l $file) && ($file !~ m%RCS$%) && (! -d $file)) {
#
# resolve the link
#
$tmp1file = $file;
$counter = 0;
while (defined($tmp2file = readlink($tmp1file))) {
$tmp1file = $tmp2file;
#
# watch for cyclic symlinks
#
if ($counter++ == 10) {
last;
}
}
#
# if last piece in resolved chain is not a file
# it is a symlink to nowhere -> remove
#
if ( ! -e $tmp1file) { # remove link to nowhere
if (unlink("$file")) {
print "removing ${TREE}${new}/${file}\n";
}
else {
print STDERR " WARNING -> ${TREE}${new}/${file} -> could not remove\n";
print "$!\n";
}
}
}
}
closedir(THISDIR);
if (! chdir("$TREE")) {
die " ERROR -> Couldn't change directory to $TREE.\n";
}
}

View File

@@ -0,0 +1,28 @@
#! /bin/ksh
# This script trims the number of files in the main build log directory
# It can also be used to trim other log files
# marca 2/7/90
USAGE="cleanLogs [logdir] [number of logs left]"
# defaults
LOGSLEFT=14
LOGDIR=/x/logs/build
[ $# -gt 1 ] && LOGSLEFT=$2
[ $# -gt 0 ] && LOGDIR=$1
#clean up the log files because dere be too many
echo ""
echo "***************************************"
echo "START Trimming log files"
cd $LOGDIR
LOGS=`ls -rt`
set -- $LOGS
while [ $# -gt $LOGSLEFT ]
do
#eliminate last log file
echo "Trying to delete $1"
rm -rf $1 || echo "could not delete $1"
shift
done

View File

@@ -0,0 +1,23 @@
#! /bin/sh
# This script cleans the fnrclone, etc directories.
for DIRS in `echo "fnrclone fnrnolink fnrnoRCS"`
do
CURRENT=$HOME/$DIRS
if [ -d $CURRENT ];then
echo ""
echo "In $CURRENT"
cd $CURRENT
LOGS=`ls -rt`
set -- $LOGS
#check to see if you have at least 10 log and script files
while [ $# -gt 20 ]
do
echo $1
rm -rf $1 || echo "could not delete $1"
shift
done
fi
echo ""
done

View File

@@ -0,0 +1,29 @@
#! /bin/sh
# This script cleans a source tree of unwanted ,RCSnew* files
# created when you abort RCS.
# It also makes all the ,v files have group bin and owner bin --marca
# marca 2/7/90
USAGE="USAGE: cleansrctree <sourcedir>"
if [ $# -lt 1 ];then
echo ""
echo "$USAGE"
exit 1
fi
cd /$1
#change owner and group to bin
echo "FILES NOT OWNER BIN"
find . -name "*,v" ! -user bin -print -exec chown bin {} \;
find . -name "*,v" ! -group bin -print -exec chgrp bin {} \;
echo "FILES not 444"
find . -name "*,v" -perm 0440 -exec chmod +r {} \; -print
echo ""
echo "FILES NOT GROUP BIN"
echo ""
echo ",RCS FILES"
# eliminate , files
find . -name ",*" -print -exec rm -f {} \;

View File

@@ -0,0 +1,69 @@
################################################################################
#
# RCS: $XConsortium: cron_example /main/3 1995/10/30 13:43:46 rswiston $
# Author: Marc Ayotte, Hewlett-Packard OSSD-CV
# Created: Tue Jun 29 10:12:15 PDT 1993
# Language: N/A
# Package: N/A
# Status: CDE
#
# (c) Copyright 1993, Hewlett-Packard Company, all rights reserved.
#
# Description: This file is an example cron script which triggers
# builds and does normal tree maintenance. The various functions
# are delimited by the letters #[A-Z]).
# A) fnrclone can leave 2 files each time it executes:
# The file ${HOME}/fnrclone/log.hhmmss and script.hhmmss.
# These files can pile up and they are cleaned out by the cleanfnr
# script.
# NOTE: In the very near future this will not be the default
# operation for fnrclone and this may no longer be necessary.
# B) By default, master_build puts its log files in the
# /x/logs/build/MMDD/${buildtreename} directory. The
# cleanLogs script trims these directories.
# C) The script ListTheTree creates a listing of all of the files in
# a tree and puts the list under the name :TreeListing in the top
# of the tree.
# D) An example of building the /x/cde_hp700_90 tree on the
# machine that is doing cron.
# E) An example of building the /x/cde_hp700d_90(debug) tree on a
# remote machine using remsh.
################################################################################
#A) clean ${HOME}/fnrclone directory
4 11 * * * /x/cdesrc/admin/BuildTools/master_build/cleanfnr 1>/users/marca/xbuild/cleanfnr.log 2>&1
#B) clean excess build logs in /x/logs/build
4 19 * * * /x/cdesrc/admin/BuildTools/master_build/cleanLogs 1>/x/logs/cronlogs/cleanLogs.log 2>&1
#C) create a listing of the files in a tree and put into top of the tree.
# this also creates a listing of locked files
10 12 * * * /x/cdesrc/admin/BuildTools/master_build/ListTheTree /x/cdesrc 1>/x/logs/cronlogs/ListTheTreecdesrc.log 2>&1
#D) build the hp tree putting the log files in the default location.
# the source tree is /x/cdesrc; the build tree is /x/cde_hp700_90.
# This entry will first do an fnrclone -s /x/cdesrc /x/cde_hp700_90
# to sync up the build tree's links to the source (-clone s).
# The log and error files from the clone will go into
# /x/logs/build/mmdd/cde_hp700_90/clonelog.HHMMSS
# /x/logs/build/mmdd/cde_hp700_90/cloneerr.HHMMSS
# It uses -c to do all of the normal imake functions:
# make -i Makefile; make -i Makefiles;make -i includes;make -i
# depend and make -i.
# The log files for make -i will go in
# /x/logs/build/mmdd/cde_hp700_90/make.HHMMSS.
# The log files for all other operations will go in
# /x/logs/build/mmdd/cde_hp700_90/allmake.HHMMSS.
# The second entry uses -w to "clean the tree": remove all .o's, .a's,
# executables etc. Normally we make clean once a week on Saturday night.
# The -cl option will remove symbolic links to nowhere.
# The -m option will mail notification to someone when the build
# is complete.
############ cde_hp700_90 - LOCAL ##############
6 22 * * 0,1,2,3,4,5 /x/cdesrc/admin/BuildTools/master_build/master_build -src /x/cdesrc -build /x/cde_hp700_90 -clone s -cl -c -m buildwatch@hpcvlx 1>/x/logs/cronlogs/r5s700.log 2>&1
6 22 * * 6 /x/cdesrc/admin/BuildTools/master_build/master_build -src /x/cdesrc -build /x/cde_hp700_90 -clone s -cl -c -w -m buildwatch@hpcvlx 1>/x/logs/cronlogs/r5s700.log 2>&1
#E) build the debug tree on hpcvusj
############ cde_hp700d_90 - HPCVUSJ ##############
10 22 * * 0,1,2,3,4,5 /x/cdesrc/admin/BuildTools/master_build/remote_build hpcvusj -src /x/cdesrc -build /x/cde_hp700d_90 -clone s -cl -c -m buildwatch@hpcvlx 1>/x/logs/cronlogs/r5s700.log 2>&1
10 22 * * 6 /x/cdesrc/admin/BuildTools/master_build/remote_build hpcvusj -src /x/cdesrc -build /x/cde_hp700d_90 -clone s -cl -c -w -m buildwatch@hpcvlx 1>/x/logs/cronlogs/r5s700.log 2>&1

View File

@@ -0,0 +1,50 @@
#!/bin/sh
#
# this script make sure that all dirs in /x80src are
# owned by xbuild, and that all directories have permissions
# of 755.
#
# - jim andreas 10/91
#
# modified to be more general by Marc Ayotte 11/92
doUsage()
{
cat << eof
USAGE: fixSourceDirPerm <tree> <owner> <group>
Note: if owner != bin, files and directories owned by bin
will NOT be changed to owner.
eof
}
if [ $# -lt 3 ];then
doUsage;
exit 1
fi
cd $1 || doUsage
# Some dirs in the build trees have to be owned by bin (rcs_tools)
# if bin is not the chosen group, don't change files that are already bin
if [ "$2" != "bin" ];then
DontDoBin="! -user bin"
fi
# change ownership of non-conforming dirs
#
echo "DIRS not owned by $2"
find . -type d ! -path "*RCS*" ! -path "*/CRT*" ! -user $2 $DontDoBin -print -exec chown $2 {} \; -exec chgrp $3 {} \;
# chmod mode of non-conforming dirs
#
echo "DIRS not 755 permission by $2"
find . -type d -user $2 ! -path "*/CRT*" $DontDoBin ! -perm 755 -print -exec chmod 755 {} \;
# chown mode of non-conforming files
#
echo "FILES not owned by $2"
find . -type f ! -path "*RCS*" ! -path "*/CRT*" ! -user $2 $DontDoBin -print -exec chown $2 {} \; -exec chgrp $3 {} \;

View File

@@ -0,0 +1,89 @@
#! /usr/local/bin/perl
eval "exec /usr/local/bin/perl -S $0 $*"
if $running_under_some_shell;
################################################################################
#
# File: manageBInstallDirs <source tree>
# RCS: $XConsortium: manageBInstallDirs /main/3 1995/10/30 13:43:53 rswiston $
# Author: Marc Ayotte Hewlett-Packard, OSSD-CV
# Created: Thu Dec 30 14:02:31 PST 1993
# Language: perl
# Package: N/A
# Status: CDE distributed
#
# (c) Copyright 1993, Hewlett-Packard Company, all rights reserved.
#
# Usage: manageBInstallDirs <directory> <latestsubdir> [#dirsleft]
#
# Description: This script removes excessive binstall directories of
# the type parentdir/mm_dd (month day).
# It also symbolically links the most recent subdirectory
# to parentdir/latest.
#
################################################################################
if ($ARGV[1]) {
$tree = $ARGV[0];
$latestSubdir = $ARGV[1];
}
else {
die "USAGE manageBInstallDirs <parent directory> <latestsubdir> [# dirsleft]\n";
}
if (! chdir("$tree")) {
die " ERROR -> Couldn't change directory to $tree.\n";
}
if ($ARGV[2]) {
$numDirsLeft = $ARGV[2];
}
else {
$numDirsLeft = 7;
}
#######################################################
# define local subroutines
#######################################################
sub dokill {
die "\n left on INTR \n";
exit 1;
}
########################################################
# Catch signals
########################################################
$SIG{'INT'} = 'dokill';
##################################################
# get the mm_dd directories in oldest first order.
# remove the oldest if there are more than minimum.
##################################################
@allDirs = (`ls -t`);
$counter = 0;
foreach $dir (@allDirs){
chop $dir;
$_ = $dir;
if (m%^[0-9][0-9]_[0-9][0-9]$% && -d $dir) {
if ($counter++ >= $numDirsLeft) {
print "removing $tree/$dir\n";
system "rm -rf $dir";
}
}
}
############################
# link latestSubdir to latest
############################
if (-l "latest") {
print "linking $latestSubdir to \"latest\"\n";
system "rm -f latest";
system "ln -s -f $latestSubdir latest";
}
elsif(-d "latest") {
print "Error - directory \"latest\" is a real directory";
}
else { # create link
system "ln -s -f $latestSubdir latest";
}

View File

@@ -0,0 +1,520 @@
#!/bin/ksh
################################################################################
#
# File: master_build
# RCS: $XConsortium: master_build /main/14 1996/07/18 14:17:16 drk $
# Author: Marc Ayotte Hewlett-Packard, OSSD-CV
# Created: 2/6/90
# Modified by: Jim Andreas, Fred Handloser, Marc Ayotte, Ron Voll
# and others from Hewlett-Packard, OSSD-CV
# Language: N/A
# Package: N/A
# Status: CDE distributed
#
# (c) Copyright 1993, Hewlett-Packard Company, all rights reserved.
#
# Description: This file controls the building and cloning of
# of source and build trees. Look at the file cron.example
# and the usage information below for examples of how
# to use this script. There is also a man page
# master_build.1
################################################################################
################################################################################
function DoUsage #
################################################################################
{
if [ -n $1 ]; then
echo "unrecognized option: $1"
echo
fi
cat<<eof
Usage:master_build
[ -src <srcdir> ] (source directory e.g. /proj/cde, /proj/x11)
[ -build <buildir> (build dir. as in /proj/cde, /proj/x11)
[ -clone <option> ] (one of:
f -> do a full checkout # TEMPORARILY OBSOLETE!!
n -> clone creating real files (fnrclone -n)
s -> clone without checking files out of RCS
c -> clone checking out newer RCS files
sync-> clone checking out newer RCS files (OBSOLETE)
[ -cl ] (run cleanLinks)
[ -c ] (compile)
[ -b ] (run make binstall and use the default path mechanism in imake)
[ -bp <path> ] (run make binstall and supply the install location)
[ -ba <path> ] (run make binstall and create an automatic install path)
(This path is of the form path/mm_dd).
[ -cb <#dirs left> ] (clean binstall directories. must be used
with -ba option)
[ -l ] (make lint libraries)
[ -n ] (do not make Makefile,Makefiles,includes,depend)
[ -w ] (clean the tree before building)
[ -be <chrootdir> ] (do a chroot build using chrootdir)
[ -ld <ldoptions> ] (pass ld options to build probably obsolete)
[ -model <model> ] (necessary for apollo or prism)
[ -m ] ( send mail to all in BUILD_WATCH list when finished)
[ -noIgnore ] (do not use the -k option to make)
[ -log <logdir> ] directs output to <logdir>/mm_dd/cde
e.g. -log /proj/cde/logs -> /proj/cde/logs/mm_dd/cde/*
if no -log is specified, output is directed to <buildir>/mm_dd/cde/*
if no -build is specified, output is directed to ./mm_dd/cde/*
[ -t ] <tooldir> (directory containing master_build, fnrclone
directories. Currently $TOOLDIR)
eof
#
# if there is a bad option mail to any in the BUILD_WATCH list,
# we don't know if the -m option was used.
if [ "$BUILD_WATCH" ]
then
LETTER=/tmp/optError.$$
echo "master_build did not run on machine $SYSNAME" > $LETTER
echo "due to bad option '$1'" >> $LETTER
echo "" >> $LETTER
echo "" >> $LETTER
printenv >> $LETTER
mailx -s"master_build did not run on $SYSNAME due to bad option '$1'" $BUILD_WATCH < $LETTER
rm $LETTER
fi
exit 1
} # END DoUsage
###########################################################################
# Initialize Parameters
# get the architecture and start time
SYSNAME=`uname -n`
ARCH=`uname -s`
#
# Resolve date call that depend on HP-UX, Apollo sys5.3, or Apollo
# bsd4.3. The default for architectures is "date
#
if [ -f /hp-ux ]
then
DATECMD="/bin/date"
elif [ -f /com/ctnode ]
then
DATECMD="/sys5.3/bin/date"
else
DATECMD="date"
fi
START_TIME_LONG=`$DATECMD`
START_TIME="`$DATECMD +%d`_`$DATECMD +%H`:`$DATECMD +%M`:`$DATECMD +%S`"
DATE="`$DATECMD +%m`_`$DATECMD +%d`"
SENDMAIL="FALSE"
TOOLDIR=/x/cdesrc/admin/BuildTools
IGNORE="-k"
BASE_LOG_DIR=
###########################################################################
###########################################################################
# parse command line arguments...
# Prepend options from the MASTERBUILD environment variable.
set -- $MASTERBUILD $*
if [ $# -lt 1 ]
then
DoUsage $1 # exit on error
fi
while [ $# -gt 0 ]
do case $1 in
-src) SRC_DIR=$2;shift 2 ;; # source directory
-build) OBJ_DIR=$2;shift 2 ;; # build directory
-clone) CLONEOPT=$2;shift 2 ;; # clone options if any
-cl) CLEANLINKS="TRUE";shift ;; # run clean links
-c) COMPILE="TRUE";shift ;; # Compile object
-b) DOBINSTALL="TRUE";
BINSTALL_PATH=;shift ;; # run make binstall w/default path
-bp) DOBINSTALL="TRUE";
BINSTALL_PATH=$2;
shift 2 ;; # run make binstall w/supplied path
-ba) DOBINSTALL="TRUE";
BINSTALL_PATH=$2;
BINSTALL_AUTOPATH="TRUE"; # append /mm_dd to BINSTALL_PATH
shift 2 ;; # run make binstall w/auto path
-cb) DOCLEANBINSTALL="TRUE" ; # run manageBInstallDirs
NUMBINSTALLDIRSLEFT=$2 ; # directories to leave when
shift 2 ;; # cleaning binstall subdirs
-n) NOMAKEMAKEFILE=TRUE;shift;; # Do not do make Makefile, etc
-w) CLEAN="TRUE";shift ;; # Remove all object files
-l) DOLINT="TRUE";shift ;; # Make lint from top level
-ld) LDOPTIONS=$2;shift 2 ;; # LDOPTS passed
-be) BE=TRUE;BEDIR=$2;shift 2;; # use pseudo-root BEDIR to build
-log) BASE_LOG_DIR=$2;shift 2;; # use alternate log directory
-t) TOOLDIR=$2;shift 2 ;; # directory for fnrclone, etc.
-model) MODEL=$2;shift 2 ;; # not necessary for hp
-noIgnore) IGNORE=; shift ;; # do not ignore make errors (no -k)
-m) SENDMAIL="TRUE";BUILD_WATCH=$2;shift 2 ;; # send mail when finished
*) DoUsage $1;shift ;; # exit on error
esac
done
umask 002
###########################################################################
# Set up various log directories
#
CLEANBINSTALL=$TOOLDIR/master_build/manageBInstallDirs
LATESTDIR=$DATE # for manageBInstallDirs
CLEANBINSTALLPATH=$BINSTALL_PATH # for manageBInstallDirs
# binstall automatic path
if [ "$BINSTALL_AUTOPATH" ];then
BINSTALL_PATH=$BINSTALL_PATH/$DATE
else
if [ "$DOCLEANBINSTALL" ];then
echo "ERROR - can't run manageBInstallDirs unless -ba option is used";
DoUsage
fi
fi
#
# The log directory is determined as follows
#
# 1. The directory specified in the -log flag.
# 2. The directory specified in the -build flag.
# 3. The current directory.
#
if [ "$BASE_LOG_DIR" = "" ]; then
if [ "$OBJ_DIR" ]; then
BASE_LOG_DIR=$OBJ_DIR;
else
BASE_LOG_DIR=".";
fi
fi
BASE_LOG_DIR=$BASE_LOG_DIR/$DATE
# set up log directories on build machines
# use build directory for log file if present, otherwise use source
# if binstall wanted and no object dir -> error
if [ "$OBJ_DIR" ];then
FOCUS_DIR=$OBJ_DIR
else
if [ "$DOBINSTALL" ];then
echo "\n\t----------------------------------------------------------";
echo "\t*** ERROR - must specify -build option with -b options ***"
echo "\t----------------------------------------------------------";
DoUsage;
fi
FOCUS_DIR=$SRC_DIR
fi
#
# check the existence of OSVersion.tmpl
#
if [ ! -a $FOCUS_DIR/config/OSVersion.tmpl ]; then
echo "$FOCUS_DIR/config/OSVersion.tmpl does not exist"
echo "Abort...."
exit 1
fi
#
# check the existence of localtree.tmpl
#
if [ ! -a $FOCUS_DIR/config/localtree.tmpl ]; then
echo "$FOCUS_DIR/config/localtree.tmpl does not exist"
echo "Abort...."
exit 1
fi
#
# setup the log directory
#
LEAF_LOG_DIR=`basename $FOCUS_DIR`
LOG_DIR=$BASE_LOG_DIR/$LEAF_LOG_DIR
[ ! -d $LOG_DIR ] && mkdir -p $LOG_DIR
DATE=`$DATECMD +%H%M%S`
BUILDLOGDATE=`$DATECMD +%a`
# make a daily directory for logs
CLONE_ERR=$LOG_DIR/cloneerr.$DATE
CLONE_LOG=$LOG_DIR/clonelog.$DATE
CLEANLINKS_LOG=$LOG_DIR/cleanlinks.$DATE
MAKE_FILE=$LOG_DIR/make.$DATE
ALL_MAKE=$LOG_DIR/allmake.$DATE
LINT_LOG=$LOG_DIR/lint.$DATE
BINSTALL_LOG=$LOG_DIR/binstall.$DATE
CLEANBINSTALL_LOG=$LOG_DIR/cleanbinstall.$DATE
SUMMARY_FILE=$LOG_DIR/summary.$DATE
PROCESSID_FILE=$LOG_DIR/pid.$DATE
echo "$$" > $PROCESSID_FILE
echo "pid of master_build is $$ for $FOCUS_DIR on $SYSNAME" >> $PROCESSID_FILE
# Log file for a particular build tree
[ "$OBJ_DIR" ] && [ ! -d $OBJ_DIR/logs ] && mkdir $OBJ_DIR/logs
OBJ_DIR_LOG=$OBJ_DIR/logs/make.${BUILDLOGDATE}.${DATE}
###########################################################################
# Clone source or build trees
#
# clone if appropriate
if [ "$CLONEOPT" ]
then
cd $FOCUS_DIR #directory which will be cloned if not checkout all
echo "\n==== Cloning $FOCUS_DIR on $SYSNAME, pid of master_build is $$ ====\n";
case $CLONEOPT in
s) $TOOLDIR/fnrclone/fnrclone $SRC_DIR $FOCUS_DIR -f $CLONE_LOG 1>$CLONE_ERR 2>&1;;
n | c) $TOOLDIR/fnrclone/fnrclone $SRC_DIR $FOCUS_DIR -${CLONEOPT} -f $CLONE_LOG 1>$CLONE_ERR 2>&1;;
sync) $TOOLDIR/fnrclone/fnrclone $SRC_DIR $FOCUS_DIR -c -f $CLONE_LOG 1>$CLONE_ERR 2>&1;;
*) echo "\n=========== bad clone option $CLONEOPT on $SYSNAME ========\n";
# if there is a bad option mail to any in the BUILD_WATCH list,
# even if the -m option was not used since this is an error
if [ "$BUILD_WATCH" ]; then
LETTER=/tmp/cloneOptError.$$
echo "master_build on machine $SYSNAME exited " > $LETTER
echo "due to bad clone option '$CLONEOPT'" >> $LETTER
echo "" >> $LETTER
echo "" >> $LETTER
printenv >> $LETTER
mailx -s"master_build on $SYSNAME exited due to bad clone option '$CLONEOPT'" $BUILD_WATCH < $LETTER
rm $LETTER
fi
exit 1;;
esac
fi
#################################
# Clean symbolic links to nowhere
#################################
if [ "$CLEANLINKS" = "TRUE" ]
then
echo "\n= removing symbolic links to nowhere in $FOCUS_DIR on $SYSNAME =\n";
$TOOLDIR/master_build/cleanLinks $FOCUS_DIR 1>$CLEANLINKS_LOG 2>&1
fi
###########################################################################
#
# build new stuff...
#
if [ "$CLEAN" ]
then
CLEAN="make $IGNORE clean"
CLEAN_STEPNAME="clean "
else
CLEAN="true"
fi
if [ "$COMPILE" -o "$DOLINT" ];then
if [ "$COMPILE" ]; then
BUILD="make $IGNORE"
COMPILE_STEPNAME="make"
else
BUILD="true"
fi
if [ "$DOLINT" ];then
LINT="make $IGNORE lintlib"
LINT_STEPNAME="lintlib"
else
LINT="true"
fi
# if only doing make (-n option) ignore everything else
if [ "$NOMAKEMAKEFILE" ];then
MFILE="true"
MFILES="true"
MKINCLUDES="true"
DEPEND="true"
else
MFILE="make -f Makefile.ini Makefile"
MFILES="make $IGNORE Makefiles"
MKINCLUDES="make $IGNORE includes"
DEPEND="make $IGNORE depend"
MAKEFILES_STEPNAME="Makefiles"
INCLUDES_STEPNAME="includes"
DEPEND_STEPNAME="depend"
fi
echo "\n================= Building $OBJ_DIR on $SYSNAME ==================\n"
echo "Build Directory: $OBJ_DIR"
echo "Logging Directory: $LOG_DIR"
echo "MasterBuild Steps: $MAKEFILES_STEPNAME $CLEAN_STEPNAME $INCLUDES_STEPNAME $DEPEND_STEPNAME $COMPILE_STEPNAME $LINT_STEPNAME"
#
# Print out information about the view configuration
#
CLEARTOOL=/usr/atria/bin/cleartool
if [ -f $CLEARTOOL -a -x $CLEARTOOL ]; then
CWD=`pwd`
cd $OBJ_DIR
echo "\nBuild view: " `$CLEARTOOL pwv -wdview -short`
echo "\nView config-spec:"
$CLEARTOOL catcs | grep -v "^#" | sed 's/.*/ &/'
echo "\nChecked out versions:"
$CLEARTOOL lsco -cview -avobs -fmt " %Sd %u %n\n"
cd $CWD
fi
#
# print out OSVersion.tmpl info if it is a symbolic link
#
echo "\n$FOCUS_DIR/config/OSVersion.tmpl:"
if [ -L $FOCUS_DIR/config/OSVersion.tmpl ]; then
ls -l $FOCUS_DIR/config/OSVersion.tmpl | \
awk '{ print " Link to -> " $11 }'
else
ls -l $FOCUS_DIR/config/OSVersion.tmpl
fi
awk '/^#define/ { print " " $2,$3 }' $FOCUS_DIR/config/OSVersion.tmpl
#
# print out localtree.tmpl info if it is a symbolic link
#
echo "\n$FOCUS_DIR/config/localtree.tmpl:"
if [ -L $FOCUS_DIR/config/localtree.tmpl ]; then
ls -l $FOCUS_DIR/config/localtree.tmpl | \
awk '{ print " Link to -> " $11 }'
else
ls -l $FOCUS_DIR/config/localtree.tmpl
fi
echo ""
######################################################################
# This section below probably only applies to Hewlett-Packard
# It concerns using a chroot build environment when building.
######################################################################
#chroot build
if [ "$BE" ];then
cat<<dernier>$BEDIR/tmp/allmake$$script
#! /bin/sh
umask 002
cd $OBJ_DIR && $MFILE && $MFILES && $CLEAN && $MKINCLUDES && $DEPEND
dernier
chmod +x $BEDIR/tmp/allmake$$script
/usr/local/bin/changeroot $BEDIR /tmp/allmake$$script 1>$ALL_MAKE 2>&1
rm -f $BEDIR/tmp/allmake$$script
cat<<dernier>$BEDIR/tmp/make$$script
#! /bin/sh
umask 002
LDOPTS="$LDOPTIONS"
export LDOPTS
cd $OBJ_DIR && $BUILD
dernier
chmod +x $BEDIR/tmp/make$$script
/usr/local/bin/changeroot $BEDIR /tmp/make$$script 2>&1 | tee $OBJ_DIR_LOG 1>$MAKE_FILE
rm -f $BEDIR/tmp/make$$script
if [ "$DOLINT" ];then
cat<<dernier>$BEDIR/tmp/lint$$script
#! /bin/sh
umask 002
cd $OBJ_DIR && $LINT
dernier
chmod +x $BEDIR/tmp/lint$$script
/usr/local/bin/changeroot $BEDIR /tmp/lint$$script 1>$LINT_LOG 2>&1
rm -f $BEDIR/tmp/lint$$script
fi
######################################################################
# non chroot (normal) builds
######################################################################
else
if [ "$ARCH" = "SunOS" ];then
PATH=$PATH:/usr/ccs/bin
export PATH
fi
if [ "$MODEL" = "apollo" -o "$MODEL" = "prism" ]
then
( umask 002
echo "Preparing to build in: \"$OBJ_DIR\"."
cd $OBJ_DIR &&
$MFILE &&
$MFILES &&
$CLEAN &&
$MKINCLUDES &&
$DEPEND
) 1>$ALL_MAKE 2>&1
( umask 002
echo "Building in \"$OBJ_DIR\"."
echo " X11REV=\"$X11REV\"."
echo " MOTIFREV=\"$MOTIFREV\"."
cd $OBJ_DIR &&
$BUILD
) 2>&1 | tee $OBJ_DIR_LOG 1>$MAKE_FILE
( umask 002
echo "Linting in \"$OBJ_DIR\"."
cd $OBJ_DIR &&
$LINT
) 1>$LINT_LOG 2>&1
else # all other architectures
COMMAND="umask 002
cd $OBJ_DIR &&
$MFILE &&
$MFILES &&
$CLEAN &&
$MKINCLUDES &&
$DEPEND &&
$BUILD 2>&1 | tee $OBJ_DIR_LOG 1>$MAKE_FILE &&
$LINT 1>$LINT_LOG 2>&1"
eval "$COMMAND" 1>$ALL_MAKE 2>&1
fi # apollo || prism
fi # BE
LETTER=/tmp/allOK.$$
STORAGEDIR=`/bin/pwd`
END_TIME="`$DATECMD +%d`_`$DATECMD +%H`:`$DATECMD +%M`:`$DATECMD +%S`"
END_TIME_LONG=`$DATECMD`
echo "master_build for $FOCUS_DIR on machine $SYSNAME " > $LETTER
echo " " >> $LETTER
echo " started at $START_TIME_LONG" >> $LETTER
echo " " >> $LETTER
echo " and finished at $END_TIME_LONG" >> $LETTER
echo "" >> $LETTER
echo "Summary: $SYSNAME $FOCUS_DIR $STORAGEDIR $START_TIME $END_TIME" >> $LETTER
echo "" >> $LETTER
cp $LETTER $SUMMARY_FILE
if [ "$SENDMAIL" = "TRUE" ] && [ "$BUILD_WATCH" ]
then
mailx -s"master_build for $FOCUS_DIR finished at `date`" $BUILD_WATCH < $LETTER
fi
rm -f $LETTER
fi # COMPILE || DOLINT
if [ "$DOBINSTALL" ];then
echo "Running make binstall on \"$OBJ_DIR\"."
if [ "$BINSTALL_PATH" ];then
BINSTALL="make $IGNORE BINSTALLPATH=$BINSTALL_PATH binstall";
else
BINSTALL="make $IGNORE binstall";
fi
cd $OBJ_DIR && $BINSTALL 1>$BINSTALL_LOG 2>&1
if [ "$DOCLEANBINSTALL" ];then
echo "Running clean binstall on \"$CLEANBINSTALLPATH\""
$CLEANBINSTALL $CLEANBINSTALLPATH $LATESTDIR $NUMBINSTALLDIRSLEFT 1>$CLEANBINSTALL_LOG 2>&1
fi
fi
exit 0

View File

@@ -0,0 +1,55 @@
#! /usr/local/bin/perl
eval "exec /usr/local/bin/perl -S $0 $*"
if $running_under_some_shell;
###############################################################################
#
# File: mkPreviousLink
# RCS: $XConsortium: mkPreviousLink /main/3 1995/10/30 13:44:16 rswiston $
# Author: John Herberg
# Created: 4/13/94
# Language: perl
# Package:
# Status
#
# (c) Copyright 1994, Hewlett-Packard, all rights reserved.
#
# Usage: mkPreviousLink <directory>
#
# Description: Copies latest link in directory to previous.
#
###############################################################################
###############################################################################
# printUsage - print sytax of script and die
###############################################################################
sub printUsage
{
die "Usage: mkPreviousLink <binstallpath>\n";
}
###
### Start main
###
&printUsage() if ((@ARGV != 1) || ($ARGV[0] =~ /^-/o));
$tree=$ARGV[0];
$_ = "$tree/latest";
### Resolve link
( -l ) || die "*** Error: $_ is not a symbolic link\n";
defined($ldest = readlink) || die "*** Error: Failed to resolve link, $_ $ldest\n";
### Create "previous" link
chdir($tree) || die "*** Error: Failed to change directory to $tree\n";
unlink("previous");
symlink($ldest, "previous") ||
die "*** Error: Could not create link, $tree/previous -> $ldest\n";

View File

@@ -0,0 +1,20 @@
#!/bin/sh
#this script is set to provide access to remote builds and pass the
# appropriate options to the remote machines
# Marc Ayotte 2/5/90
USAGE="USAGE: remote_build <remotehost> [Remoteoptions ..]
see master_build for details on options"
if [ $# -lt 1 ];then
echo ""
echo "$USAGE"
exit 1
fi
REMOTEHOST=$1
shift
remsh $REMOTEHOST "/x/cdesrc/admin/BuildTools/master_build/master_build $*"