[Zope-CVS] CVS: Products/OSCOM/bootstrap - buildout_zope_sandbox:1.7

Tres Seaver tseaver@zope.com
Tue, 13 May 2003 21:51:00 -0400


Update of /cvs-repository/Products/OSCOM/bootstrap
In directory cvs.zope.org:/tmp/cvs-serv23169

Modified Files:
	buildout_zope_sandbox 
Log Message:
 - Parameterize tools, clean up assignments.

=== Products/OSCOM/bootstrap/buildout_zope_sandbox 1.6 => 1.7 ===
--- Products/OSCOM/bootstrap/buildout_zope_sandbox:1.6	Wed May  7 20:17:29 2003
+++ Products/OSCOM/bootstrap/buildout_zope_sandbox	Tue May 13 21:50:59 2003
@@ -46,70 +46,86 @@
 #   $Id$
 #==============================================================================
 PLATFORM=`uname`
-echo Building OSCOM Zope sandbox: PLATFORM is $PLATFORM
+
+#------------------------------------------------------------------------------
+#   Tool macros
+#------------------------------------------------------------------------------
+mkdir="mkdir -p"
+fetch_tarball="wget"    # OSX:  curl?
+cvs="cvs -q"
+chmodx="chmod +x"
+patch="patch"
+untar="tar xzf"
+make="make"
+lnsf="ln -sf"
+cprs="cp -rs"           # copy files as symlinks; OSX:  'cp -a'?
+cat="cat"
+echo="echo"
+
+$echo Building OSCOM Zope sandbox: PLATFORM is $PLATFORM
 
 #------------------------------------------------------------------------------
 #   Version / repository selectors
 #------------------------------------------------------------------------------
 PYTHON_VERSION=${PYTHON_VERSION:-2.1.3}           # XXX 2.2.3?
-PYTHON_ORG=http://www.python.org/ftp/python
+PYTHON_ORG="http://www.python.org/ftp/python"
 PYTHON_SOURCE_URL=$PYTHON_ORG/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz
 
 PYXML_VERSION=${PYXML_VERSION:-0.8.1}             # 0.8.2?
-PYXML_SF_DOWNLOAD=http://aleron.dl.sourceforge.net/sourceforge/pyxml
+PYXML_SF_DOWNLOAD="http://aleron.dl.sourceforge.net/sourceforge/pyxml"
 PYXML_URL=$PYXML_SF_DOWNLOAD/PyXML-$PYXML_VERSION.tar.gz
 
 ZOPE_CVSROOT=:pserver:anonymous@cvs.zope.org:/cvs-repository
 
 ZOPE_VERSION=${ZOPE_VERSION:-2.6.1}              # XXX 2.6.2, 2.7?
-ZOPE_MODULE=Zope
+ZOPE_MODULE="Zope"
 
 if [ "$ZOPE_VERSION" == "2.6.1" ]; then
-    ZOPE_TAG=Zope-2-6-1-src
+    ZOPE_TAG="-r Zope-2-6-1-src"
 elif [ "$ZOPE_VERSION" == "head" ]; then
-    ZOPE_TAG=HEAD
+    ZOPE_TAG=
 fi
 
 if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
     ZODB3_VERSION=${ZODB3_VERSION:-3.1.1}              # XXX 3.1.2?
-    ZODB3_MODULE=ZODB3
+    ZODB3_MODULE="ZODB3"
 
     if [ "$ZODB3_VERSION" == "3.1.1" ]; then
-        ZODB3_TAG=ZODB3-3-1-1-final
+        ZODB3_TAG="-r ZODB3-3-1-1-final"
     elif [ "$ZODB3_VERSION" == "3.1.2" ]; then
-        ZODB3_TAG=ZODB3-3-1-2-final
+        ZODB3_TAG="-r ZODB3-3-1-2-final"
     fi
 fi
 
 CMF_VERSION=${CMF_VERSION:-1.3.1}               # XXX 1.4?
-CMF_MODULE=CMF
+CMF_MODULE="CMF"
 
 if [ "$CMF_VERSION" == "1.3.1" ]; then
-    CMF_TAG=CMF-1_3_1-release
+    CMF_TAG="-r CMF-1_3_1-release"
 elif [ "$CMF_VERSION" == "1.4" ]; then
-    CMF_TAG=CMF-1_4-release
+    CMF_TAG="-r CMF-1_4-release"
 elif [ "$CMF_VERSION" == "1.4beta1" ]; then
-    CMF_TAG=CMF-1_4beta1
+    CMF_TAG="-r CMF-1_4beta1"
 elif [ "$CMF_VERSION" == "head" ]; then
-    CMF_TAG=HEAD
+    CMF_TAG=
 fi
 
 if [ "$CMF_VERSION" == "1.3.1" ]; then
     DCWORKFLOW_VERSION=${DCWORKFLOW_VERSION:-0.5}   # not needed for CMF >= 1.4
-    DCWORKFLOW_MODULE=CMF/DCWorkflow
-    DCWORKFLOW_TAG=DCWorkflow-0_5
+    DCWORKFLOW_MODULE="CMF/DCWorkflow"
+    DCWORKFLOW_TAG="-r DCWorkflow-0_5"
 fi
 
 if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
 
     # DBTab makes managing ZEO ClientStorage simpler under 2.6.*
     DBTAB_VERSION=${DBTAB_VERSION:-1.2}
-    DBTAB_MODULE=Products/DBTab
+    DBTAB_MODULE="Products/DBTab"
 
     if [ "$DBTAB_VERSION" == "1.2" ]; then
-        DBTAB_TAG=DBTab-1_2
+        DBTAB_TAG="-r DBTab-1_2"
     elif [ "$DBTAB_VERSION" == "head" ]; then
-        DBTAB_TAG=HEAD
+        DBTAB_TAG=
     fi
 fi
 
@@ -124,12 +140,12 @@
 etcdir=$sandbox/etc
 tmpdir=$sandbox/tmp
 
-mkdir -p $srcdir
-mkdir -p $optdir
-mkdir -p $bindir
-mkdir -p $vardir
-mkdir -p $etcdir
-mkdir -p $tmpdir
+$mkdir $srcdir
+$mkdir $optdir
+$mkdir $bindir
+$mkdir $vardir
+$mkdir $etcdir
+$mkdir $tmpdir
 
 #------------------------------------------------------------------------------
 #   Build Python
@@ -148,16 +164,16 @@
 fi
 
 cd $tmpdir
-wget --continue $PYTHON_SOURCE_URL
+$fetch_tarball --continue $PYTHON_SOURCE_URL
 cd $srcdir
-tar xzf $tmpdir/Python-$PYTHON_VERSION.tgz
+$untar $tmpdir/Python-$PYTHON_VERSION.tgz
 
 #
 #   Work around glitch in remote configure for 2.2.2
 #
 if [ "$PYTHON_VERSION" == "2.2.2" ]; then
     cd $srcdir/Python-$PYTHON_VERSION
-    patch Lib/distutils/sysconfig.py << PYTHON_222_DISTUTILS_PATCH_EOF
+    $patch Lib/distutils/sysconfig.py << PYTHON_222_DISTUTILS_PATCH_EOF
 --- python/python/dist/src/Lib/distutils/sysconfig.py	2002/10/08 14:59:43	1.44.6.2
 +++ python/python/dist/src/Lib/distutils/sysconfig.py	2002/11/26 09:42:57	1.44.6.3
 @@ -29,13 +29,9 @@
@@ -181,29 +197,29 @@
 fi
 
 cd $optdir
-mkdir -p Python-$PYTHON_VERSION/build
+$mkdir -p Python-$PYTHON_VERSION/build
 cd Python-$PYTHON_VERSION/build
 CC=$PYTHON_CC $srcdir/Python-$PYTHON_VERSION/configure $PYTHON_CONFIGS
-make
-make install
+$make
+$make install
 cd $optdir
-ln -s Python-$PYTHON_VERSION Python2
+$lnsf Python-$PYTHON_VERSION Python2
 cd $bindir
 
-ln -s $optdir/Python2/bin/python .
+$lnsf $optdir/Python2/bin/python .
 
 #------------------------------------------------------------------------------
 #   Install PyXML
 #------------------------------------------------------------------------------
 cd $tmpdir
-wget --continue $PYXML_URL
+$fetch_tarball --continue $PYXML_URL
 cd $srcdir
-tar xzf $tmpdir/PyXML-$PYXML_VERSION.tar.gz
+$untar $tmpdir/PyXML-$PYXML_VERSION.tar.gz
 #
 #   Work around a bug with Unicode DTD URLs.
 #
 cd $srcdir/PyXML-$PYXML_VERSION
-patch xml/sax/xmlreader.py << PYXML_081_PATCH_EOF
+$patch xml/sax/xmlreader.py << PYXML_081_PATCH_EOF
 @@ -221,7 +221,7 @@
  
      def getSystemId(self):
@@ -215,8 +231,8 @@
          """Sets the character encoding of this InputSource.
 PYXML_081_PATCH_EOF
 cd $optdir
-cp -rs $srcdir/PyXML-$PYXML_VERSION .
-ln -s PyXML-$PYXML_VERSION PyXML
+$cprs $srcdir/PyXML-$PYXML_VERSION .
+$lnsf PyXML-$PYXML_VERSION PyXML
 cd PyXML
 $bindir/python setup.py install
 
@@ -224,10 +240,10 @@
 #   Build Zope SOFTWARE_HOME
 #------------------------------------------------------------------------------
 cd $srcdir
-cvs -d $ZOPE_CVSROOT co -d Zope-$ZOPE_VERSION -r $ZOPE_TAG $ZOPE_MODULE
+$cvs -d $ZOPE_CVSROOT co -d Zope-$ZOPE_VERSION $ZOPE_TAG $ZOPE_MODULE
 cd $optdir
 if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
-    cp -rs $srcdir/Zope-$ZOPE_VERSION .
+    $cprs $srcdir/Zope-$ZOPE_VERSION .
     cd Zope-$ZOPE_VERSION
     $bindir/python wo_pcgi.py
     rm inituser
@@ -235,38 +251,38 @@
     #   Install ZODB (only needed for Zope 2.6.*).
     #
     cd $srcdir
-    cvs -d $ZOPE_CVSROOT co -d ZODB3-$ZODB3_VERSION -r $ZODB3_TAG $ZODB3_MODULE
+    $cvs -d $ZOPE_CVSROOT co -d ZODB3-$ZODB3_VERSION $ZODB3_TAG $ZODB3_MODULE
     cd $optdir
-    cp -rs $srcdir/ZODB3-$ZODB3_VERSION .
-    ln -s ZODB3-$ZODB3_VERSION ZODB3
+    $cprs $srcdir/ZODB3-$ZODB3_VERSION .
+    $lnsf ZODB3-$ZODB3_VERSION ZODB3
     cd ZODB3
     $bindir/python setup.py install --home=$optdir/Zope-$ZOPE_VERSION
 else
-    mkdir Zope-$ZOPE_VERSION/build
+    $mkdir Zope-$ZOPE_VERSION/build
     cd Zope-$ZOPE_VERSION/build
     $srcdir/Zope-$ZOPE_VERSION/configure \
       --with-python=$bindir/python --prefix=$optdir/Zope-$ZOPE_VERSION
-    make
-    make install
+    $make
+    $make install
 fi
 
 cd $optdir
-ln -s Zope-$ZOPE_VERSION Zope
+$lnsf Zope-$ZOPE_VERSION Zope
 
 #
 #   Build ZEO INSTANCE_HOME
 #
 if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
     cd $vardir
-    mkdir -p storage/var
+    $mkdir -p storage/var
 else
-    cd $optdir/Zope-$ZOPE_VERSION
-    bin/mkzeoinstance $vardir/storage 8001
+    #cd $optdir/Zope-$ZOPE_VERSION
+    $optdir/Zope-$ZOPE_VERSION/bin/mkzeoinstance $vardir/storage 8001
     cd $etcdir
-    ln -s $vardir/storage/etc/zeo.conf .
-    ln -s $vardir/storage/etc/zeoctl.conf .
+    $lnsf $vardir/storage/etc/zeo.conf .
+    $lnsf $vardir/storage/etc/zeoctl.conf .
     cd $bindir
-    ln -s $vardir/storage/bin/zeoctl .
+    $lnsf $vardir/storage/bin/zeoctl .
 fi
 
 #
@@ -274,56 +290,57 @@
 #
 if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
     cd $vardir
-    mkdir -p zope/var zope/Products zope/import zope/Extensions
-    echo Creating initial "manager" account.
+    $mkdir -p zope/var zope/Products zope/import zope/Extensions
+    $echo Creating initial "manager" account.
     $bindir/python $optdir/Zope/zpasswd.py $vardir/zope/inituser
 else
-    cd $optdir/Zope-$ZOPE_VERSION
-    bin/mkzopeinstance --zeo localhost:8001 $vardir/zope
+    #cd $optdir/Zope-$ZOPE_VERSION
+    $optdir/Zope-$ZOPE_VERSION/bin/mkzopeinstance \
+        --zeo localhost:8001 $vardir/zope
     cd $etcdir
-    ln -s $vardir/storage/etc/zope.conf .
+    $lnsf $vardir/storage/etc/zope.conf .
     cd $bindir
-    ln -s $vardir/zope/bin/zopectl .
+    $lnsf $vardir/zope/bin/zopectl .
 fi
 
 #------------------------------------------------------------------------------
 #   Fetch products.
 #------------------------------------------------------------------------------
 cd $srcdir
-cvs -d $ZOPE_CVSROOT co -d CMF-$CMF_VERSION -r $CMF_TAG $CMF_MODULE
+$cvs -d $ZOPE_CVSROOT co -d CMF-$CMF_VERSION -r $CMF_TAG $CMF_MODULE
 cd $optdir
-cp -rs $srcdir/CMF-$CMF_VERSION .
-ln -s CMF-$CMF_VERSION CMF
+$cprs $srcdir/CMF-$CMF_VERSION .
+$lnsf CMF-$CMF_VERSION CMF
 
 if [ "$CMF_VERSION" == "1.3.1" ]; then
     cd $srcdir
-    cvs -d $ZOPE_CVSROOT co -d DCWorkflow-$DCWORKFLOW_VERSION \
-                            -r $DCWORKFLOW_TAG $DCWORKFLOW_MODULE
+    $cvs -d $ZOPE_CVSROOT co -d DCWorkflow-$DCWORKFLOW_VERSION \
+                            $DCWORKFLOW_TAG $DCWORKFLOW_MODULE
     cd $optdir
-    cp -rs $srcdir/DCWorkflow-$DCWORKFLOW_VERSION .
-    ln -s DCWorkflow-$DCWORKFLOW_VERSION DCWorkflow
+    $cprs $srcdir/DCWorkflow-$DCWORKFLOW_VERSION .
+    $lnsf DCWorkflow-$DCWORKFLOW_VERSION DCWorkflow
 fi
 
 if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
     cd $srcdir
-    cvs -d $ZOPE_CVSROOT co -d DBTab-$DBTAB_VERSION -r $DBTAB_TAG $DBTAB_MODULE
+    $cvs -d $ZOPE_CVSROOT co -d DBTab-$DBTAB_VERSION $DBTAB_TAG $DBTAB_MODULE
     cd $optdir
-    cp -rs $srcdir/DBTab-$DBTAB_VERSION .
-    ln -s DBTab-$DBTAB_VERSION DBTab
+    $cprs $srcdir/DBTab-$DBTAB_VERSION .
+    $lnsf DBTab-$DBTAB_VERSION DBTab
 fi
 
 #------------------------------------------------------------------------------
 #   Install products
 #------------------------------------------------------------------------------
 cd $vardir/zope/Products
-ln -s $optdir/CMF/CMFCore .
-ln -s $optdir/CMF/CMFDefault .
-ln -s $optdir/CMF/CMFTopic .
-ln -s $optdir/CMF/CMFCalendar .
-ln -s $optdir/DCWorkflow .
+$lnsf $optdir/CMF/CMFCore .
+$lnsf $optdir/CMF/CMFDefault .
+$lnsf $optdir/CMF/CMFTopic .
+$lnsf $optdir/CMF/CMFCalendar .
+$lnsf $optdir/DCWorkflow .
 
 if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
-    ln -s $optdir/DBTab .
+    $lnsf $optdir/DBTab .
 fi
 
 #------------------------------------------------------------------------------
@@ -331,8 +348,8 @@
 #------------------------------------------------------------------------------
 if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
     cd $vardir/zope
-    ln -s Products/DBTab/custom_zodb.py .
-    cat > $etcdir/dbtab.conf << DBTAB_CONF_EOF
+    $lnsf Products/DBTab/custom_zodb.py .
+    $cat > $etcdir/dbtab.conf << DBTAB_CONF_EOF
 [Storage: Main]
 type=ClientStorage
 addr=zeo://localhost:8001
@@ -345,7 +362,7 @@
 mount_paths=/
 open_at_startup=True
 DBTAB_CONF_EOF
-    ln -s $etcdir/dbtab.conf .
+    $lnsf $etcdir/dbtab.conf .
 fi
 
 #------------------------------------------------------------------------------
@@ -353,7 +370,7 @@
 #------------------------------------------------------------------------------
 
 if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
-    cat > $bindir/zeoctl << ZEOCTL_EOF
+    $cat > $bindir/zeoctl << ZEOCTL_EOF
 #!/bin/sh
 #------------------------------------------------------------------------------
 #   Control the  ZEO storage server
@@ -383,11 +400,13 @@
 case "\$1" in
 
 start)
-    start_zeo
+    shift
+    start_zeo $*
     ;;
 
 stop)
-    stop_zeo
+    shift
+    stop_zeo $*
     ;;
 
 restart)
@@ -401,9 +420,9 @@
 esac
 
 ZEOCTL_EOF
-    chmod +x $bindir/zeoctl
+    $chmodx $bindir/zeoctl
 
-    cat > $bindir/zopectl << ZOPECTL_EOF
+    $cat > $bindir/zopectl << ZOPECTL_EOF
 #!/bin/sh
 #------------------------------------------------------------------------------
 #   Control Zope application storage server
@@ -435,11 +454,13 @@
 case "\$1" in
 
 start)
-    start_zope
+    shift
+    start_zope $*
     ;;
 
 stop)
-    stop_zope
+    shift
+    stop_zope $*
     ;;
 
 restart)
@@ -452,12 +473,12 @@
 
 esac
 ZOPECTL_EOF
-    chmod +x $bindir/zopectl
+    $chmodx $bindir/zopectl
 
 else  # Zope 2.7+
 
-    ln -s $vardir/storage/bin/zeoctl .
-    ln -s $vardir/zope/bin/zopectl .
+    $lnsf $vardir/storage/bin/zeoctl .
+    $lnsf $vardir/zope/bin/zopectl .
 
 fi