[Zope-dev] Zope RPMs/debs and Linux FHS

Chris McDonough chrism@zope.com
12 Oct 2002 18:28:37 -0400


--=-CMBySikpkzb9AbybQMr3
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi all,

I am working towards a unified Zope configuration and installation
system on a branch of Zope named the 'chrism-install-branch'.

I have given the buildout process on that branch the ability to create
an RPM distribution of Zope.  I intend later to give the buildout
process the ability to create Debian .debs as well and maybe Solaris
packages...  I am doing this with the expectation that we might be able
to provide RPM and .deb distros of Zope from zope.org instead of our
current "generic Linux as tarball" distro.  I haven't looked yet at the
Debian packaging of Zope (by Gregor Hoffleit), but I intend to do that
next to get some more ideas.

I know there are already at least two flavors of Zope RPMs which Jeff
Rush helped to package.  There are a number of differences between the
packaging of the RPMs generated by my branch and the packaging of Jeff's
RPMs:

- One of Jeff's distros breaks Zope up into many different packages,
  while another installs it as one or two.  Mine only has one
  distribution flavor: a single package. 

- Jeff's puts some stuff into the current prevailing python's
  site-packages directory and some other stuff into /usr/share/zope.
  Mine puts nothing into site-packages, and installs all Zope software
  into /opt/zope.

- Jeff's creates an INSTANCE_HOME in /var/zope.  Mine creates an
  INSTANCE_HOME in /var/opt/zope.  I don't know if this is the right
  thing but in reading the Linux FHS, it advises to not create
  subdirectories of var directly... so I don't.

- Jeff's puts pid files into /var/run, while mine creates pid files
  directly in INSTANCE_HOME/var.

- Jeff's puts log files into /var/log while mine puts them into
  INSTANCE_HOME/var.

I am wondering if:

- anybody has opinions on the packaging layout.  Why is it advantageous
  to have many packages rather than one?

- anybody has any opinions of where Zope files distributed via RPMs and
  debs should really go, especially wrt to the Linux FHS.  I'm not sure
  there is a right answer, but I don't know beans about this, so I 
  figure I'll ask.  A file named 'Zope.spec.in' is attached to this 
  email which is the input file to create a Zope RPM spec file during 
  the make process, to give a better idea of how this works.

Thanks!

- C


--=-CMBySikpkzb9AbybQMr3
Content-Disposition: attachment; filename=Zope.spec.in
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=Zope.spec.in; charset=ISO-8859-15

%define id $Id$
%define name Zope
%define majorversion <<ZOPE_MAJOR_VERSION>>
%define minorversion <<ZOPE_MINOR_VERSION>>
%define release <<VERSION_RELEASE_TAG>>
%define version %{majorversion}.%{minorversion}
%define package_name %{name}-%{version}-%{release}
%define buildroot %{_tmppath}/%{package_name}-buildroot
%define target_dir /opt/%{name}-%{majorversion}
%define inst_target_dir /var/opt/zope
%define python /usr/bin/python2.2
%define zopeuser zope

Summary: Zope, the open source web application server
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{package_name}.tar.gz
License: Zope Public License (ZPL)
Group: Applications/Internet
BuildRoot: %{buildroot}
Prefix: %{_prefix}
Vendor: Zope Corporation and Contributors <zope@zope.org>
Url: http://www.zope.org
# python2.2 packages from RedHat don't have 'compiler' package, but
# 2.2.1 packages do, so we require 2.2.1
Requires: python2 >=3D 2.2.1, /usr/sbin/useradd
# we don't require 2.2.1 for building, mainly because I don't
# actually have it. ;-)
BuildRequires: python2 >=3D 2.2, python2-devel > 2.2

%description
Zope is an application server framework that enables developers to quickly
build web applications such as intranets, portals, and content management
systems.

%prep
rm -rf $RPM_BUILD_DIR/%{package_name}
tar xvzf $RPM_SOURCE_DIR/%{package_name}.tar.gz

%build
cd %{package_name}
./configure --prefix=3D"%{buildroot}%{target_dir}" --optimize \
   --with-python=3D/usr/bin/python2.2
make build

%install
cd %{package_name}
make install
# XXX - need to figure out a way to byte-compile after install instead
# of during install
find %{buildroot}%{target_dir} | sed -e 's@^%{buildroot}@@' > INSTALLED_FIL=
ES

%post
/usr/sbin/useradd -M -r -s /bin/bash -d /var/opt/zope -c "Zope server user"=
\
   %{zopeuser} > /dev/null 2>&1
mkdir -p %{inst_target_dir}
chown %{zopeuser}.%{zopeuser} %{inst_target_dir}
chmod 755 %{inst_target_dir}
# blank inituser below causes an inituser file to not be written
su - %{zopeuser} -c \
  "%{python} %{target_dir}/inst/make_instance.py --insthome=3D%{inst_target=
_dir} --zopehome=3D%{target_dir} --inituser=3D > /dev/null 2>&1"

%postun
echo Note that the Zope instance files in "%{inst_target_dir}" were not \
uninstalled, nor was the '%{zopeuser}' user removed from the system.

%clean
rm -rf %{buildroot}

%files -f %{package_name}/INSTALLED_FILES
%defattr(-,root,root)

%changelog
* Fri Oct 11 2002 chrism <chrism@james.zope.com>
- Initial release


--=-CMBySikpkzb9AbybQMr3--