Stephen Lau wrote:
Hi Bill (cc'ing tools-discuss),
I'm looking at 'ws', and wondering about the use of the
Codemgr_ws/sunos/protodefs file... Rich said you were able to convince
him not to throw it away; do you mind convincing me too? :-)
I'm debating about what to do in the Hg case, whether we should keep a
symmetrical .hg/sunos/protodefs file, or what..., but I could use some
more background.
I just did an hg aware ws while sitting on the plane to the bay area on
Thursday.
Diff attached.
--
Darren J Moffat
--- bin/ws Thu Feb 8 12:40:39 2007
+++ /opt/onbld/bin/ws Fri Dec 29 07:45:39 2006
@@ -1,10 +1,11 @@
-#!/bin/ksh -p
+#!/bin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -20,10 +21,10 @@
# CDDL HEADER END
#
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
+# ident "@(#)ws.sh 1.7 05/06/08 SMI"
#
# This script sets up the environment variables for a SunOS
# codemgr workspace and spawns a shell with the environment
@@ -30,7 +31,7 @@
# setup.
#
# The following Environment variables are set:
-# CODEMGR_WS (Teamware only)
+# CODEMGR_WS
# ONBLD_DIR
# SRC
# TSRC
@@ -65,36 +66,17 @@
#
check_proto()
{
- if [ "$SCM_MODE" = "teamware" ]; then
- # Check for problematic parent specification and adjust
- proto=`echo $1|fmtwsname`
- #
- # if proto contains a /usr/include directory we assume
- # that this is an old style proto area
- #
- if [ -d $proto/usr/include ]; then
- echo $proto
- else
- echo "${proto}/root_${MACH}"
- fi
+ # Check for problematic parent specification and adjust
+ proto=`echo $1|fmtwsname`
+ #
+ # if proto contains a /usr/include directory we assume
+ # that this is an old style proto area
+ #
+ if [ -d $proto/usr/include ]; then
+ echo $proto
+ else
+ echo "${proto}/root_${MACH}"
fi
-
- if [ "$SCM_MODE" = "mercurial" ]; then
- proto=$1
- #
- # If the proto is a local repository then we can use it
- # to point to the parents proto area. Don't bother to
- # check if it exists or not, we never did for Teamware,
- # since it might appear later anyway.
- #
- if [ "${proto##ssh://}" != "$proto" -o \
- "${proto##http://}" != "$proto" -o \
- "${proto##https://}" != "$proto" ]; then
- :
- else
- echo "${proto}/root_${MACH}"
- fi
- fi
}
cleanup_env()
@@ -113,17 +95,8 @@
fi
if [ $# -lt 1 ]; then
- set -- `workspace name 2>/dev/null`
- if [ $# -eq 1 ]; then
- echo "Defaulting to Teamware workspace $1"
- SCM_MODE=teamware
- else
- set -- `hg root`
- if [ $# -eq 1 ]; then
- echo "Defaulting to Mercurial repository $1"
- SCM_MODE=mercurial
- fi
- fi
+ set -- `workspace name`
+ [ $# -eq 1 ] && echo "Defaulting to workspace $1"
fi
if [ $# -lt 1 ]; then
@@ -172,7 +145,7 @@
wsname="$pwd/$wsname"
fi
-if [ "$SCM_MODE" = "teamware" -a ! -d $wsname/Codemgr_wsdata ]; then
+if [ ! -d $wsname/Codemgr_wsdata ]; then
echo "Error: $wsname is not a workspace" >&2
if $setenv; then
cleanup_env
@@ -182,12 +155,7 @@
fi
fi
-if [ "$SCM_MODE" = "teamware" ]; then
- tmpwsname=`(cd $wsname >/dev/null && workspace name)`
-fi
-if [ "$SCM_MODE" = "mercurial" ]; then
- tmpwsname=`(cd $wsname >/dev/null && hg root)`
-fi
+tmpwsname=`(cd $wsname >/dev/null && workspace name)`
if [ -z "$tmpwsname" ]; then
echo "Error: $wsname is not a workspace" >&2
if $setenv; then
@@ -211,48 +179,43 @@
exit 1
fi
fi
-if [ "$SCM_MODE" = "teamware" ]; then
- if [ -d ${wsname}/Codemgr_wsdata ]; then
- CM_DATA=Codemgr_wsdata
+if [ -d ${wsname}/Codemgr_wsdata ]; then
+ CM_DATA=Codemgr_wsdata
+else
+ echo "$wsname is not a workspace" >&2
+ if $setenv; then
+ cleanup_env
+ return 1
else
- echo "$wsname is not a workspace" >&2
- if $setenv; then
- cleanup_env
- return 1
- else
- exit 1
- fi
+ exit 1
fi
fi
-if [ "$SCM_MODE" = "teamware" ]; then
- CODEMGR_WS=$wsname ; export CODEMGR_WS
-fi
-SRC=$wsname/usr/src; export SRC
-TSRC=$wsname/usr/ontest; export TSRC
+CODEMGR_WS=$wsname; export CODEMGR_WS
+SRC=$CODEMGR_WS/usr/src; export SRC
+TSRC=$CODEMGR_WS/usr/ontest; export TSRC
-if [ "$SCM_MODE" = "teamware" ]; then
- wsosdir=$CODEMGR_WS/$CM_DATA/sunos
- protofile=$wsosdir/protodefs
+wsosdir=$CODEMGR_WS/$CM_DATA/sunos
+protofile=$wsosdir/protodefs
- if [ ! -f $protofile ]; then
- if [ ! -w $CODEMGR_WS/$CM_DATA ]; then
- #
- # The workspace doesn't have a protodefs file and I am
- # unable to create one. Tell user and use /tmp instead.
- #
- echo "Unable to create the proto defaults file ($protofile)."
+if [ ! -f $protofile ]; then
+ if [ ! -w $CODEMGR_WS/$CM_DATA ]; then
+ #
+ # The workspace doesn't have a protodefs file and I am
+ # unable to create one. Tell user and use /tmp instead.
+ #
+ echo "Unable to create the proto defaults file ($protofile)."
- # Just make one in /tmp
- wsosdir=/tmp
- protofile=$wsosdir/protodefs
- fi
+ # Just make one in /tmp
+ wsosdir=/tmp
+ protofile=$wsosdir/protodefs
+ fi
- if [ ! -d $wsosdir ]; then
- mkdir $wsosdir
- fi
+ if [ ! -d $wsosdir ]; then
+ mkdir $wsosdir
+ fi
- cat << PROTOFILE_EoF > $protofile
+ cat << PROTOFILE_EoF > $protofile
#!/bin/sh
#
# Set default proto areas for this workspace
@@ -291,16 +254,9 @@
fi
PROTOFILE_EoF
- fi
-
- . $protofile
fi
-if [ "$SCM_MODE" = "mercurial" ]; then
- parent=`hg path default`
- PROTO1=$wsname/proto
- PROTO2=$parent/proto
-fi
+. $protofile
# This means you don't have to type make -e all of the time
@@ -406,7 +362,7 @@
fi
echo ""
-echo "Workspace : $wsname"
+echo "Workspace (\$CODEMGR_WS) : $CODEMGR_WS"
if [ -n "$parent" ]; then
echo "Workspace Parent : $parent"
fi
@@ -419,10 +375,10 @@
if [ $osbld_flag = "1" ]; then
echo "Prepended to PATH : $ONBLD_DIR"
fi
-echo "Current directory (\$PWD) : $wsname"
+echo "Current directory (\$PWD) : $CODEMGR_WS"
echo ""
-cd $wsname
+cd $CODEMGR_WS
if $setenv; then
cleanup_env
_______________________________________________
tools-discuss mailing list
tools-discuss@opensolaris.org