# portupgrade a list of ports



## noodlefling (Oct 6, 2018)

So, whenever I do a `portupgrade -caf`, there is always a long list of ports that don't successfully update on the first pass, I assume due to the order of the upgrades.

I could just run the same command again, but if I don't want it to take literally all day, I will go about doing the ports that didn't get upgraded one at a time.

Is there a better trick than doing this manually?  Can I feed it a list and then get the same feedback I get when I do a `portupgrade -caf`

I don't want to just have it run forever and then pick through a super-long log, I like the nice report you get when you do a full update and for whatever reason, it couldn't handle some ports.

Any suggestions?


----------



## noodlefling (Oct 6, 2018)

Testing now, I think my problem was a lack of feedback upon success, so I wasn't sure that I was getting a proper report.  If you just feed all the ports you want to upgrade like this 
	
	



```
portupgrade -f port1 port2 port3 port4
```
 you'll get a complaint if something doesn't work.

I've been using a vulnerable port with no available update as a test, throwing it into the mix of ports to be upgraded to make sure it's mentioned at the end of the run, and it is.  So I can safely assume all the other ports worked.

So, that's the solution.  I can go and have lunch and come back to a proper report without sitting at the desk going port by port, making my keyboard all greasy with lunch fingers.  I just have to be confident that no news is good news, which what I do when I do a comprehensive rebuild, so it's no more of a leap of faith than that.

The hardest part is the text-slinging to turn the failure report into a useful list of parameters.  We'll see how many times I do it manually before I break down and `grep` and `awk` my way to something easier.

At least I answered my own stupid question.  Perhaps when I run into this again years from now and I've forgotten the answer, I'll google this and help myself.


----------



## ikbendeman (Oct 29, 2018)

I think you can `pkg version -IvL "=" | pkg upgrade` or you can redirect it if pipe doesn't work... I used to copy to a local file or read directly from index somehow a long time ago, when I wrote a custom script to do that with ports tree.


----------



## SirDice (Oct 29, 2018)

noodlefling said:


> Is there a better trick than doing this manually?


Always read /usr/ports/UPDATING.


----------



## VladiBG (Oct 29, 2018)

Why are you rebuilding all ports?

*-f* options is only needed if you are doing major version upgrade between FreeBSD releases or if you want to reinstall/rebuild port. If you are only want to update your ports then the following is enough

`portsnap auto`
`portupgrade -ra`


----------



## SirDice (Oct 29, 2018)

Never just blindly run `portupgrade -ra` or `portupgrade -a`. Always, yes, *always*, read /usr/ports/UPDATING. Sometimes you need to rename or remove certain deprecated ports first, or build things in a specific order.


----------

