Update port reinstallation instruction on wiki

Jimmy Wong wyuenho at gmail.com
Mon Oct 2 21:17:12 UTC 2023


On Oct 2, 2023 at 8:13 AM +0100, Joshua Root <jmr at macports.org>, wrote:
> On 2/10/2023 10:36, Jimmy Yuen Ho Wong wrote:
> > Currently, the Migration
> > <https://trac.macports.org/wiki/Migration#ports> guide on the wiki
> > denotes a 6-step process to restore ports after an upgrade, one of which
> > requires the user to download a script that hasn't worked properly for a
> > few years now (doesn't restore variants and ignore platform and arch).
>
> I follow the Migration instructions on every major OS update to ensure
> that they still work. I haven't noticed any problems with
> restore_ports.tcl. It restores all requested variants, including in
> non-requested dependencies, as intended.
>
> I don't know what you expect it to do with platform and arch
> information, but if there are any specific bugs, please file tickets.
>

I can't reproduce it again now that I've reinstalled all the ports manually, but I distinctly remember even after reinstalling macports-base, restoring with the myports.txt file using the Sonama base and Ventura ports lead to macports complaining about ports not having the right platform. I had to remove all the platform and arch etc information from the file to make it work.It is at this point I realized it's easier to restore with the output of `port echo request` with the versions removed.

> > I
> > propose a much simpler instruction like so:
> >
> > 3. *Reinstall your ports*
> > 1. Save the list of installed ports:
> >
> > port echo requested | sed -E s/@[^\+]+//g > requested.txt
> >
> > 2. Uninstall all installed ports:
> >
> > sudo port -f uninstall installed
> >
> > 3. Run a regular clear out of your installation:
> >
> > sudo port reclaim
> >
> > 4. Restore requested ports:
> >
> > sudo bash -c 'cat requested.txt | xargs port -v install'
> >
> > This won't necessarily restore the variants of non-requested ports
> > correctly, and will sometimes install the same port multiple times (a
> > requested port that is a dep of another requested port can be first
> > installed with its default variants, then again with its previously
> > requested variants.)
> >

Yes it will. The requested.txt files produced this way come with variants. Before xargs hit the requested port with variant, previous requested port with the same dep in a different variant will be installed, and when xargs hits the request port variant line, the requested variant will be installed and activated. If subsequent requested ports requesting the same dep in a different variant, either this means you will have to have 2 ports with different variants with the dependents pointing to the library binary directly, or you should have requested just one variant in the first instance that will satisfy both dependents. Neither case should be a part of the restoration process. The Portfile should be fixed in the first case and the second case is readily detectable with a number of port actions. Adding a 5th step to run `port reclaim` or `port rev-upgrade` will suffice.
> Ultimately the goal is to develop the 'port migrate' action to a state
> where it handles all of these considerations automatically.
> <https://trac.macports.org/ticket/56019>

That ticket hasn't moved for 6 years now and there's nothing useful written in it.
>
> - Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20231002/27511a19/attachment.htm>


More information about the macports-dev mailing list