[Zope-CVS] CVS: Products/OSCOM - buildout_zope_sandbox:1.2

Tres Seaver tseaver@zope.com
Wed, 7 May 2003 14:53:43 -0400


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

Modified Files:
	buildout_zope_sandbox 
Log Message:


  - Extend for multi-platform capability.

  - Extend for multi-version capability.  Note that the build process
    for Zope 2.6.x and Zope 2.7.x is so different that we might be better
    off with entirely separate scripts!


=== Products/OSCOM/buildout_zope_sandbox 1.1 => 1.2 ===
--- Products/OSCOM/buildout_zope_sandbox:1.1	Wed May  7 00:22:47 2003
+++ Products/OSCOM/buildout_zope_sandbox	Wed May  7 14:53:42 2003
@@ -43,40 +43,74 @@
 #
 #     'tmp' -- fetch directory for tarballs.
 #==============================================================================
+PLATFORM=`uname`
+echo Building OSCOM Zope sandbox: PLATFORM is $PLATFORM
 
 #------------------------------------------------------------------------------
 #   Version / repository selectors
 #------------------------------------------------------------------------------
 ZOPE_CVSROOT=:pserver:anonymous@cvs.zope.org:/cvs-repository
 
-PYTHON_VERSION=2.1.3            # XXX 2.2.3?
+PYTHON_VERSION=${PYTHON_VERSION:-2.1.3}           # XXX 2.2.3?
 PYTHON_ORG=http://www.python.org/ftp/python
 PYTHON_SOURCE_URL=$PYTHON_ORG/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz
 
-ZODB3_VERSION=3.1.1              # XXX 3.1.2?
-ZODB3_MODULE=ZODB3
-ZODB3_TAG=ZODB3-3-1-1-final
-
-ZOPE_VERSION=2.6.1              # XXX 2.6.2, 2.7?
+ZOPE_VERSION=${ZOPE_VERSION:-2.6.1}              # XXX 2.6.2, 2.7?
 ZOPE_MODULE=Zope
-ZOPE_TAG=Zope-2-6-1-src
-
-CMF_VERSION=1.3.1               # XXX 1.4?
-CMF_MODULE=CMF
-CMF_TAG=CMF-1_3_1-release
-
-DCWORKFLOW_VERSION=0.5          # XXX not needed for CMF >= 1.4
-DCWORKFLOW_MODULE=CMF/DCWorkflow
-DCWORKFLOW_TAG=DCWorkflow-0_5
 
-DBTAB_VERSION=1.2
-DBTAB_MODULE=Products/DBTab
-DBTAB_TAG=DBTab-1_2
+if [ "$ZOPE_VERSION" == "2.6.1" ]; then
+    ZOPE_TAG=Zope-2-6-1-src
+elif [ "$ZOPE_VERSION" == "head" ]; then
+    ZOPE_TAG=HEAD
+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
+
+    if [ "$ZODB3_VERSION" == "3.1.1" ]; then
+        ZODB3_TAG=ZODB3-3-1-1-final
+    elif [ "$ZODB3_VERSION" == "3.1.2" ]; then
+        ZODB3_TAG=ZODB3-3-1-2-final
+    fi
+fi
 
-PYXML_VERSION=0.8.1             # 0.8.2?
+PYXML_VERSION=${PYXML_VERSION:-0.8.1}             # 0.8.2?
 PYXML_SF_DOWNLOAD=http://aleron.dl.sourceforge.net/sourceforge/pyxml
 PYXML_URL=$PYXML_SF_DOWNLOAD/PyXML-$PYXML_VERSION.tar.gz
 
+CMF_VERSION=${CMF_VERSION:-1.3.1}               # XXX 1.4?
+CMF_MODULE=CMF
+
+if [ "$CMF_VERSION" == "1.3.1" ]; then
+    CMF_TAG=CMF-1_3_1-release
+elif [ "$CMF_VERSION" == "1.4" ]; then
+    CMF_TAG=CMF-1_4-release
+elif [ "$CMF_VERSION" == "1.4beta1" ]; then
+    CMF_TAG=CMF-1_4beta1
+elif [ "$CMF_VERSION" == "head" ]; then
+    CMF_TAG=HEAD
+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
+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
+
+    if [ "$DBTAB_VERSION" == "1.2" ]; then
+        DBTAB_TAG=DBTab-1_2
+    elif [ "$DBTAB_VERSION" == "head" ]; then
+        DBTAB_TAG=HEAD
+    fi
+fi
+
 #------------------------------------------------------------------------------
 #   Build top-level sandbox dirs
 #------------------------------------------------------------------------------
@@ -98,33 +132,85 @@
 #------------------------------------------------------------------------------
 #   Build Python
 #------------------------------------------------------------------------------
+
+PYTHON_CC="gcc"
+PYTHON_CONFIGS="--prefix=$sandbox/opt/Python-$PYTHON_VERSION --with-thread"
+
+if [ "$PLATFORM" == "Linux" ]; then
+PYTHON_CC="gcc -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
+elif [ "$PLATFORM" == "SunOS" ]; then
+PYTHON_CC="gcc `getconf LFS_CFLAGS`"
+elif [ "$PLATFORM" == "Darwin" ]; then
+PYTHON_CC="cc"
+PYTHON_CONFIGS="$PYTHON_CONFIGS --with-dyld --with-suffix"
+fi
+
 cd $tmpdir
 wget --continue $PYTHON_SOURCE_URL
 cd $srcdir
 tar xzf $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
+--- 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
+@@ -10,7 +10,7 @@
+ Initial date: 17-Dec-1998
+ """
+ 
+-__revision__ = "$Id$"
++__revision__ = "$Id$"
+ 
+ import os
+ import re
+@@ -29,13 +29,9 @@
+ 
+ argv0_path = os.path.dirname(os.path.abspath(sys.executable))
+ landmark = os.path.join(argv0_path, "Modules", "Setup")
+-if not os.path.isfile(landmark):
+-    python_build = 0
+-elif os.path.isfile(os.path.join(argv0_path, "Lib", "os.py")):
+-    python_build = 1
+-else:
+-    python_build = os.path.isfile(os.path.join(os.path.dirname(argv0_path),
+-                                               "Lib", "os.py"))
++
++python_build = os.path.isfile(landmark)
++
+ del argv0_path, landmark
+ 
+ # set_python_build() was present in 2.2 and 2.2.1; it's not needed
+PYTHON_222_DISTUTILS_PATCH_EOF
+fi
+
 cd $optdir
 mkdir -p Python-$PYTHON_VERSION/build
 cd Python-$PYTHON_VERSION/build
-$srcdir/Python-$PYTHON_VERSION/configure \
-    --with-threads --prefix=$sandbox
-#    --with-threads --prefix=$optdir/Python-$PYTHON_VERSION
+CC=$PYTHON_CC $srcdir/Python-$PYTHON_VERSION/configure $PYTHON_CONFIGS
 make
 make install
 cd $optdir
 ln -s Python-$PYTHON_VERSION Python2
-#cd $bindir
-#ln -s $optdir/Python2/bin/python .
+cd $bindir
+
+ln -s $optdir/Python2/bin/python .
 
 #------------------------------------------------------------------------------
-#   Install ZODB
+#   Install ZODB (only needed for Zope 2.6.*).
 #------------------------------------------------------------------------------
-cd $srcdir
-cvs -d $ZOPE_CVSROOT co -d ZODB3-$ZODB3_VERSION -r $ZODB3_TAG $ZODB3_MODULE
-cd $optdir
-cp -rs $srcdir/ZODB3-$ZODB3_VERSION .
-ln -s ZODB3-$ZODB3_VERSION ZODB3
-cd ZODB3
-$bindir/python setup.py install
+if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
+    cd $srcdir
+    cvs -d $ZOPE_CVSROOT co -d ZODB3-$ZODB3_VERSION -r $ZODB3_TAG $ZODB3_MODULE
+    cd $optdir
+    cp -rs $srcdir/ZODB3-$ZODB3_VERSION .
+    ln -s ZODB3-$ZODB3_VERSION ZODB3
+    cd ZODB3
+    $bindir/python setup.py install
+fi
 
 #------------------------------------------------------------------------------
 #   Install PyXML
@@ -133,10 +219,10 @@
 wget --continue $PYXML_URL
 cd $srcdir
 tar xzf $tmpdir/PyXML-$PYXML_VERSION.tar.gz
-cd $srcdir/PyXML-$PYXML_VERSION
 #
 #   Work around a bug with Unicode DTD URLs.
 #
+cd $srcdir/PyXML-$PYXML_VERSION
 patch xml/sax/xmlreader.py << PYXML_081_PATCH_EOF
 @@ -221,7 +221,7 @@
  
@@ -160,25 +246,63 @@
 cd $srcdir
 cvs -d $ZOPE_CVSROOT co -d Zope-$ZOPE_VERSION -r $ZOPE_TAG $ZOPE_MODULE
 cd $optdir
-cp -rs $srcdir/Zope-$ZOPE_VERSION .
+if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
+    cp -rs $srcdir/Zope-$ZOPE_VERSION .
+    cd Zope-$ZOPE_VERSION
+    $bindir/python wo_pcgi.py
+    rm inituser
+    echo Removing duplicated ZODB modules and packages.
+    for pkg in 'BTrees' 'Persistence' 'ThreadedAsync' 'zdaemon' 'zLOG' \
+               'ZODB' 'ZopeUndo';
+    do
+        rm -r lib/python/$pkg
+    done
+    for ext in 'Acquisition' 'ComputedAttribute' 'ExtensionClass' \
+               'MethodObject' 'Missing' 'MultiMapping' 'Record' \
+               'Sync' 'ThreadLock';
+    do
+        rm lib/python/$ext.so
+    done
+else
+    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
+fi
+
+cd $optdir
 ln -s Zope-$ZOPE_VERSION Zope
-cd Zope-$ZOPE_VERSION
-$bindir/python wo_pcgi.py
-rm inituser
+
 #
-#   Remove stuff we get from ZODB installed in site-packages.
+#   Build ZEO INSTANCE_HOME
 #
-echo Removing duplicated ZODB modules and packages.
-for pkg in 'BTrees' 'Persistence' 'ThreadedAsync' 'zdaemon' 'zLOG' \
-           'ZODB' 'ZopeUndo';
-do
-    rm -r lib/python/$pkg
-done
-for ext in 'Acquisition' 'ComputedAttribute' 'ExtensionClass' 'MethodObject' \
-             'Missing' 'MultiMapping' 'Record' 'Sync' 'ThreadLock';
-do
-    rm lib/python/$ext.so
-done
+if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
+    cd $vardir
+    mkdir -p storage/var
+else
+    cd $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 .
+fi
+
+#
+#   Build Zope INSTANCE_HOME
+#
+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.
+    $bindir/python $optdir/Zope/zpasswd.py $vardir/zope/inituser
+else
+    cd $optdir/Zope-$ZOPE_VERSION
+    bin/mkzopeinstance --zeo localhost:8001 $vardir/zope
+    cd $etcdir
+    ln -s $vardir/storage/etc/zope.conf .
+fi
 
 #------------------------------------------------------------------------------
 #   Fetch products.
@@ -189,32 +313,22 @@
 cp -rs $srcdir/CMF-$CMF_VERSION .
 ln -s CMF-$CMF_VERSION CMF
 
-cd $srcdir
-cvs -d $ZOPE_CVSROOT co -d DCWorkflow-$DCWORKFLOW_VERSION \
-                        -r $DCWORKFLOW_TAG $DCWORKFLOW_MODULE
-cd $optdir
-cp -rs $srcdir/DCWorkflow-$DCWORKFLOW_VERSION .
-ln -s DCWorkflow-$DCWORKFLOW_VERSION DCWorkflow
-
-cd $srcdir
-cvs -d $ZOPE_CVSROOT co -d DBTab-$DBTAB_VERSION -r $DBTAB_TAG $DBTAB_MODULE
-cd $optdir
-cp -rs $srcdir/DBTab-$DBTAB_VERSION .
-ln -s DBTab-$DBTAB_VERSION DBTab
-
-#------------------------------------------------------------------------------
-#   Build ZEO INSTANCE_HOME
-#------------------------------------------------------------------------------
-cd $vardir
-mkdir -p storage/var
-
-#------------------------------------------------------------------------------
-#   Build Zope INSTANCE_HOME
-#------------------------------------------------------------------------------
-cd $vardir
-mkdir -p zope/var zope/Products zope/import zope/Extensions
-echo Creating initial "manager" account.
-$bindir/python $optdir/Zope/zpasswd.py $vardir/zope/inituser
+if [ "$CMF_VERSION" == "1.3.1" ]; then
+    cd $srcdir
+    cvs -d $ZOPE_CVSROOT co -d DCWorkflow-$DCWORKFLOW_VERSION \
+                            -r $DCWORKFLOW_TAG $DCWORKFLOW_MODULE
+    cd $optdir
+    cp -rs $srcdir/DCWorkflow-$DCWORKFLOW_VERSION .
+    ln -s 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
+    cd $optdir
+    cp -rs $srcdir/DBTab-$DBTAB_VERSION .
+    ln -s DBTab-$DBTAB_VERSION DBTab
+fi
 
 #------------------------------------------------------------------------------
 #   Install products
@@ -225,14 +339,18 @@
 ln -s $optdir/CMF/CMFTopic .
 ln -s $optdir/CMF/CMFCalendar .
 ln -s $optdir/DCWorkflow .
-ln -s $optdir/DBTab .
+
+if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
+    ln -s $optdir/DBTab .
+fi
 
 #------------------------------------------------------------------------------
 #   Set up DBTab
 #------------------------------------------------------------------------------
-cd $vardir/zope
-ln -s Products/DBTab/custom_zodb.py .
-cat > $etcdir/dbtab.conf << DBTAB_CONF_EOF
+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
 [Storage: Main]
 type=ClientStorage
 addr=zeo://localhost:8001
@@ -245,21 +363,23 @@
 mount_paths=/
 open_at_startup=True
 DBTAB_CONF_EOF
-ln -s $etcdir/dbtab.conf .
+    ln -s $etcdir/dbtab.conf .
+fi
 
 #------------------------------------------------------------------------------
 #   Set up start / stop scripts
 #------------------------------------------------------------------------------
 cd $bindir
 
-sed -e "s#<<SANDBOX>>#$sandbox#" > start_zeo << START_ZEO_EOF
+if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
+    sed -e "s#<<SANDBOX>>#$sandbox#" > start_zeo << START_ZEO_EOF
 #!/bin/sh
 #------------------------------------------------------------------------------
 #   Start ZEO storage server
 #------------------------------------------------------------------------------
 zeo_port=8001
 python=<<SANDBOX>>/bin/python
-zeo_start=<<SANDBOX>>/lib/python2.1/site-packages/ZEO/start.py
+zeo_start=<<SANDBOX>>/opt/Python2/lib/python2.1/site-packages/ZEO/start.py
 
 INSTANCE_HOME=<<SANDBOX>>/var/storage
 export INSTANCE_HOME
@@ -267,9 +387,9 @@
 echo \$python \$zeo_start -p \$zeo_port "\$@"
 \$python \$zeo_start -p \$zeo_port "\$@"
 START_ZEO_EOF
-chmod +x start_zeo
+    chmod +x start_zeo
 
-sed -e "s#<<SANDBOX>>#$sandbox#" > stop_zeo << STOP_ZEO_EOF
+    sed -e "s#<<SANDBOX>>#$sandbox#" > stop_zeo << STOP_ZEO_EOF
 #!/bin/sh
 #------------------------------------------------------------------------------
 #   Stop ZEO storage server
@@ -279,9 +399,9 @@
 echo kill "\$@" \$pid
 kill "\$@" \$pid
 STOP_ZEO_EOF
-chmod +x stop_zeo
+    chmod +x stop_zeo
 
-sed -e "s#<<SANDBOX>>#$sandbox#" > start_zope << START_ZOPE_EOF
+    sed -e "s#<<SANDBOX>>#$sandbox#" > start_zope << START_ZOPE_EOF
 #!/bin/sh
 #------------------------------------------------------------------------------
 #   Start Zope application storage server
@@ -299,9 +419,9 @@
 echo \$python \$zope_start -X -w \$www_port "\$@"
 \$python \$zope_start -X -w \$www_port "\$@"
 START_ZOPE_EOF
-chmod +x start_zope
+    chmod +x start_zope
 
-sed -e "s#<<SANDBOX>>#$sandbox#" > stop_zope << STOP_ZOPE_EOF
+    sed -e "s#<<SANDBOX>>#$sandbox#" > stop_zope << STOP_ZOPE_EOF
 #!/bin/sh
 #------------------------------------------------------------------------------
 #   Stop Zope application server
@@ -311,12 +431,24 @@
 echo kill "\$@" \$pid
 kill "\$@" \$pid
 STOP_ZOPE_EOF
-chmod +x stop_zope
+    chmod +x stop_zope
+
+else  # Zope 2.7+
+
+    ln -s $vardir/storage/bin/zeoctl .
+    ln -s $vardir/zope/bin/zopectl .
+
+fi
 
 #------------------------------------------------------------------------------
 #   Start the storage and the appserver
 #------------------------------------------------------------------------------
 cd $sandbox
 
-$bindir/start_zeo
-$bindir/start_zope
+if [ "$ZOPE_VERSION" == "2.6.1" -o "$ZOPE_VERSION" == "2.6.2" ]; then
+    $bindir/start_zeo
+    $bindir/start_zope
+else
+    $bindir/zeoctl start
+    $bindir/zopectl start
+fi