Portmaster - understanding it better

I am reading the man page for portmaster a few times trying to get a through understanding of it. I realize 'it' will come to me over time. But in the meantime, is there another document I can read that will be more quicker understand what all the flags (and their combinations) really mean, and thus depending on what I am trying to do will determine what options I execute.

The forum has lots of posts where people say I am doing this and then others chime in and say should be doing it differently. So I want to understand portmaster intimately, and while I think the man page is a great document, I want to read other stuff.

Any recommendations?

Thanks again,
Packet Man
 
Hi.

I can't say as I'm aware of any other actual documentation other than the man page for portmaster(8). You could read through the code as portmaster(8) is just a rather large sh(1) script. Instead of asking a general question though, it might be easier to ask more specific questions in the context of what your trying to accomplish as you go along and learn.

Regarding seeing conflicting information, as with all UNIX/UNIX-like operating systems, there are many times multiple ways to accomplish the same goal, so the posts your reading are not always conflicting but different paths to the same destination depending on the users goals and experience. If you get an answer to a question you don't understand or is confusing on the forums don't be afraid to say your confused or it doesn't make sense to you. Many times an experienced user will chime in and correct an incorrect answer and/or explain things in more detail. :)
 
Well why would I use the -a flag? Or why would I not use the -a flag? Why would I use -a with -f if -f is going to do a force rebuild anyways? Why would I use --update-if-newer; doesn't -a do the same? Doesn't -f -R do the same? Why would I want to use --always-fetch? Why would I -f (always rebuild) even if the port is already up to date? Why can't I use --update-if-newer on a single portmaster <port> command, even though its gonna call all the required dependencies into check.

I realize these questions are not really related to portmaster, but then again they are. If this is the recommended tool to get the job done, what better tool to provide more documentation around.

I have no issue asking question, you folks should already know that! :p But I'm a bit older school too; stop, size up the situation, do some reading/learning, learn by fire, ask when necessary.

Even if I had an examples 'cookbook' to supplement the examples already provided.
 
I'm sure you've looked at /usr/local/share/portmaster.rc.sample. My reasons for using less packages, is that sometimes it's been built differently than how it's done in ports, causing inconsistency then broken features when running the built program. Using packages for build-only-dependencies usually doesn't harm builds.

Maybe it depends if you want the newest port, or if you like fresh installations of the updated code. Minor dependencies change often, and rebuilds allow the programs to be built with those changed dependencies. Perhaps it depends on your method of keeping builds functioning the way you like.
 
Use -a when there are no further special instructions in /usr/ports/UPDATING. And only use it after checking that file. I don't know what --update-if-newer does, I never use it.

This is my attempt to document a "best practices" type of upgrading ports: Upgrading FreeBSD Ports.

Okay, but section 23.2.3.2 doesn't say that, and IMHO it says after a major upgrade to do a portmaster -af. Thanks for that link wblock I'll look into it soon. Let me ask this question, lets say portmaster -L --index-only| egrep '(ew|ort) version|total install' tells me a whole bunch of ports need updating (but not all obviously), what should I do? And does what I should so depend on whether I did a minor or major OS release upgrade?
 
Pretty much. Unless a portmaster(8) flag is specified in /usr/ports/UPDATING, don't use any flags besides the -a flag when upgrading ports. The exception is the -f flag that can be used with the -a flag to rebuild every installed port which should be done after a major FreeBSD upgrade. wblock@ has a HOWTO on this procedure in Thread 51210. If you want to experiment, you can add the -n flag to the command for a dry run that will run through the command steps, but not change anything.
 
Okay, but section 23.2.3.2 doesn't say that, and IMHO it says after a major upgrade to do a portmaster -af.

-af is not the same as -a. The -f means "rebuild the port even if it does not need to be rebuilt". This is a short way to rebuild all ports, although it takes more time than the correct way.

Thanks for that link wblock I'll look into it soon. Let me ask this question, lets say portmaster -L --index-only| egrep '(ew|ort) version|total install' tells me a whole bunch of ports need updating (but not all obviously), what should I do?

Read that article first. Then, as always (yes, always), check /usr/ports/UPDATING for any new steps that have been added since the last time you upgraded ports. If they apply to your system, either because they are specific for a particular port you have installed or because they must be run on all systems, do them. After completing those steps, check for ports that still need to be updated. It is safe to use -a to upgrade those.

And does what I should so depend on whether I did a minor or major OS release upgrade?

As far as ports are concerned, a minor version upgrade does not matter at all. After a major version upgrade, all ports must be rebuilt.
 
-af is not the same as -a. The -f means "rebuild the port even if it does not need to be rebuilt".

Right, I knew that. I guess what I was trying to say is I am reading that what you are saying is different than what the handbook says. Thus an example I why I would like to learn intimately what the portmaster options, and their combinations do. :)
 
Righto thanks. Let me ask about this scenario. When a port is installed for the first time, or upgraded / forced reinstall a pkg is created and stored on the system right? Now obviously after a major release update all ports should be reinstalled, even if there is no update available for at least some of the ports. So, to save time, and simply be efficient, can I use portmaster options to (a) reuse previous pkg's for those ports that do not have updates and still complete 'force reinstall', and (b) download the new port code for those that do have updates? The --packages, and --packages-build option comes to mind here. If I can do this why would I not want to use the pkg code that was previously compiled from either a previous install, or previous update via portmaster.
 
Packages that were built for the previous version of FreeBSD will not work anyway. That is why things have to be rebuilt. Or you can download packages that have been built for the newer version of FreeBSD.
 
So when my force rebuild gets aborted due to an issue I fix the issue and them move on. I was doing this locally on the box, but now am doing it remotely. Normally I would copy/paste the whole restart list, but it looks like when I do it remotely the list is too large to paste the whole thing in. So I suppose I have two choices, paste in what it will take and then pick up the rest later and do that.

Or I simply restart the whole process using the -a -f and -R flags. (I am also using -B -D -G --no-confirm). Am I correct in thinking that portmaster will scan through the whole list again, notice that a bunch of ports have the install flag set and thus skip over them? That is what it mostly looks like, but I am not 100% sure that it doesn't re-do some ports already rebuilt.
 
So when my force rebuild gets aborted due to an issue I fix the issue and them move on. I was doing this locally on the box, but now am doing it remotely. Normally I would copy/paste the whole restart list, but it looks like when I do it remotely the list is too large to paste the whole thing in. So I suppose I have two choices, paste in what it will take and then pick up the rest later and do that.
That can cause problems, because the output is sorted by port name, but portmaster sorts and builds them in dependency order.

I'd suggest running it with something like script(1) so that when it fails, the list of ports remaining to be built can be copied from the log file. If I were working on ports-mgmt/portmaster (and I'm not, sh is a terrible programming language), I'd have it save that output to a log file. Maybe that is what -H does.
 
Thanks wblock@. What about my 2nd option? Just restarting the whole process using the -a -f and -R flags? Am I correct in thinking that portmaster will scan through the whole list again, notice that a bunch of ports have the install flag set and thus skip over them?
 
So when I initially run portmaster -a -f I get asked if I want to clear previous install flags. So let's say I say yes the first time around, and lets say 40% of the rebuild is done when something goes wrong and I get an abort. Assuming I have address the issue to cause the abort, can I use the -a -f -R to force rebuild only the remaining (60%) ports that have not already been rebuilt? Doesn't the -R cause portmaster to skip over the previous 40% of the ports because they have already been rebuilt, thus their install flag is set to yes?
 
That can cause problems, because the output is sorted by port name, but portmaster sorts and builds them in dependency order.

I'd suggest running it with something like script(1) so that when it fails, the list of ports remaining to be built can be copied from the log file. If I were working on ports-mgmt/portmaster (and I'm not, sh is a terrible programming language), I'd have it save that output to a log file. Maybe that is what -H does.

About the -H option. I use it regularly (not on command line, in the global options file /usr/local/etc/portmaster.rc, the option is HIDE_BUILD). The option tells portmaster to create the log file for each port in directory /tmp. The name of the log file has the form (here for ports-mgmt/pkg):
Code:
port_log-74463-pkg.oHy5fQ6A
where 74463 is the portmaster instance PID that execute the installation/upgrading and pkg the name of the package. The file will be deleted if no errors, otherwise you can view it for errors (and delete it).
 
Using the -a and -f flags will override the -R flag.

Are ya sure?

Where in the man page do I read that? I am referring to this:

"-R used with the -r or -f options to skip ports updated on a previous
run. When used with -r it will also prevent the rebuild of the par-
ent port if it, and all of its dependencies are up to date."
 
What is really missing is the support for creating a local package repository using ports-mgmt/portmaster so that you could use pkg-upgrade(8) with that local repository.

That's what ports-mgmt/poudriere is for, though.

The most useful Portmaster feature I can think of that's currently broken is --packages-build, which fetches and installs build dependency packages rather than building their ports. Some ports depend on other, much larger ports to build, but not run. Building the latest version of GCC or Clang or LLVM often takes longer than building the port for which it is needed, and leaving build dependencies installed is hardly optimal since leaving them around prevents the use of pkg autoremove to remove totally unneeded packages. You could use pkg-set(8) to switch them to explicitly installed packages, but then you'd just have to rebuild them eventually anyway.

PacketMan: that's the use of the -a and -f flags, not or. portmaster -af installs updates while rebuilding any ports that either depend upon or are dependencies of the upgraded ports.
 
Are ya sure?
Yes.
Where in the man page do I read that? I am referring to this:

"-R used with the -r or -f options to skip ports updated on a previous
run. When used with -r it will also prevent the rebuild of the par-
ent port if it, and all of its dependencies are up to date."
Both the -a and -f flags together rebuild every installed port regardless of there being and update available or being a dependency of another port. If there is an update, the port is updated as well. If a port was just rebuilt from a previous portmaster(8) run, running # portmaster -af again will rebuild it anyway as that's what you've told portmaster(8) to do (force a rebuild of every single installed port).
 
Righto protocelt, thanks again.

Two last questions, for now:
  1. How can I use portmaster to find installed ports that are not needed, and deinstall/clean them.
  2. How can I use portmaster to find the path to a port that is needed to install say for example library file?

Maybe portmaster is not the tool for this? I know for #2 a lot of time the port will document the dependencies and include the path, but sometimes during an abort this is not so obvious. How do I easily find the path/port wihtout asking on this forum all the time? I tried using ports-mgmt/psearch but that did not work for me. Is there another thread on here I should be reading?

As for #1 I just want to do regular maintenance and prune out any ports, libraries, etc, that are not needed. I'm guessing the answer is there would be multiple commands, and there is another thread that covers that? Been reading the handbook, and one of my older published FreeBSD books, but thought I ask the friendly folks here. :)
 
Back
Top