Migration question and binary question

Joshua Root jmr at macports.org
Thu May 8 22:39:41 PDT 2014


Jerry wrote:
> I am considering using the "Automatically reinstall ports" suggestion whereby a script is downloaded which script then works with a previously saved myports.txt. If I do this, will the script install old versions of ports which had not been active? I'm thinking that this might be a good time to do some decrufting and I would like to consider these old inactive versions as mostly cruft and not reinstall them.

As Ryan said, it can only install the current version of each port. But
if you have a port installed with different variants, it will reproduce
that. E.g. if you start with this:

foo @1.0_0
foo @1.0_0+bar (active)
foo @1.1_0

then if 1.1 is the current version of foo, after running restore_ports
you will have:

foo @1.1_0+bar (active)
foo @1.1_0

After you generate myports.txt, it's worthwhile to glance through it and
delete any lines you don't want any more, as well as to adjust some of
the variants if desired, as Brandon suggested.

Brandon Allbery wrote:
> On Thu, May 8, 2014 at 6:26 PM, Jerry <lanceboyle at qwest.net> wrote:
> 
>> I redirected this output to .txt files. Do you have a quick way (script)
>> to use these echoed files during reinstallation?
> 
> 
> I don't need to do it often enough to script it, I generally build it on
> the fly :)
> 
>     port echo active and requested | perl -lpe 's/[ \t]+\@[^-+]+/ /;
> s/^/port install /'
> 
> Output is something you can feed to /bin/sh, via sudo; you may want to
> check it for sanity and possibly add/remove some things manually. One thing
> it doesn't deal with is possible changes in default variants, because it's
> difficult to script. For example, the default perl5 variant has changed
> from +perl5_12 to +perl5_16 within the past several months --- you may want
> to take the chance to upgrade stuff to the new default rather than
> propagating the old. It also doesn't try to deal with dependencies, so
> there is some chance that a dependency of something earlier in the list
> will install with default variants something later in the list with an
> explicit variant; there's no good way to deal with this in MacPorts
> currently, especially when variants can alter dependencies (and I'm not
> sure that a "good way to deal with this" even exists).

Handling variants of dependencies correctly is precisely why
restore_ports.tcl exists. The lack of automatic preservation of the
requested flag is an annoyance, certainly, but you can get around it by
running this at the same time you generate myports.txt:

port echo requested | cut -d ' ' -f 1 > requested.txt

and this after you've run restore_ports.tcl and 'port unsetrequested
installed':

< requested.txt xargs port setrequested

- Josh


More information about the macports-users mailing list