[Zope-Checkins] CVS: Zope/inst - zope.conf.in:1.1.2.1 zopectl.in:1.1.2.1 configure.py:1.1.2.2 make_instance.py:1.3.4.2 zctl.py.in:NONE

Chris McDonough chrism@zope.com
Mon, 26 Aug 2002 02:23:07 -0400


Update of /cvs-repository/Zope/inst
In directory cvs.zope.org:/tmp/cvs-serv29520/inst

Modified Files:
      Tag: chrism-install-branch
	configure.py make_instance.py 
Added Files:
      Tag: chrism-install-branch
	zope.conf.in zopectl.in 
Removed Files:
      Tag: chrism-install-branch
	zctl.py.in 
Log Message:
More work on my Zope2 installer branch.  The branch is fully functional
at this point, at least on Linux (try it!).  The goal is to allow
a './configure; make; make install' Zope source installation possible. 

- The 'configure' step now checks for large file support
  and will only allow configuration to continue if you
  say "yes, I want to screw myself later." ;-)

- Replaced 'zctl' with Tres' 'zopectl'.  In the process,
  refactored zopectl so that it uses a Squid-like config file.
  The config file consists of "directives", each of
  which has a particular set of possible values explained
  in the config file.  The config file provides a uniform
  front-end to the mish-mash of environment variables
  and command-line switches that you normally need to
  deal with when you configure a Zope instance.

- Created a new package in software_home named Controller
  which holds the zctl libraries and some useful scripts
  to create directives.

- Merged HEAD changes onto branch.



=== Added File Zope/inst/zope.conf.in === (766/866 lines abridged)
###############################################################################
# Welcome to Zope 2.
###############################################################################

# This is the default Zope configuration file.  The default Zope configuration
# file shows what the default configuration directives are, and show examples
# for each directive.  To declare a directive, make sure that you add it
# to a line that does not begin with "#".

# Directive: software_home
#
# Description:
#     The path to the majority of the Python software files used by Zope.
#
# Influences: SOFTWARE_HOME environment variable
#
# Default: none
#
# Example:
#
#    software_home /home/chrism/software/Trunk/lib/python
#

# Directive: instance_home
#
# Description:
#     The path to the data files, local product files, import directory,
#     and Extensions directory used by Zope. One software_home can support
#     many instance_homes.
#
# Influences: INSTANCE_HOME environment variable
#
# Default: none
#
# Example:
#
#    instance_home /home/chrism/projects/sessions
#

# Directive: zope_home
#
# Description:
#     The 'top-level' Zope software directory (home of the ZServer
#     directory, the doc directory, the utilities directory, etc.)
#
# Influences: ZOPE_HOME environment variable
#
# Default: none (required)
#
# Example:

[-=- -=- -=- 766 lines omitted -=- -=- -=-]

# Directive: database_quota_size
#
# Description:
#     Set this directive to an integer in bytes in order to place a hard
#     limit on the size which the default FileStorage-backed Zope database
#     can grow. Additions to the database will not be permitted once this
#     filesize is exceeded.
#
# Influences: ZOPE_DATABASE_QUOTA environment variable
#
# Default: unset
#
# Example:
#
#    database_quota_size 1000000
#


# Directive: read_only_database
#
# Description:
#     This causes the main Zope FileStorage-backed ZODB to be opened in
#     read-only mode.
#
# Influences: ZOPE_READ_ONLY environment variable
#
# Default: off
#
# Example:
#
#    read_only_database on
#


# Directive: zeo_client_name
#
# Description:
#     Provide a string value to uniquely identify the local cache files
#     created if this Zope is a ZEO client. Setting this directive implies
#     setting 'inhibit_product_installation' to 'on' if
#     'inhibit_product_installation' is left unset.
#
# Influences: ZEO_CLIENT environment variable
#
# Default: unset
#
# Example:
#
#    zeo_client_name zeo1
#


=== Added File Zope/inst/zopectl.in ===
#!%(python)s
"""
    Zope appserver controller.
"""
import os, sys
SOFTWARE_HOME = '%(software_home)s/lib/python'

USAGE = """\

zopectl:  Zope appserver controller

Usage:
    zopectl [--config=filepath] [commands*]

Options:
    --config    Use an alternate configuration file.  Default: 'zope.conf'

Commands:
    help [<command>]
    start
    stop
    restart
    logrotate
    status
    show [<info>*]
    run <script_filename>
    debug

    If no commands supplied, runs as an interactive read-eval-print
    interpreter.
"""
sys.path.insert(0, SOFTWARE_HOME)
from Controller.ZopeCtl import ZopeCtl, normalizeDocstring

#
#   Read-eval-print interpreter
#
def _MAKEDO( command ):
    """
        Work around insistence of 'Cmd.help' on printing docstrings with
        full indentation;  we fabricate a function which has the docstring
        it expects, using the one from ZopeCtl as a starting point;
        the generated function is suitable for use as 'do_command' within
        the Cmd-derived class.
    """

    def xdo( self, args=None, command=command ):
        getattr( self._engine, command )( args )

    xdo.func_doc = normalizeDocstring( getattr( ZopeCtl, command ) )
        
    return xdo

import cmd

class _ZopeCtlCmd( cmd.Cmd ):
    """
        Interactive command processor.
    """
    def __init__( self, prompt='zopectl> ', verbosity=1 ):

        self._engine    = ZopeCtl( self._report )
        self.prompt     = prompt
        self._verbosity = verbosity

    def _report( self, msg='', level=1 ):

        if self._verbosity >= level:
            print msg

    def default( self, line ):

        if line == 'EOF':
            self._report()
            return 1

        try:
            tokens = line.split()
            method, args = tokens[0], ' '.join( tokens[1:] )
            method = getattr( self._engine, method, None )
            if method is not None:
                method( args )
                return None
        except:
            pass

        return cmd.Cmd.default( self, line )

    do_start         = _MAKEDO( 'start' )
    do_start         = _MAKEDO( 'start' )
    do_restart       = _MAKEDO( 'restart' )
    do_logopenclose  = _MAKEDO( 'logopenclose' )
    do_logtail       = _MAKEDO( 'logtail' )
    do_stop          = _MAKEDO( 'stop' )
    do_status        = _MAKEDO( 'status' )
    do_show          = _MAKEDO( 'show' )
    do_run           = _MAKEDO( 'run' )
    do_debug         = _MAKEDO( 'debug' )
    do_quit          = _MAKEDO( 'quit' )
    do_set           = _MAKEDO( 'set'  )

    #
    #   Command-line processing
    #
    def usage( self ):

        import sys

        self._report( USAGE )

        sys.exit( 2 )

    def main( self ):

        import sys
        import os
        import getopt

        try:
            options, args = getopt.getopt( sys.argv[1:], '', [ 'config=' ] )
        except getopt.GetoptError:
            self.usage()
        
        for k, v in options:

            if k == '--config':
                self._engine._setConfigFile( os.path.normpath( v ) )
            else:
                usage()

        if args:
            self.cmdqueue.append( ' '.join( args ) )
            self.cmdqueue.append( 'EOF' )

        self.cmdloop()

if __name__ == '__main__':

    _ZopeCtlCmd().main()


=== Zope/inst/configure.py 1.1.2.1 => 1.1.2.2 ===
--- Zope/inst/configure.py:1.1.2.1	Thu Aug 22 00:30:16 2002
+++ Zope/inst/configure.py	Mon Aug 26 02:22:36 2002
@@ -18,17 +18,15 @@
 """
 import getopt, sys, os
 
-SOFTWARE_HOME   = '/usr/local/zope'
-INSTANCE_HOME = SOFTWARE_HOME
-PYTHON          = sys.executable
-
-MAKEINSTANCE = """#!/bin/sh
-%(python)s %(software_home)s/inst/make_instance.py
+ZOPE_HOME     = '/usr/local/zope'
+PYTHON        = sys.executable
+MAKEINSTANCE  = """#!/bin/sh
+%(python)s %(zope_home)s/inst/make_instance.py
 """
 
 MAKEFILE = """
 PYTHON=%(python)s
-SOFTWARE_HOME=%(software_home)s
+ZOPE_HOME=%(zope_home)s
 BUILD_DIR=$(shell pwd)
 CPRU=/bin/cp -r -u
 MKDIR=/bin/mkdir -p
@@ -42,28 +40,22 @@
 build:
 	${PYTHON} ${BUILD_DIR}/inst/compile_all.py
 	${TOUCH} ${BUILD_DIR}/build
-	@echo Zope built.  Next, do \'make install\'.
+	@echo
+	@echo Zope built.  Next, do \\'make install\\'.
 
 install: build
-	${MKDIR} ${SOFTWARE_HOME}
-	${CPRU} ${BUILD_DIR}/* ${SOFTWARE_HOME}
-	${RM} ${SOFTWARE_HOME}/Makefile
-	${RM} ${SOFTWARE_HOME}/configure
-	${RM} ${SOFTWARE_HOME}/stupid_clean
-	${RM} ${SOFTWARE_HOME}/w_pcgi.py
-	${RM} ${SOFTWARE_HOME}/wo_pcgi.py
-	${RM} ${SOFTWARE_HOME}/setup.py
-	${RM} ${SOFTWARE_HOME}/*.py[co]
-	${RM} ${SOFTWARE_HOME}/build
-	${RM} ${SOFTWARE_HOME}/start
-	${RM} ${SOFTWARE_HOME}/stop
-	${RM} ${SOFTWARE_HOME}/inituser
-	${FIND} ${SOFTWARE_HOME} -name "CVS" | ${XARGS} rm -rf
+	${MKDIR} ${ZOPE_HOME}
+	${CPRU} ${BUILD_DIR}/* ${ZOPE_HOME}
+	${RM} ${ZOPE_HOME}/{Makefile,configure,stupid_clean}
+	${RM} ${ZOPE_HOME}/{w_pcgi.py,wo_pcgi.py,setup.py}
+	${RM} ${ZOPE_HOME}/{start,stop,build,inituser}
+	${RM} ${ZOPE_HOME}/*.py[co]
+	@echo
 	@echo Zope binaries installed successfully.
-	@echo Now run \"${SOFTWARE_HOME}/makeinstance.\"
+	@echo Now run \"${ZOPE_HOME}/makeinstance.\"
 
 uninstall:
-	${RM} ${SOFTWARE_HOME}
+	${RM} ${ZOPE_HOME}
 
 clean:
 	${FIND} ${BUILD_DIR} -name '*.o' -o -name '*.so' -o -name '*.py[co]' \
@@ -72,33 +64,39 @@
 """
 
 def main():
-    software_home = SOFTWARE_HOME
+    REQUIRE_LF_ENABLED = 1
+    zope_home = ZOPE_HOME
     python = PYTHON
     try:
-        longopts = ["help", "prefix="]
+        longopts = ["help", "ignore-no-largefile", "prefix="]
         opts, args = getopt.getopt(sys.argv[1:], "h", longopts)
     except getopt.GetoptError, v:
         print v
         usage()
         sys.exit(1)
-    print "\nConfiguring..."
     for o, a in opts:
         if o in ('-h', '--help'):
             usage()
             sys.exit()
         if o == '--prefix':
-            software_home=a
-    print "  SOFTWARE_HOME (Zope binary directory) will be %s." % software_home
-    opts = {'python':python,'software_home':software_home}
+            zope_home=a
+        if o == "--ignore-largefile":
+            REQUIRE_LF_ENABLED=0
+    if REQUIRE_LF_ENABLED:
+        test_largefile()
+    print "  - Zope top-level binary directory will be %s." % zope_home
+    opts = {'python':python,'zope_home':zope_home}
     mf = MAKEFILE % opts
     f = open('Makefile', 'w')
     f.write(mf)
-    print "  Makefile written."
+    print "  - Makefile written."
     mi = MAKEINSTANCE % opts
     f = open('makeinstance', 'w')
     f.write(mi)
     os.chmod('makeinstance', 0755)
-    print "  'makeinstance' script written."
+    print "  - 'makeinstance' script written."
+    print
+    print "  Next, run 'make'."
     print
 
 def usage():
@@ -108,18 +106,46 @@
 Defaults for options are specified in brackets.
 
 Configuration:
-  -h, --help            display this help and exit
+
+  -h, --help                    display this help and exit
+
+Options:
+
+  --ignore-largefile            allow configuration to proceed without
+                                Python large file support.
 
 Installation directories:
 
-  --prefix=DIR      install Zope SOFTWARE_HOME files in DIR [%(software_home)s]
+  --prefix=DIR                  install Zope files in DIR [%(zope_home)s]
 
-By default, 'make install' will install Zope SOFTWARE_HOME  files in
-'%(software_home)s'  You can specify an alternate SOFTWARE_HOME location by
-using '--prefix', for example: '--prefix=$HOME/zope'.
-""" % ({'program':sys.argv[0], 'software_home':SOFTWARE_HOME})
+By default, 'make install' will install Zope software files in
+'%(zope_home)s'  You can specify an alternate location for these
+files by using '--prefix', for example: '--prefix=$HOME/zope'.
+""" % ({'program':sys.argv[0], 'zope_home':ZOPE_HOME})
              )
     print usage
+
+def test_largefile():
+    OK=0
+    f = open(sys.argv[0], 'r')
+    try:
+        # 2**31 == 2147483648
+        f.seek(2147483649L)
+        f.close()
+        OK=1
+    except (IOError, OverflowError):
+        f.close()
+    if OK:
+        return
+    print ("This Python interpreter does not have 'large file support'"
+           "enabled.  Large file support is required to allow the default"
+           "Zope database to grow larger than 2GB.  Either install a Python "
+           "interpreter with large file support"
+           "(see http://www.python.org/doc/current/lib/posix-large-files.html)"
+           "or run %s again with the --ignore-largefile option to proceed"
+           "ignoring this warning and accepting the consequences." %
+           sys.argv[0])
+    sys.exit(127)
 
 if __name__ == '__main__':
     main()


=== Zope/inst/make_instance.py 1.3.4.1 => 1.3.4.2 ===
--- Zope/inst/make_instance.py:1.3.4.1	Thu Aug 22 00:30:16 2002
+++ Zope/inst/make_instance.py	Mon Aug 26 02:22:36 2002
@@ -89,7 +89,7 @@
     print
     sys.path.insert(0, home)
     choose_inituser(ih)
-    print 'Done!  Use "%s/zctl.py start" to start Zope.' % ih
+    print 'Done!  Use "%s/zopectl start" to start Zope.' % ih
 
 def choose_inituser(home):
     ac_path=os.path.join(home, 'inituser')

=== Removed File Zope/inst/zctl.py.in ===