Handling FreeBSD package upgrades using pkg_add

Posted by larsks on Server Fault See other posts from Server Fault or by larsks
Published on 2010-12-20T21:32:54Z Indexed on 2010/12/21 15:55 UTC
Read the original article Hit count: 285

I'm trying to use FreeBSD's pkg_add command to install and upgrade binary packages in a build-once-install-on-multiple-machines sort of scenario. It works well when installing a new package, but upgrades are baffling me. For example, if I want to upgrade a package that is depended on by another package, I can't just install it:

# pkg_add /path/to/somepackage-2.0.tbz
pkg_add: package 'somepackage' or its older version already installed

At this point, I can delete the older version of the package if I pass -f to the pkg_delete command:

# pkg_delete -f somepackage-1.0
pkg_delete: package 'somepackage-1.0' is required by these other packages
and may not be deinstalled (but I'll delete it anyway):
anotherpackage-1.0

But...and this is the killer...now the dependency information is gone! I can install the upgrade:

# pkg_add /path/to/somepackage-2.0.tbz

And now attempts to delete it will succeed without any errors:

# pkg_delete somepackage-2.0

How do I handle this gracefully (whereby "gracefully" means "in a fashion that preserves dependency information without requiring me to rebuild/reinstall and entire dependency chain").

Thanks!

© Server Fault or respective owner

Related posts about freebsd

Related posts about upgrade