How to automate updating packages from port building jail?

I use a jail to build packages from the ports tree (using ports-mgmt/portmaster) which I then install on the host. When updating my ports/packages I first do the usual in the jail:

[cmd=jail#]portsnap fetch update[/cmd][cmd=jail#]portmaster --no-term-title -g -a[/cmd]

But when I wish to install the updated packages on the host I have to look at the list of rebuilt ports (which portmaster gives me) and then do the following for each of them:
  • Check /var/db/pkg to see whether it's installed in the first place (because I build packages, build-only dependencies exist in the jail but are not installed on the host).
  • [cmd=host#]pkg_delete -f some_port-old.version[/cmd]
  • [cmd=host#]pkg_add some_port-new.version.tbz[/cmd]
  • [cmd=host#]rm /jail/usr/ports/packages/All/some_port-old.version.tbz[/cmd]
Obviously, I'd like to automate this process. I can probably whip up a shell script of some kind, but I figured I'd first ask whether something already exists for this.
 
If you build your own packages I highly recommend trying pkgng. You can use pkg upgrade on the host and will automatically fetch and install everything that needs updating and has a package available. If there's no updated package in your repository it will just skip that one.

I've only ran into problems with the recent pcre update. Updating worked but it didn't replace all packages that depended on the updated pcre. So I ended up doing a pkg delete -af and started from scratch. I'm guessing this was caused by the depending packages not having their version bumped.
 
SirDice said:
If you build your own packages I highly recommend trying pkgng. You can use pkg upgrade on the host and will automatically fetch and install everything that needs updating and has a package available. If there's no updated package in your repository it will just skip that one.
Thanks for the suggestion. I'll build a second jail to try it out, but it sounds like it's (almost) just what I'm looking for. That only leaves the matter of automagically (possibly periodically) cleaning out the repository (in my case /jail/usr/ports/packages/All) by removing old packages.
 
For package building I use a jail too, but I wipe it each time I start. I also wipe the package directory so mine is always clean. I have them on a ZFS filesystem, before I wipe them I make a snapshot so I can always revert to a previous repository.
 
SirDice said:
For package building I use a jail too, but I wipe it each time I start. I also wipe the package directory so mine is always clean.
That's something I can work with. I'll probably end up keeping a repository on an external HDD or something and dump successfully installed packages there, keeping the jail clean.

Now if only ports-mgmt/portmaster could be instructed to not create packages for build-only dependencies... After all, those ports are never installed on the host so their packages serve no function. Perhaps I should file a feature request :)
 
Back
Top