Do I want to switch to the new pkg(8) format?

Dutch Ingraham stoa at gmx.us
Sat Dec 27 00:42:43 UTC 2014


On 12/26/14 11:47, Chris Stankevitz wrote:
> Hello,
>
> I am familiar with the gentoo "portage" system but I am unfamiliar
> with the freebsd system.  I prefer to compile ports.
>
> While I am familiar with "make install", I do not know how to upgrade
> all the ports I previously installed (equivalent to gentoo's "emerge
> -Dauv world").  Section 5.5.3.1 of the handbook says that I should use
> portmaster.  When I install portmaster I get a friendly reminder:
>
> "If you want to switch to the new pkg(8) format, and have not already
> done so, there are some extra 1-time steps to take"
>
> Can you guys help me answer these questions:
>
> 1. Do I want to switch to the new pkg(8) format?
>
> 2. If yes, have I already done so?
>
> Thank you,
>
> Chris
>
> PS: I'm running 10.1-RELEASE-p3
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>
I'm fairly new to FreeBSD, coming over from Gentoo and other Linuxes. 
The *BSDs do things a little differently and that can be confusing for
someone like me who had only learned one way at that point.  Sorry if
some of this seems a little pedantic, but it took me a while to figure
out and from the number of times I've seen it come up, I think it might
help.

The following is how I've come to understand FreeBSD basic software 
management; I would hope Warren or others would correct my understanding 
if any of the following is incorrect or inaccurate.

A FreeBSD OS is made up of two main parts:

a. Base;
b. Third-party applications.

Base can further be defined as the kernel plus userland (all of the
executables found in /bin, for example.)

When you install FreeBSD, all you have at that point is Base.

Base is maintained with the freebsd-update(8) tool. I believe there are 
generally only security patches to Base between releases (10.0-RELEASE 
to 10.1-RELEASE, for example.)  If you run <freebsd-version -ku> it will 
print which patch level your system is at for both kernel and userland. 
  (This applies to -RELEASE, not -STABLE nor -CURRENT.)

That's it for Base. You can then customize your OS with third-party
applications to your liking.

Third-party applications (those found by clicking the "ports" link on
the FreeBSD homepage) can be installed in two ways: binary "packages"
(not to be confused with pkg (8)) or by using the ports system.

Binary packages are installed, deleted, updated, and otherwise
manipulated with the pkg (8) tool. Binary packages are compiled by
FreeBSD in roughly the same way you would compile locally.

Ports, on the other hand, are *instructions* for compiling on your local 
system. Ports do not contain the source code; a port only contains a 
Makefile script (and some other files) which is called by make (1), 
which then downloads the source code, manipulates it (./configure, 
etc.), and **turns it into a binary "package"** which is then used by 
pkg (8) just like if you had used pkg (8) to install the binary in the 
first place.  It has been suggested, though, that one should not mix the 
method of installation of third-party applications; choose either the 
use of pre-made binary packages or roll your own locally.

There are two primary ways to populate an empty ports tree at
/usr/ports: using the portsnap (8) utility or by using subversion. The
tree is then updated using the same specific tool you used to populate.

Once you have a current tree, there are generally three ways to build
the port (i.e., make a binary, executable "package" out of it): make 
(1), the portmaster (8) tool, or the portupgrade tool.  They are not 
mutually exclusive, i.e., you can install a port with <cd 
/usr/ports/category/port && make install clean> then later upgrade it 
with <portmaster category/port>.

The most important point, though, is that once a "port" or "package" is
compiled locally into a binary, pkg (8) is used to install it (this 
happens automatically by way of the Makefile). (Further, if you did not 
change the configure options when building locally, you should have 
exactly the same third-party application on you local box as you would 
have had had you just installed the binary package.) You can then use 
the considerable power of pkg (8) to delete the package, gather 
information about the package, etc.  Some of the things that can be done 
with pkg (8) can also be done with portmaster (8), so there is overlap, 
but it is your choice which to use.

Hope this helps.


More information about the freebsd-questions mailing list