force rebuild a port

Richard L. Hamilton rlhamil at smart.net
Fri Apr 5 20:13:38 UTC 2024


My harfbuzz (on Monterey) was outdated. So I did this:

port -v upgrade harfbuzz
--->  Computing dependencies for harfbuzz.
--->  Fetching archive for harfbuzz
--->  harfbuzz-8.4.0_0.darwin_21.x86_64.tbz2 doesn't seem to exist in /opt/local/var/macports/incoming/verified
--->  Attempting to fetch harfbuzz-8.4.0_0.darwin_21.x86_64.tbz2 from https://packages.macports.org/harfbuzz
[...]

The -v  generates relatively verbose (thus the "v")  messages. It can be combined with other options, and goes after "port" and before a command like "upgrade".

Note the name of the file it downloaded, which includes an architecture. This was an archive of precompiled port, already successfully built on the build servers. So of course it was very fast to install, no compiling needed, just deleting, unarchiving, copying files around, etc.

Not everything can be precompiled like that; for some things, incompatible licenses prevent distributing binaries (ffmpeg with the +nonfree option which gives more codecs, is like that); and a few ports may try to do processor model specific optimizations; maybe there are other reasons. Ports are also only pre-built for default variants; if you request different variants or have different default variants configured, there won't be binaries available. Binary builds sometimes fail on the build servers, and are not always equally available for all macOS versions. (IMO, build failures on the build servers ought to automatically generate tickets; that might mean more build problems would be fixed before users saw them; but maybe there's reasons that doesn't happen.)

The global option (goes after "port", like -v) "-b" will only install or upgrade if binaries are available. The global option "-s" will install from source even if they are available.

A URL like https://ports.macports.org/port/harfbuzz/builds/ <https://ports.macports.org/port/harfbuzz/builds/>

in your browser (but put in the port name you want in place of harfbuzz) will show what if anything is pre-built for that port. Other views are available, but don't ask me if there's one that shows everything pre-built for a specific macOS version; if there is one, I haven't found it. I'm just another user, not a maintainer, and not familiar with everything; I knew some of these things were possible, but had to dig a bit to be able to describe them.

> On Apr 5, 2024, at 12:36, Riccardo Mottola <riccardo.mottola at libero.it> wrote:
> 
> Hi Richard,
> 
> last week I did a test and it worked, but it was not what I needed. Probably it was a port already in need to upgrade.
> I have a system now where all ports are up-to-date (as of "port outdated").
> 
> If I issue e.g.
> 
> port -n upgrade --force --no-rev-upgrade gtk2
> 
> 
> It takes it time to recompile gtk2... I actually see "Building gtk2" [* * *]
> 
> If I do
> 
> port -n upgrade --force --no-rev-upgrade harfbuzz
> 
> 
> it completes in a matter of seconds... and the ol' MacBook isn't that fast :)
> 
> I see cleaning, uninstalling, cleaning, installing activating, cleaning... but never configure/building!
> Why?
> 
> Regards,
> Riccardo
> 
> Richard L. Hamilton wrote:
>> To explain:
>> 
>> -n prevents rebuilding ports that the ports being upgraded (works with install too I suppose, but there should be no need for that) depend on; it may cause failure if they're not already installed and up-to-date
>> 
>> --force forces upgrading even of a port that's current; but without the -n, that would apply to everything it depends on too, which is slow and might cause more problems (esp. if there are issues with any of the build tools used)
>> 
>> --no-rev-upgrade because while the check for broken ports is usually good, it might get in the way in this sort of situation; and because one might be repeating the command one port at a time for more than one port (separate commands so it tries them all even if one fails), and since the check is a bit slow, that saves time
>> 
>> This is rather far down the list of what one should try, because normally -n is not a good idea (although it can make sense to limit --force), and because ideally one would just do "port upgrade" and let it sort out what needs doing. But clearly it helps sometimes when things aren't right and you don't want to do more than necessary.
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20240405/4092fb41/attachment.htm>


More information about the macports-users mailing list