Subject: Re: How to quarterly releases?
To: Ryan Cresawn <cresawn@chass.utoronto.ca>
From: None <segv@netctl.net>
List: tech-pkg
Date: 11/08/2005 10:43:09
On Mon, 7 Nov 2005 23:17:10 -0500
Ryan Cresawn <cresawn@chass.utoronto.ca> wrote:

> I've been struggling with this problem for a while and I decided that
> I should ask the list because someone here has surely solved this
> before.  The trouble is that I haven't found an intelligent way to
> update from one quarterly release to the next on a production server.
> A mail delivery host that I administer is running Solaris 8 with
> pkgsrc-2005Q1.  Obviously, I would like to update this to the latest
> release.  What is a good way to do this with minimal downtime?

This is how I do this:

I setup pkgsrc to use different directories

/opt/pkg-2005Q3-gcc
/opt/pkg-2005Q3-sunpro

The first directory contains packages compiled with gcc, the second with Sun compilers. This is because there is a lot of software which breaks when built with Sun compilers, so it helps to test packages in parallel with both compilers. You could do something similar:

/opt/pkg-2005Q1
/opt/pkg-2005Q3
... etc

then have /opt/pkg symlink that points to your stable package directory.

Assuming you have installed packages in /opt/pkg-2005Q1 and now you want to build a new release, these new packages will go into /opt/pkg-2005Q3

You'll end up with 3 directories:

/opt/pkg-2005Q3 - this is where your packages will be installed
/opt/pkg-2005Q3.obj - this is the work directory, that will contain object files
/opt/pkg-2005Q3.packages - this is where binary packages will be archived, so you can reinstall them later

Assume your pkgsrc is mounted read-only via NFS under /opt/pkgsrc. Make sure that a working gcc/cc compiler is in your PATH

cd /opt/pkgsrc/bootstrap
./bootstrap --workdir /opt/pkg-2005Q3.obj --prefix /opt/pkg-2005Q3 \
	--pkgdbdir /opt/pkg-2005Q3/db/pkg

Note above that package database directory does not go into /var, instead we keep it where the packages get installed. This way you can avoid conflicts when you setup multiple package directories.
I would advice to bootstrap with gcc. When I used Sun Studio 10 compiler to bootstrap pkgsrc, 'tar' command would segfault. I posted about the problem on tech-pkg but recieved no replies :-/

After bootstrapping, 'bmake' and other utilities will be setup to use /opt/pkg-2005Q3 directory automatically.

If you're using Sun compilers, you simply create /opt/pkg-2005Q3/etc/mk.conf file, adjust your PATH environment variable and start building packages. If you want to use gcc, you'd have to build and install gcc into /opt/pkg-2005Q3 since some packages will be linked to gcc's libraries

Now set up your PATH and MANPATH:

PKGPATH=/opt/pkg-2005Q3/bin:/opt/pkg-2005Q3/sbin:/opt/pkg-2005Q3/gcc3/bin
PKGMANPATH=/opt/pkg-2005Q3/man:/opt/pkg-2005Q3/share/man

PATH=$PKGPATH:/bin:/usr/bin:/sbin:/usr/sbin:/usr/dt/bin:/usr/openwin/bin:/usr/ccs/bin
MANPATH=$PKGMANPATH:/opt/SUNWspro/man:/usr/man:/usr/dt/man:/usr/openwin/man

export PATH MANPATH


and create /opt/pkg-2005Q3/etc/mk.conf file:

# -- Begin misc pkgsrc settings --
#
_ACCEPTABLE=yes
DEPENDS_TARGET=package

# Default to using everything from pkgsrc.
#PREFER_PKGSRC=yes
#
# -- End misc pkgsrc settings --


# -- Begin pkgsrc directory settings --
#
LOCALBASE=/opt/pkg-2005Q3
PKG_DBDIR=${LOCALBASE}/db/pkg
SED=${LOCALBASE}/bin/nbsed
PAX=${LOCALBASE}/bin/pax
TAR=${LOCALBASE}/bin/tar
PACKAGES=${LOCALBASE}.packages
WRKOBJDIR=${LOCALBASE}.obj
DISTDIR=/opt/distfiles
#
# -- End pkgsrc directory settings --


# -- Begin compiler and optimisation flags --
#
# Set these when building packages with gcc
USE_PKGSRC_GCC=YES
GCC_REQD=4.0.2
PKGSRC_CFLAGS=-O2 -mcpu=ultrasparc -mvis -mv8plus -pipe
PKGSRC_CXXFLAGS=-O2 -mcpu=ultrasparc -mvis -mv8plus -pipe

# Set these when building packages with sunpro
#PKGSRC_COMPILER=sunpro
#CC=cc
#CXX=CC
#CPP=/usr/ccs/lib/cpp
#PKGSRC_CFLAGS=-xO3 -xtarget=native
#PKGSRC_CXXFLAGS=-xO3 -xtarget=native -features=%all,no%tmplife

# Set optimisation flags
COPTS+=${PKGSRC_CFLAGS}
CFLAGS+=${PKGSRC_CFLAGS}
CXXFLAGS+=${PKGSRC_CXXFLAGS}
#
# -- End compiler and optimisation flags --


# -- Begin specific package settings --
#
# Which compilers to build for lang/gcc4
BUILD_ADA=YES
BUILD_CXX=YES
BUILD_F77=YES
BUILD_JAVA=YES
BUILD_OBJC=YES

# On Solaris chat/gaim needs gnutls, since devel/nss is broken
#PKG_OPTIONS.gaim+=gnutls

# Options for Postfix and OpenLDAP
PKG_OPTIONS.openldap+=bdb sasl
PKG_OPTIONS.postfix+=bdb ldap sasl tls
SASL_DBTYPE=berkeley
#
# -- End specific package settings --


# The fist sourceforge site in MASTER_SITE_SOURCEFORGE is usually down or
# overloaded, select a different one to speed up downloads
MASTER_SITE_SOURCEFORGE+=http://easynews.dl.sourceforge.net/sourceforge/