Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 07 Dec 2015 14:49:11 -0600
From:      Brandon J. Wandersee <brandon.wandersee@gmail.com>
To:        Paul Stuffins <freebsd@ravexdata.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Migrating to FreeBSD from Debian
Message-ID:  <86io4a6l2w.fsf@WorkBox.Home>
In-Reply-To: <CAO-kBwffucnPVphm_ajbtAejjFiAv_Cp%2Bv7jZ-xCTX7YTqk36w@mail.gmail.com>
References:  <CAO-kBwffucnPVphm_ajbtAejjFiAv_Cp%2Bv7jZ-xCTX7YTqk36w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

Paul Stuffins writes:

> Hi Everybody,
> As 2016 is fast approaching I want to finally move to FreeBSD and stay with
> FreeBSD, so my question is, what is the best or most efficient way of
> upgrading all ports on a FreeBSD machine?


Right, so since this kinda derailed quickly, I'll try to answer this
clearly and comprehensively. I moved from Arch Linux to FreeBSD myself
just over a year ago, so I'll try to iron some things out for you, since
it took me some time to sort all this out myself and I sympathize.

The package package manager isn't drastically different from pacman or
dpkg/apt, so you should find understanding it pretty easy. Just read the
man pages and the relevant section of the Handbook for the
basics. Beyond that, though, there are some characteristics of the
packages and repository that need to be understood. First, in almost
every case a single port is built into a single package with a fairly
sane set of default options. Even in cases where multiple versions of an
application exist--such as Emacs--there is a corresponding port with a
different set of options. So if you're lucky, you'll be able to use
packages for everything you need. If there's any application built
without an option you want, you'll have to build it from the ports tree.

This raises some caveats. For one thing, while packages are built and
the repository updated several times a week (up from just two or three
times a week when I first started--great work, folks), as of now it's
not a continuous process. This means the ports tree (which works by a
rolling-release model) is always a few hours to a couple days ahead of
what you'll find in the repository, raising the possibility of
dependency conflicts if you mix ports with precompiled packages. For
another, if you try upgrading your binary packages using `pkg update &&
pkg upgrade`, pkg(8) will also replace your personally compiled ports
with the most recent default versions found in the package repository.

There are two ways to avoid these issues. If you just have, say, two or
three ports to manage, you can use pkg-lock(8) to prevent pkg(8) from
messing with your ports. You can then upgrade your packages as usual,
and then use ports-mgmt/portmaster or ports-mgmt/portupgrade to upgrade
your ports afterward. This can be a little tedious, as (a) you'd need to
use Subversion to synchronize your local ports tree to the revision used
to build the most recent set of packages, which must be done manually;
and (b) you would need to use `pkg unlock` on your custom package before
upgrading them (but *after* upgrading your vanilla packages), and then
run `pkg lock` on them again after upgrading. So it would require
building some new habits. There are a couple sripts I've seen that are
supposed to synchronize your ports to the package repo automatically,
but last I checked they hadn't been updated for 10.2 and did not work
for -STABLE or -CURRENT.

If you have more than a few ports to build, or don't mind waiting a few
months between package upgrades (you are a Debian user, after all), you
can just use the quarterly repository and ports tree, which are always
kept in sync and updated every three months. As of FreeBSD 10.2 the
quarterly package repository is used by default on new installs, and
fetching the quarterly ports tree with Subversion is easy enough (it's
in the same SVN repo as the main ports tree). So this is definitely the
easier way to go if you want to mix ports with packages.

Of course, if you have lots of ports you want to customize, you might
just skip packages entirely and stick with ports. In that case,
ports-mgmt/portmaster seems to be the semi-official way of handling
things. You'd just run `portmaster -a` to upgrade all installed
ports. If there are any new options available in a new version of the
port, portmaster will prompt you to check your options interactively
before continuing.

You could also use ports-mgmt/poudriere to build custom packages into a
locak repository; it's the same build system used for the official
package repository. Setting it up the first time takes a little work,
but it would allow you to build from either the rolling or quarterly
ports tree as you see fit, and updating is just a matter of fetching the
latest commit of whichever ports tree you're tracking and running the
build command. I use it myself, and love it. Poudriere is quicker and
more efficient than Portmaster on machines with plenty of RAM and
multi-core CPUs.

Since the ports system and package manager are tied to each other, once
a port is installed you can perform any actions you see fit on it using
pkg(8). It's all the same at that point. And as was already mentioned,
always make sure to read /usr/ports/UPDATING (or run `pkg updating`)
before proceeding to see announcements about any special measures that
need to be taken. Hope this all helps a bit.

-- 
=================================================================
   		      :: Brandon Wandersee ::
                  :: brandon.wandersee@gmail.com ::
==================================================================
'A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete
fools.'
                            			- Douglas Adams
==================================================================



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86io4a6l2w.fsf>