Subject: atomic pkgsrc
To: None <tech-pkg@netbsd.org>
From: James K. Lowden <jklowden@schemamania.org>
List: tech-pkg
Date: 05/12/2004 22:57:45
I spend quite a lot of time thinking about how to make pkgsrc easier to
administer.  I've tried the sandbox, and I've read about pkgviews, but I
think I have a truly simple idea.  It's so simple it must be wrong, and
I'd very much appreciate it if someone would explain why.  

My main bugaboo with pkgsrc is yours, too, probably: the tearing down of a
working system for the prospect of a better one.  I'm still running Moz
1.0 and <blush> Gnome 1.2 because rebuilding is such a pain.  I've been
thinking about ways to build packages in a separate location.  Then, when
all is ready, swap in the new stuff.  

The installed locations of packages are controlled by:

           X11BASE    Where X11 is installed on the system.  
           LOCALBASE  Where non-X11 based packages will be installed.  
           PKG_DBDIR  Where package installation is recorded.  

We can even ignore X11BASE if xpkgwedge is installed first.  

Suppose on a freshly installed box I set:

	LOCALBASE=/usr/pkg-2003Q4
	PKG_DBDIR=/var/db/pkg-2003Q4

and add two symlinks:

	ln -s $LOCALBASE /usr/pkg
	ln -s $PKG_DBDIR /var/db/pkg

It seems to me I can "make install" merrily with nary a soul minding.  

Suppose later I decide it's time to upgrade.  Rather than updating in
place, I adjust:

	LOCALBASE=/usr/pkg-2004Q1
	PKG_DBDIR=/var/db/pkg-2004Q1

and rebuild everything from scratch (starting with xpkgwedge).  When I'm
ready, I just update the symlinks and away we go.  

Like I said, this is easy.  It's almost atomic.  Why won't it work?  

The only thing I can see is that /etc (and maybe /var) might get modified.
 But that's very rare, and I bet there's some magical attribute I could
use to prevent writing to those places, handling them specially.  

Many thanks for your thoughts.  

--jkl