Rebuilding all ports with portmaster

wblock@

Administrator
Staff member
Administrator
Moderator
Developer

Thanks: 3,623
Messages: 13,850

#1
This is the updated procedure to rebuild all ports with ports-mgmt/portmaster:

1. portmaster --list-origins > ~/installed-port-list
2. Update the ports tree
3. portmaster -ty --clean-distfiles
4. portmaster -Faf
5. pkg delete -afy
6. rm -rf /usr/local/lib/compat/pkg
7. Back up any files in /usr/local you wish to save, such as configuration files in /usr/local/etc
8. Manually check /usr/local and /var/db/pkg to make sure that they are really empty
9. Install ports-mgmt/pkg and then ports-mgmt/portmaster. Remove both from ~/installed-port-list.
10. portmaster --no-confirm `cat ~/installed-port-list`

This is, in fact, faster and less likely to have problems than portmaster -af.
 
OP
OP
wblock@

wblock@

Administrator
Staff member
Administrator
Moderator
Developer

Thanks: 3,623
Messages: 13,850

#4
Not exactly. The current man page is outdated and still has instructions for the old package system. This version is updated and tested for pkg(8). It was submitted as a PR: PR 191166.
 

mb2015

Member

Thanks: 16
Messages: 49

#5
Thanks for this. I tested the procedure on my 1 GHz single-core machine running 10.2-STABLE, with a handful* of ports installed, and it indeed was 30% faster than portmaster -af (not counting the time to portsnap fetch update and delays when I was AFK).

Here are a few comments—not criticisms, just trying to be helpful:

In step 8, I realize it's what the original man page said, but it seems one shouldn't expect /usr/local to be totally empty. It just should no longer contain files added by ports. It will still contain any independently created files, such as /usr/local/man/whatis (database used by whatis) and config files you created yourself.

It seems /var/db/pkg will not be empty, either, but rather will still contain a directory for each package, with a distfiles file in each one. The only things removed will be local.sqlite and vuln.xml.

The second part of step 9, remove both from ~/installed-port-list, could be done like this:
sed -I '' -E '/^ports-mgmt\/(pkg|portmaster)$/d' ~/installed-port-list

Is it necessary to say "Install ports-mgmt/pkg and then ports-mgmt/portmaster"? I ask because if you just install ports-mgmt/portmaster, you get ports-mgmt/pkg because it is a dependency. (Or is that not always true?)


* portmaster, fusefs-ext4fuse, nano, and opensmtpd ... plus their dependencies: autoconf, autoconf-wrapper-*, automake, automake-wrapper-*, dialog4ports, expat, fusefs-libs, gettext-runtime, gettext-tools, gmake, gmake-lite, help2man, indexinfo, libasr, libevent2, libexecinfo, libtool, m4, openssl, perl5, p5-Locale-gettext, pkg, pkgconf.
 
OP
OP
wblock@

wblock@

Administrator
Staff member
Administrator
Moderator
Developer

Thanks: 3,623
Messages: 13,850

#6
That part about /usr/local being empty has always kind of bugged me also. But yes, it was an effort to stick to the original text.

Yes, sed or other programs could be used to remove those entries, but what is being done is not as apparent.

It's kind of the same thing with saying to install both ports-mgmt/pkg and ports-mgmt/portmaster. What is happening is more obvious that way. Because this is a set of steps rather than a script, being explicit helps the user understand what is going on.
 

Chris_H

Daemon

Thanks: 186
Messages: 1,076

#8
I'm looking to upgrade ~950 ports on a box tracking -CURRENT I just updated. I don't suppose this method will honour the options already chosen, and stored in /var/db/ports/* ? Even without the --no-confirm ?

Thanks!

--Chris
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 6,510
Messages: 27,936

#10
I'm looking to upgrade ~950 ports on a box tracking -CURRENT I just updated. I don't suppose this method will honour the options already chosen, and stored in /var/db/ports/* ? Even without the --no-confirm ?
For poudriere you can copy them from /var/db/ports/* to /usr/local/etc/poudriere.d/<jail-name>-options/.

portmaster(8) should honor the options that are already set.
 

Chris_H

Daemon

Thanks: 186
Messages: 1,076

#11
Thanks, SirDice . Just the reassurance I was looking for! :) This is my package builder. I currently use "traditional" jails to build kernels, and packages for the STABLE_9 boxes I have. But in the process, I let this one fall behind. Of course now, if something goes awry for me. It's on you. ;)

Oooo. something shiny...

Hello marino@! I had never heard of ports-mgmt/synth before, and made by you no less. I'm going to give it a go. It looks like exactly what I'm looking for. You've never steered me wrong before. Thanks!

and to any onlookers; always be sure you have fresh dump()s before making any major changes! :)

--Chris
 
Top