Combining pkg and "traditional ports"

Matthew Seaman matthew at
Wed Jan 15 07:35:36 UTC 2014

On 15/01/2014 05:36, Polytropon wrote:
> With the upcoming OS standardization on pkg (pkgng) following
> the abolishment of the pkg_* toolset I'd like to ask questions
> to those who already actively use pkg and have probably encountered
> and solved the same "problems" that I'll be expecting:
> There are two cases where a binary package can't be used:
> a) There is no package.
> Not all ports have equivalent packages. For example, I've seen
> this recently for OpenArena. In this case, compiling is needed
> (and even switching to gcc instead of clang, OS v10-RC2). Another
> example is a localize OpenOffice / maybe LibreOffice.
> How is this handled when a pkg-based "upgrade all" is performed?

Packages installed on your local system but not available from any of
your configured repositories are just left untouched by the upgrade
process.  If your local package 'foo' depends on a package 'bar' from
the repo, and upgrading the dependency 'bar' would cause problems
ideally, you'ld see an error message from pkg saying in essence "I want
to upgrade bar, but foo is blocking that."  Unfortunately, I don't think
that would happen in all cases at the moment.

> b) The default options of the package can't be used.
> My favourite example is mplayer (including all imaginable
> codecs as well as mencoder and additionally the gmplayer
> and gmencoder X applications), but it could also apply for
> a HAL-less X and HAL-less applications. But also OpenOffice
> can be considered again, a localized version (german) with
> dependencies for KDE, Gnome and CUPS deactivated (because I
> don't use those).
> Can those be protected from being overwritten?

The general solution to this problem is to set up your own package
repository using eg. poudriere -- you don't have to build everything you
need installed, just the ports where you want customised options and
everything they depend on.

You can force a package to only be updated from a specific repo by using
pkg annotate -- details are in pkg-repository(5).

Unfortunately there is no obvious way to have a local repo for just eg.
OpenOffice without also including everything that OpenOffice depends on.
That would be a useful enhancement to poudriere if anyone is looking for
a programming project -- fetch all dependencies from another repo except
the packages you specifically want to build.

There is not, at the moment, any way of treating 'install from ports' in
a similar way.  I've seen some ideas floating around on IRC, but nothing
concrete in the code yet.

> Is there even a method of saying, like, "use binary packages
> to upgrade everything excepts ports 'foo', 'bar', 'meow' and
> 'moo', compile those, but make sure their dependencies are
> installed via packages when they are available and apply"?

You can use 'pkg lock' against your hand-installed ports, which will
prevent pkg overwriting them, but then you'ld have to remember to unlock
before running portmaster or whatever.

> From my experience so far, pkg works really great. I'd just
> like to know how it can be used in the few cases where the
> exceptions need to be made intendedly.

pkg design is still in a very fluid phase -- some things have been
pretty much settled, but a large part of the way it behaves is still to
be finalized.  We will be very interested to hear about different use
cases, and where pkg either doesn't fulfil your needs or match up to
your expectations (within reason).  Although you should accept that some
things do work differently to the way the old pkg_tools did, and just
being different, although it may be surprising to you, is not
automatically a fault.



Dr Matthew J Seaman MA, D.Phil.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1036 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the freebsd-questions mailing list