Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jan 1999 10:16:07 -0700
From:      "Chris D. Faehl" <cfaehl@cs.unm.edu>
To:        freebsd-ports@FreeBSD.ORG
Subject:   Discussion: architectural enhancement to ports
Message-ID:  <E100qNR-0003Sy-00@sloth.cs.unm.edu>

next in thread | raw e-mail | index | archive | help
Greetings,
	The FreeBSD ports system, while amazingly useful, could be made
significantly more flexible with just a few changes to bsd.port.mk. What
we've done here on all of our platforms is implement a version-based
installation system for /usr/local. This morning I made some local changes
to bsd.port.mk that helps us easily achieve this utilizing the FreeBSD
ports tree and judicious munging of the PREFIX variable. I'd love to
see this incorporated as an *optional* installation method for ports, eg,
some env variable would determine whether or not to use the scheme.
	The scheme we devised installs packages under a
/usr/local/pkg/pkgname/pkgname-version.number hierarchy. A separate program
then traverses the hierarchy and makes top-level links into /usr/local. 
A more in-depth detailing of this scheme can be found at:
http://www.cs.unm.edu/~ssg/SSG_SysAdmin/SSG_Pkglink.shtml

So, taking the tcsh port as an example, we have:
ls -l /usr/local/pkg/tcsh
lrwxrwxrwx   1 root  wheel    9 Jan 14 09:47 current -> tcsh-6.08
drwxr-xr-x  11 root  wheel  512 Nov  2 06:54 tcsh-6.07.02
drwxr-xr-x  11 root  wheel  512 Jan 14 08:36 tcsh-6.08

Inside each version-directory:
drwxr-xr-x   2 root  wheel  512 Jan 14 09:14 bin
drwxr-xr-x   3 root  wheel  512 Jan 14 08:36 etc
drwxr-xr-x   2 root  wheel  512 Jan 14 08:36 include
drwxr-xr-x   2 root  wheel  512 Jan 14 08:36 info
drwxr-xr-x   3 root  wheel  512 Jan 14 08:36 lib
drwxr-xr-x   2 root  wheel  512 Jan 14 08:36 libexec
drwxr-xr-x  26 root  wheel  512 Jan 14 08:36 man
drwxr-xr-x   2 root  wheel  512 Jan 14 08:36 sbin
drwxr-xr-x   8 root  wheel  512 Jan 14 08:36 share

Each directory above contains what you'd expect:
bin/:
-r-xr-xr-x  1 bin   bin    247456 Jan 14 09:14 tcsh
...

Meanwhile, at /usr/local, we have:
lrwxrwxrwx  1 root  wheel  36 Nov  2 06:57 /usr/local/bin/tcsh -> 
/usr/local/pkg/tcsh/current/bin/tcsh


Here's what the scheme gets us:

1) multiple versions of packages can be installed without conflicts
2) we can change the 'default' version of a package and all its associated
	pieces by changing a single link - the "current" link in that
	package's directory.
3) we can delete all the elements of outdated or unwanted software in
	one fell swoop.
4) we can easily index all the installed software (and versions) in
	/usr/local, so we don't have to track it by hand (our index
	is at http://www.cs.unm.edu/~ssg/SSG_Software/Pkg.html ).

The changes I've made are different from simply setting PREFIX on each
port one builds in that PREFIX is set according to scheme specs for 
dependencies also (as opposed to the PREFIX variable being exported to
the dependency). The ultimate success of this scheme depends upon
port maintainers assuring their port respects PREFIX appropriately.
There may also be issues with dependent libraries of a port (there
wasn't with magicpoint, one of my test packages, but that's a fairly
limited testcase). 

I'd like to know what the FreeBSD ports community feels about this. 
It's obviously not to be used in the default case, but for large
production sites, it makes managing /usr/local pretty easy.

Here's a rough context patch. It doesn't handle cases that use 
USE_X_PREFIX. Comments welcome.

*** bsd.port.mk.orig    Thu Jan 14 07:25:40 1999
--- bsd.port.mk Thu Jan 14 10:10:58 1999
***************
*** 479,484 ****
--- 479,503 ----
  PKGDIR?=              ${MASTERDIR}/pkg
  .endif
  
+ ### Changes to support CS' pkg system - 990114, cfaehl
+ .if defined(USE_VERSPKG)
+ # We strip off trailing -version.numbers
+ # NOTE: Trying to do this as a backtick expansion fails in the install
+ #     phase, while I can't seem to construct the right expression to
+ #     do this in a variable modification (eg :S%-.*%% is valid but
+ #     not a regular expression, so doesn't give expected results)
+ .if defined(PKGNAME)
+ FOONAME=      ${PKGNAME}
+ .else
+ FOONAME=      ${DISTNAME}
+ .endif
+ 
+ PORTNAME!=    /bin/echo ${FOONAME} | /usr/bin/sed -e 's/-.*//'
+ VERSPKGBASE?=   ${LOCALBASE}/pkg/${PORTNAME}/${DISTNAME}
+ PREFIX=               ${VERSPKGBASE}
+ .endif
+ ### end changes - 990114, cfaehl
+ 
  .if defined(USE_IMAKE)
  USE_X_PREFIX= yes
  .endif



-------------------------------------------------------------------------------
Chris Faehl			      | Email: cfaehl@cs.unm.edu
The University of New Mexico          | URL:   http://www.cs.unm.edu/~cfaehl
Computer Science Dept., Rm. FEC 313   | Phone: 505/277-3016
Albuquerque, NM  87131  USA           | FAX:   505/277-6927
-------------------------------------------------------------------------------




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E100qNR-0003Sy-00>