[zopeorg-checkins] CVS: NZO_SiteLayout - Makefile.zss:1.1 ZopeCtl.py:1.1 cvs.mk:1.3 tools.mk:1.2 zeo_recipes.mk:1.2 zeo_targets.mk:1.2 zss_recipes.mk:1.2 zss_targets.mk:1.2

Tres Seaver tseaver at zope.com
Mon Apr 29 16:02:33 EDT 2002


Update of /cvs-zopeorg/NZO_SiteLayout
In directory cvs.zope.org:/tmp/cvs-serv10187

Modified Files:
	cvs.mk tools.mk zeo_recipes.mk zeo_targets.mk zss_recipes.mk 
	zss_targets.mk 
Added Files:
	Makefile.zss ZopeCtl.py 
Log Message:
 - Add buildout for storage server.

=== Added File NZO_SiteLayout/Makefile.zss ===
########################################################################
#   Skeleton makefile for CVS-driven buildout
########################################################################

#-----------------------------------------------------------------------
#   Tools
#   =====
#
#   This section includes defines for all the standard tools used to
#   build out the site.
#
#   Edit 'tools.mk' to accomodate the locations of the utilities on your
#   system (defaults are for stock RedHat installs).
#-----------------------------------------------------------------------
include tools.mk

#-----------------------------------------------------------------------
#   CVS dependencies
#   ================
#
#   This section includes defines for all CVS checkouts needed to build
#   out the site, including repositories, module names, and tags for
#   each unique version.
#
#   Edit 'cvs.mk' to make a new revision available, or to retire old
#   ones.
#-----------------------------------------------------------------------
include cvs.mk

#-----------------------------------------------------------------------
#   Version selectors
#   =================
#
#   This section identifies the specific source revisions of the
#   packages used to build the site.
#
#   Modify the defines below to select a different revision from the
#   list called out in 'cvs.mk'.  You may also remove unneeded entries
#   (e.g., 'Makefile.squid' should only need the 'SQUID_CHECKOUT'
#   define).
#-----------------------------------------------------------------------
PYTHON_CHECKOUT=src/Python-2.1.3
ZEO_CHECKOUT= src/StandaloneZODB-1.0-final

#-----------------------------------------------------------------------
#   Package-specific targets
#   ========================
#
#   The includes in this section import targets for each package and
#   configuration used to build out the site.
#
#   Add or remove imports from this section to correspond to the
#   software needed to build a particular server instance.
#-----------------------------------------------------------------------
include python_targets.mk
include zeo_targets.mk
include zss_targets.mk

#-----------------------------------------------------------------------
#   Target selectors
#
#   Add / remove here as appropriate.
#-----------------------------------------------------------------------
SRC_TARGETS=\
${PYTHON_CHECKOUT} \
${ZEO_CHECKOUT} \

OPT_TARGETS=\
${PYTHON_OPT_TARGETS} \
${ZEO_OPT_TARGETS} \

BIN_TARGETS=\
${PYTHON_BIN_TARGETS} \
${ZSS_BIN_TARGETS} \

ETC_TARGETS=\
${ZSS_ETC_TARGETS} \

VAR_TARGETS=\
${ZSS_VAR_TARGETS}\

USAGE_TARGETS=\
python_usage \
zeo_usage \

DOC_TARGETS=\
${PYTHON_DOC_TARGETS} \
${ZEO_DOC_TARGETS} \
${ZSS_DOC_TARGETS}\

include standard_targets.mk

#=======================================================================
#   Recipes
#=======================================================================

include python_recipes.mk
include zeo_recipes.mk
include zss_recipes.mk

#-----------------------------------------------------------------------
#	Generic rules
#-----------------------------------------------------------------------

${BASE_DIR}/src:
	${MKDIR} ${BASE_DIR}/src


=== Added File NZO_SiteLayout/ZopeCtl.py === (670/770 lines abridged)
"""
    Generic Zope controller.
"""

import getopt

def normalizeDocstring( bound_method ):

    doc = bound_method.__doc__
    lines = doc.split( '\n' )
    lines = [ line.strip() for line in lines ]
    return '\n'.join( lines )

class ZopeCtl:
    """
        Workhorse engine for controlling the appserver.
    """
    _env            = None
    _opts           = None
    _storage        = None


    def __init__( self, reporter, base_dir, conf_file='/etc/zope.conf' ):
        self._reporter = reporter
        self._base_dir = base_dir
        self._config_file = base_dir + conf_file

    #
    #   Command implementation
    #
    def start( self, arg ):
        """
            Start the Zope appserver.

            Syntax:  start [z2_options]

            All options are passed to the z2 command line.
        """
        # XXX:    We currently do this by using os.system to run z2.py;
        #           a better implementation would just fork and start
        #           Zope using config file info.

        self._setupEnvironment( with_stupid_log=1 )

        import sys
        cmdline = '%s %s/z2.py %s %s' % ( sys.executable
                                        , self._env[ 'ZOPE_HOME' ]
                                        , self._buildCommandLine()
                                        , arg
                                        ) 

[-=- -=- -=- 670 lines omitted -=- -=- -=-]

        self._report( 'Status:' )
        self._report()

        pids = [ str( pid ) for pid in self._getPIDs( 'storage_server_pid' ) ]

        import os
        from types import TupleType, ListType

        pstat = []
        for pid in pids:    # XXX:  Linuxism, not even portable there!

            procdir = '/proc/%s' % pid
            alive = os.access( procdir, os.F_OK )
            ours = alive and os.access( procdir, os.X_OK )
            status = (ours and 'OK') or ( (alive and 'foreign') or 'dead' )
            pstat.append( '%5s (%s)' % ( pid, status ) )

        self._report( '  %-20s : %s' % ( 'PIDS', ' '.join( pstat ) ) )

        for key, name in ( ( 'zeo_port', 'ZEO' )
                         , 
                         ):

            ports = self._opts.get( key )
            if ports is not None:

                if type( ports ) is type( '' ):
                    ports = ports.split()

                if type( ports ) not in ( TupleType, ListType ):
                    ports = [ ports ]

                pstat = []

                for port in ports:
                    ok = self._checkService( 'localhost', port )
                    status = ok and 'OK' or 'dead'
                    pstat.append( '%5s (%s)' % ( port, status ) )

                self._report( '  %-20s : %s' % ( '%s ports' % name
                                               , ' '.join( pstat ) ) )

    def _setupEnvironment( self, with_stupid_log=0 ):

        ZopeCtl._setupEnvironment( self, with_stupid_log )

        pidfile = self._opts.get( 'storage_server_pid' )
        if pidfile:
            import os
            os.environ[ 'ZEO_SERVER_PID' ] = pidfile


=== NZO_SiteLayout/cvs.mk 1.2 => 1.3 ===
 src/ZEO-1.0-head: CVS_TAG=-r zeo-1_0-branch
 
+src/StandaloneZODB-1.0-final: CVS_REPOSITORY=${ZOPE_CVS_REPOSITORY}
+src/StandaloneZODB-1.0-final: CVS_MODULE=StandaloneZODB
+src/StandaloneZODB-1.0-final: CVS_TAG=-r StandaloneZODB-1_0-final
+
 #   CMF versions
 
 src/CMF-1.3: CVS_REPOSITORY=${ZOPE_CVS_REPOSITORY}


=== NZO_SiteLayout/tools.mk 1.1.1.1 => 1.2 ===
 SED=/bin/sed
 CHMOD=/bin/chmod
+SUDO=sudo
+CHOWN=/bin/chown
 
 #
 #   We may have to arrange to get these built on some systems.


=== NZO_SiteLayout/zeo_recipes.mk 1.1.1.1 => 1.2 ===
 #
 #     - ZEO_CHECKOUT should be set to the version-qualified name, under
-#       'src', of the ZEO software package, e.g.  'src/ZEO-1.0-head'.
+#       'src', of the StandaloneZODB software package, e.g.
+#       'src/StandaloneZODB-1.0-final'.
 #       This value is normally spelled out in the main makefile, and
 #       must correspond to one of the checkouts in 'cvs.mk'.
 #
@@ -18,27 +19,34 @@
 	${CD} ${BASE_DIR}/src \
       && ${CVS} -d ${CVS_REPOSITORY} checkout ${CVS_TAG} -d ${@F} ${CVS_MODULE}
 
-ZEO_CHANGES_SRC=${ZEO_CHECKOUT:%=%/CHANGES.txt}
+ZEO_SETUP_SRC=${ZEO_CHECKOUT:%=%/setup.py}
 
-${ZEO_CHANGES_SRC}: %/CHANGES.txt : %
+${ZEO_SETUP_SRC}: %/setup.py : %
 
 ZEO_BUILD=${ZEO_CHECKOUT:src/%=opt/%}
 
-ZEO_CHANGES=${ZEO_BUILD:%=%/CHANGES.txt}
+ZEO_SETUP=${ZEO_BUILD:%=%/setup.py}
 
-${ZEO_BUILD}: % : %/CHANGES.txt
+${ZEO_BUILD}: % : %/setup.py
 
-${ZEO_CHANGES}: opt/%: src/%
+${ZEO_SETUP}: opt/%: src/%
 	${RM} ${@D}
 	${MKDIR} ${@D}
 	${COPY_FROM_SRC} ${BASE_DIR}/${<D} ${BASE_DIR}/${@D}
 
-opt/ZEO: ${ZEO_BUILD}
+opt/StandaloneZODB: ${ZEO_BUILD}
 	${CD} ${BASE_DIR}/${@D} && ${LNSF} ${<F} ${@F}
 
-opt/ZEO/CHANGES.txt: ${ZEO_CHANGES} opt/ZEO
+opt/StandaloneZODB/setup.py: ${ZEO_SETUP} opt/StandaloneZODB
 
-zeo: opt/ZEO/CHANGES.txt
+opt/Python2/lib/python2.1/site-packages/Acquisition.so: opt/StandaloneZODB/setup.py
+	${CD} ${BASE_DIR}/opt/StandaloneZODB && \
+		${BASE_DIR}/bin/python setup.py build
+	${CD} ${BASE_DIR}/opt/StandaloneZODB && \
+		${BASE_DIR}/bin/python setup.py install
+
+zeo: opt/StandaloneZODB/setup.py \
+     opt/Python2/lib/python2.1/site-packages/Acquisition.so
 
 zeo_usage:
 	@${ECHO} "   zeo -- Build ZEO pseudo-binary."


=== NZO_SiteLayout/zeo_targets.mk 1.1.1.1 => 1.2 ===
-#	Standard Python targets
-#=======================================================================
-
-PYTHON_OPT_TARGETS=\
-opt/Python2 \
-
-PYTHON_BIN_TARGETS=\
-bin/python
-
-#=======================================================================
-#	Standard Zope targets
-#=======================================================================
-
-ZOPE_OPT_TARGETS=\
-opt/Zope \
-opt/Zope/start \
-
-#=======================================================================
-#	Standard ZEO package targets
+#	StandaloneZODB package targets
 #=======================================================================
 
 ZEO_OPT_TARGETS=\
-opt/ZEO \
-
-#=======================================================================
-#	Standard CMF Package targets
-#=======================================================================
-
-CMF_OPT_TARGETS=\
-opt/CMF \
-
-#=======================================================================
-#	Standard Zope Appserver (ZAS) targets
-#=======================================================================
-
-ZAS_BIN_TARGETS=\
-bin/zopectl \
-
-ZAS_ETC_TARGETS=\
-etc/zope.conf \
-
-ZAS_VAR_TARGETS=\
-var/zope/custom_zodb.py \
-var/zope/var/Z2.pid \
-
-#=======================================================================
-#	Standard ZEO Storage Server (ZSS) targets
-#=======================================================================
-
-ZSS_BIN_TARGETS=\
-bin/zeoctl \
-
-ZSS_ETC_TARGETS=\
-etc/zeo.conf \
-
-ZEO_INSTANCE_TARGETS=\
-var/zeo/var/Data.fs
-
-#=======================================================================
-#	Standard Squid targets
-#=======================================================================
-
-SQUID_OPT_TARGETS=\
-opt/Squid \
-
-SQUID_BIN_TARGETS=\
-bin/squid \
-bin/squidctl \
-
-SQUID_ETC_TARGETS=\
-etc/squid.conf \
-etc/mime.conf \
-
-SQUID_VAR_TARGETS=\
-var/squid/squid.pid \
-var/squid/cache \
+opt/StandaloneZODB \
+opt/Python2/lib/python2.1/site-packages/Acquisition.so \


=== NZO_SiteLayout/zss_recipes.mk 1.1.1.1 => 1.2 ===
 AFTERCREATE=${TRUE}
 
-bin/zeoctl: ${MAKEFILEDIR}/bin/zeoctl.in
-bin/zeoctl: AFTERCREATE=${CHMOD} u+x $@
+${ZSS_SCRIPTS}: AFTERCREATE=${CHMOD} u+x $@
 
-etc/zeo.conf: etc/%.conf : ${MAKEFILEDIR}/etc/%.conf.in
+${ZSS_SCRIPTS}: bin/%: ${MAKEFILEDIR}/bin/%.in
+bin/zeoctl: opt/Python2/lib/python2.1/site-packages/ZopeCtl.py
 
-bin/zeoctl \
-etc/zeo.conf:
+opt/Python2/lib/python2.1/site-packages/ZopeCtl.py: ${MAKEFILEDIR}/ZopeCtl.py
+	${MKDIR} ${BASE_DIR}/${@D}
+	${CP} $< $@
+
+etc/zeo.conf: etc/%: ${MAKEFILEDIR}/etc/%.in
+
+${ZSS_SCRIPTS} etc/zeo.conf:
 	${MKDIR} ${BASE_DIR}/${@D}
 	${CP} $< $@
 	${MKDIR} ${@D}
 	${SED} ${SEDSCRIPT} < $< > $@
 	${AFTERCREATE}
+
+var/ZEOStorage/Data.fs: bin/python bin/zeoctl etc/zeo.conf #bin/initdlinks.sh
+	# ${LNSF} ${BASE_DIR}/share/InstanceProducts ${BASE_DIR}/var/ZEOStorage/Products
+	#${SUDO} ${MKDIR} ${LOG_DIR} && ${SUDO} ${CHOWN} zope.zope ${LOG_DIR}
+	#${SUDO} ${BASE_DIR}/bin/initdlinks.sh
+	#${RM} ${BASE_DIR}/log
+	#${LNSF} /var/log/zc ${BASE_DIR}/log
+	${MKDIR} ${BASE_DIR}/${@D}
+	${BASE_DIR}/bin/zeoctl start
+
+ALL_ZSS_TARGETS =\
+${ZSS_OPT_TARGETS} \
+${ZSS_BIN_TARGETS} \
+${ZSS_ETC_TARGETS} \
+${ZSS_VAR_TARGETS} \
+
+zss : zeo ${ALL_ZSS_TARGETS}


=== NZO_SiteLayout/zss_targets.mk 1.1.1.1 => 1.2 ===
 #=======================================================================
 
-ZSS_BIN_TARGETS=\
+ZSS_SCRIPTS=\
 bin/zeoctl \
 
+ZSS_BIN_TARGETS=\
+${ZSS_SCRIPTS} \
+
 ZSS_ETC_TARGETS=\
 etc/zeo.conf \
+
+ZSS_VAR_TARGETS=\
+var/ZEOStorage/Data.fs \






More information about the zopeorg-checkins mailing list