Request 271 was acted upon.
_________________________________________________________________________

         URL: https://rt.openpkg.org/id/271
      Ticket: [OpenPKG #271]
     Subject: [zope] Updated package spec
  Requestors: [EMAIL PROTECTED]
       Queue: openpkg
       Owner: Nobody
      Status: new
 Transaction: Ticket created by [EMAIL PROTECTED]
        Time: Fri Sep 26 05:23:16 2003
_________________________________________________________________________

I have tinkered with an updated version of the OpenPKG package for
Zope 2.6.2.  Attached find:

  - zope.conf:  the only issue I have with the RPM is that the
    permissions on the data directory aren't set to allow the
    restricted user access.  I was trying to follow what the
    postgres package does, but maybe I missed something.

  - rc.zope: installs for the "default" instance, located in
    '%{l_prefix}/var/zope/default'.  No ZEO in place (in 2.6.2,
    ZEO is only available via the separate ZODB3 package).

I have a couple of policy questions:

  - How does OpenPKG handle the possibility of multiple "database
    instances"?  Each one would need its own area under 'var/zope',
    as well as its own rc file;  would it be better to package that
    part as a separate, relocatable-within-openpkg RPM?

  - Assuming that I pacakge ZODB3, it will become feasible to have
    one or more ZEO server instances running, in addition to the
    appserver instance(s). One issue with this is that ZODB3 and
    Zope share some components, and might even need to keep some
    of them in pretty tight sync (to ensure that both ends speak
    the same wire protocol).  Should we be packaging the shared
    components separately?  That could end up with 5 packages:

      o Common components (ExtensionClass, BTrees, core ZODB,
        ZEO, etc.). (lib/zope/*)

      o Zope software (lib/zope/*)

      o ZODB3 software (lib/zope/*)

      o Zope appserver instance (rc.zope + var/zope/default)

      o ZEO storage server instance (rc.zeo + var/zeo/default)

    "That way lies madness", as pretty soon you end up trying to
    package each Python package within Zope as its own thing, just
    to allow updating them separately.
    
    A dependency-aware installer like apt or yum can ease the
    pain of such fine-grained packaging, but the extra complexity
    seems not to be in line with the OpenPKG way of doing things
    (contrast with how Debian packages Zope, for instance).

Another note:  with Zope 2.7, the packaging process should get
simpler;  rather than driving distutils directly from the spec file,
we should be able to leverage its 'configure && make && make
install' tools.

Tres.
-- 
===============================================================
Tres Seaver                                [EMAIL PROTECTED]
Zope Corporation      "Zope Dealers"       http://www.zope.org

##
##  zope.spec -- OpenPKG RPM Specification
##  Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
##  Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
##  Copyright (c) 2000-2003 Ralf S. Engelschall <[EMAIL PROTECTED]>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

                                                                                
#   package versions
%define       V_python          2.2.3
%define       V_zope            2.6.2
%define       V_openpkg         1.3

#   package information
Name:         zope
Summary:      Content Management System and Application Server
URL:          http://www.zope.org/
Vendor:       Zope Corporation
Packager:     The OpenPKG Project
Distribution: OpenPKG [JUNK]
Group:        Web
License:      Zope Public License
Version:      %{V_zope}
Release:      20030925

#   list of sources
Source0:      http://www.zope.org/Products/Zope/%{version}/Zope-%{version}-src.tgz
Source1:      rc.zope

#   build information
Prefix:       %{l_prefix}
BuildRoot:    %{l_buildroot}
BuildPreReq:  OpenPKG, openpkg >= %{V_openpkg}
PreReq:       OpenPKG, openpkg >= %{V_openpkg}
BuildPreReq:  python >= %{V_python}
Requires:     python >= %{V_python}
AutoReq:      no
AutoReqProv:  no

%description
    Zope is the leading Open Source web application server. Zope
    enables teams to collaborate in the creation and management of
    dynamic web-based business applications such as intranets and
    portals. Zope makes it easy to build features such as site search,
    news, personalization, and e-commerce into your web applications.

%prep
    %setup -q -n Zope-%{version}-src

%build
    CC="%{l_cc}" \
    CFLAGS="%{l_cflags -O}" \
    %{l_prefix}/bin/python setup.py build_ext \
        --force \

%install
    rm -rf $RPM_BUILD_ROOT
    %{l_prefix}/bin/python setup.py install  \
        --root=$RPM_BUILD_ROOT \
        --prefix=%{l_prefix} \
        --install-purelib=%{l_prefix}/lib/zope \
        --install-platlib=%{l_prefix}/lib/zope \
        --install-headers=%{l_prefix}/include \
        --install-scripts=%{l_prefix}/bin \
        --no-compile \

    #   trim down
    rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/zope/import

    #   install scripts
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/libexec
    %{l_shtool} install -c -m 755 \
        z2.py \
        $RPM_BUILD_ROOT%{l_prefix}/libexec
    %{l_shtool} install -c -m 755 \
        inst/compilezpy.py \
        $RPM_BUILD_ROOT%{l_prefix}/libexec

    %{l_shtool} install -c -m 755 \
        zpasswd.py \
        $RPM_BUILD_ROOT%{l_prefix}/bin
        
                                                                                
    #   create instance home
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/var/zope/default/var
                                                                                
    #   install run-command script
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
    %{l_shtool} install -c -m 755 %{l_value -s -a} \
        %{SOURCE rc.zope} \
        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
                                                                                
    #   determine installation files
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
        %{l_files_std} \
        '%attr(700,%{l_rusr},%{l_rgrp}) %dir %{l_prefix}/var/zope/default/var'

%post
    #   compile python modules in place after installation.
    cd %{l_prefix}/lib/zope
    %{l_prefix}/bin/python %{l_prefix}/libexec/compilezpy.py

%preun
    #   before erase, stop service, ...
    [ $1 -eq 0 ] || exit 0
    %{l_rc} zope stop 2>/dev/null
    #   ... remove compiled python modules, ...
    cd %{l_prefix}/lib/zope
    find . -name "*.pyc" | xargs rm
    #   ... and remove log files
    rm -f $RPM_INSTALL_PREFIX/var/zope/default/var >/dev/null 2>&1 || true
    exit 0


%files -f files

%clean
    rm -rf $RPM_BUILD_ROOT

[EMAIL PROTECTED]@/lib/openpkg/bash @l_prefix@/etc/rc
##
##  rc.zope -- Run-Commands
##

%config
    zope_enable="$openpkg_rc_def"
    zope_instance_name="default"
    zope_http_port="8080"
    zope_ftp_port="8021"
    zope_webdav_port="9800"
    zope_dns_host="''"
    zope_listen_host="127.0.0.1"
    zope_application_threads="4"
    zope_python_interp_check_interval="120"
    zope_access_prolog="true"
    zope_access_epilog="true"
    zope_access_numfiles="10"
    zope_access_minsize="1M"
    zope_access_complevel="9" 
    zope_event_log_level="0"
    zope_event_prolog="true"
    zope_event_epilog="true"
    zope_event_numfiles="10"
    zope_event_minsize="1M"
    zope_event_complevel="9"
    zope_trace_enable="true"
    zope_trace_prolog="true"
    zope_trace_epilog="true"
    zope_trace_numfiles="10"
    zope_trace_minsize="1M"
    zope_trace_complevel="9"

%common
    zope_software_home="@l_prefix@/lib/zope"
    zope_instance_home="@l_prefix@/var/zope/$zope_instance_name"
    zope_access_log_file="$zope_instance_home/var/access.log"
    zope_event_log_file="$zope_instance_home/var/event.log"
    zope_trace_log_file="$zope_instance_home/var/trace.log"
    zope_pidfile="$zope_instance_home/var/Z2.pid"
    zope_servers="-X"
    if [ -n $zope_http_port ]; then
        zope_servers="$zope_servers -w $zope_http_port"
    fi
    if [ -n $zope_ftp_port ]; then
        zope_servers="$zope_servers -f $zope_ftp_port"
    fi
    if [ -n $zope_webdav_port ]; then
        zope_servers="$zope_servers -w $zope_webdav_port"
    fi
    zope_opts="-d $zope_dns_host"
    if [ -n $zope_listen_host ]; then
        zope_opts="$zope_opts -a $zope_listen_host"
    else
        zope_opts="$zope_opts -a ''"
    fi
    zope_opts="$zope_opts -t $zope_application_threads"
    zope_opts="$zope_opts -i $zope_python_interp_check_interval"
    zope_opts="$zope_opts -l $zope_access_log_file"
    if [ "$zope_trace_enable" == "true" ]; then
        zope_opts="$zope_opts -M $zope_trace_log_file"
    fi
    zope_env=""
    if [ -n $zope_event_log_level ]; then
        zope_env="$zope_env EVENT_LOG_FILE=$zope_event_log_file"
        zope_env="$zope_env EVENT_LOG_LEVEL=$zope_event_log_level"
    fi
    zope_args="$zope_servers $zope_opts $zope_env"
    zope_signal () {
        if [ -f ${zope_pidfile} ]; then
            kill -$1 `cat ${zope_pidfile}`
            return $?
        else
            return 1
        fi
    }


%status -u @l_rusr@ -o
    zope_usable="unknown"
    zope_active="no"
    rcService zope enable yes && \
        if [ -f ${zope_pidfile} ]; then
            zope_signal 0
            if [ $? -eq 0 ]; then
                zope_active="yes"
            fi
        fi

    echo "zope_enable=\"$zope_enable\""
    echo "zope_usable=\"$zope_usable\""
    echo "zope_active=\"$zope_active\""

%start -p 400 -u @l_rusr@
    rcService zope enable yes || exit 0
    rcService zope active yes && exit 0
    SOFTWARE_HOME=$zope_software_home
    INSTANCE_HOME=$zope_instance_home
    PYTHONPATH=$SOFTWARE_HOME
    export SOFTWARE_HOME INSTANCE_HOME PYTHONPATH
    @l_prefix@/bin/python @l_prefix@/libexec/z2.py $zope_args

%stop -p 400 -u @l_rusr@
    rcService zope enable yes || exit 0
    rcService zope active no  && exit 0
    zope_signal TERM

%restart -p 400 -u @l_rusr@
    rc zope stop
    rc zope start

%reload -p 400 -u @l_rusr@
    rcService zope enable yes || exit 0
    rcService zope active no  && exit 0
    zope_signal HUP

%daily -u @l_rusr@
    rcService zope enable yes || exit 0

    #   rotate logfile
    shtool rotate -f \
        -n ${zope_log_numfiles} -s ${zope_log_minsize} -d \
        -z ${zope_log_complevel} -m 600 -o @l_rusr@ -g @l_rgrp@ \
        -P "$zope_log_prolog" \
        -E "$zope_log_epilog && rc zope reload" \
        $zope_log_file

Reply via email to