portmanager
uses libMG ( general utilities ) and libPMGR ( utilities specific to portmanager )
#include <portmanager.h> portmanager -h {help} -s {status of installed ports report} -u {upgrade installed ports}
This is preliminary documentation, subject to change and likely to contain many errors.
Runs programs to manage FreeBSD's port system.
portmanager -s or --status
Lists installed ports and wether they are older than currently available ports.
portmanager -u or --upgrade
Upgrades out of date installed ports. Here is a long description of it works:
1 Determines ports that are out of date by comparing them to Makefiles downloaded through cvsup into the ports tree, and checking wether the dependency ports they were built with are out of date. Either condition will result in a port being added to the out of date list.
1.1 Once a port is determined to be out of date it is added to a list of ports to be updated.
1.2 After every out of date port is in the list pmUpgrade starts at the top of the list and checks for every possible excuse not to update that particular port yet, here are some excuses:
1.2.1 The out of date port has a dependency port that is also in the out of date list
1.2.2 The out of date port has a dependency port that was built with an out of date port
1.3 The first port in the out of date list that has no excuse to be skipped, is built, then the cycle restarts from the beginning untill all out of date ports are eventually updated.
1.4 The end result after a ports collection has been updated with pmUpdate is a collection where every port has been built and installed with only the most current available sources.
2 portManager is non intrusive, it does not modify any file on any part of the FreeBSD ports system.
2.1 At any time it is perfectly safe to abort out of any portManager program with the following advisory:
advisory: With the normal "make install clean" method of adding ports there is a critical step, after a port is made, the old port must be de-installed then the new port installed in its place. If for some reason the new port fails to install you are left with neither your old port, nor the new one. It is for this reason portManager makes a package from your old port before removing it, and if the new port fails to install correctly portManager will reinstall your old port from that package. Even if you <control> <c> out of portUpgrade at the crucial moment between removal of the old port and installation of the new port portUpgrade may still install the original from the backup package, this is not guaranteed though, so only at this step it is recommended not to terminate pmUpgrade. Every other point in the operation of any portManager program it is perfectly safe to abort, <control> <c>, kill, whatever during program operation. Your ports collection will not be harmed!
Example configuration file located at:
/usr/local/etc/portmanager/portmanager.conf
#............................................................ # port manager configuration file ver 0.01.0 #............................................................ #............................................................ # defaults: # command sequence | applies too | command line switch #............................................................ # 1 ALL "make clean" # 2 ALL "make" # 3 ALL "pkg_create -b {pkg id}" # 4 ALL "make deinstall" # 5 ALL "make reinstall" # 6 ALL "rm -f {pkg id}" # 7 ALL "make package" # 8 ALL "make clean" #............................................................ # user adjustment area: add command line switch to default # commands for specific ports in this section. Normally you # will only be adding switches to command sequence 2 ( make ) #............................................................ #............................................................ # command sequence | applies too | command line switch #............................................................ 2 textproc/docproj JADETEX=no 2 x11-toolkits/vte WITH_GLX=yes
portmanager.c | portmanager.h |
A snapshot from a portmanager -s report: have:libtool-1.5.2_1 status: OK:libtool-1.5.2_1 devel/libtool15 have:libungif-4.1.2 status: OK:libungif-4.1.2 graphics/libungif have:portlint-2.6.0 status: OK:portlint-2.6.0 devel/portlint have:bison-1.75_2 status: OK:bison-1.75_2 devel/bison have:XFree86-4.3.0,1 status built with OLD dependency port :freetype2-2.1.7_2 have:XFree86-clients-4.3.0_7 status built with OLD dependency port :freetype2-2.1.7_2 have:XFree86-font75dpi-4.3.0 status built with OLD dependency port :freetype2-2.1.7_2
This program should in no way harm or modify the underlying structure of FreeBSD's port system. It does not for example ever modify the INDEX or INDEX-5 files, it does not change dependancy information on any port, it merely operates the ports system just as you would manually, only it is automated.
local ports ( non FreeBSD ) :
Here is how to handle locally installed ports if you plan to take advantage of some of FreeBSD's port system features:
######################################################################## * Makefile excerpt from /usr/ports/local/sysutils/portmanager/Makefile # ######################################################################## PORTNAME= portmanager PORTVERSION= 0.1.0 CATEGORIES= local/sysutils VALID_CATEGORIES+= ${CATEGORIES} # for FreeBSD to accept our # local category
Simply add a "local" directory to /usr/ports and install your local ports under that directory. Where a normal FreeBSD port may be in "sysutils/{portname} the example above would reside in "local/sysutils/portmanager".
Tested on FreeBSD-STABLE ( 4.9 and 4.10 ) and lightly tested on FreeBSD-CURRENT 5.2. Please send comments/questions to Mike Shultz.
Brand new and untested except on the author's own system. Use at your own risk. ( The author promisses to feel really bad if this software in anyway causes you grief. )
Mojave Green Software Co. Landers Ca Michael C. Shultz