[GSoC] migration

Joshua Root jmr at macports.org
Thu Jul 27 04:57:39 UTC 2017


On 2017-7-27 08:40 , Umesh Singla wrote:
> On Sat, Jul 22, 2017 at 7:26 AM, Joshua Root <jmr at macports.org 
> <mailto:jmr at macports.org>> wrote:
> 
>     On 2017-7-21 08:22 , Umesh Singla wrote:
> 
>         For now, I'd like to ask in what order does "registry::entry
>         imaged" returns the port list? Because I'm running the sorting
>         function which the restore_ports.tcl uses but it's giving me the
>         ports in the same order as result.
> 
> 
>     Probably just ordered by rowid, i.e. might as well be random. Note
>     that the sort_ports proc from restore_ports.tcl does not take a list
>     of registry references like registry::entry returns, but a list of
>     strings representing port names, versions and variants in the format
>     generated by 'port installed'.
> 
> 
> I have a question, might be stupid but seems to confuse me for more than 
> the required time. Does the order of ports (in a portlist) followed 
> while uninstalling all of them be same as while installing them? I'm 
> trying to imagine a tree-based structure here but not quite getting the 
> picture.
> 
> I mean, does the order even matter when we want to uninstall of them?

The order to follow when uninstalling is the reverse of the order used 
when installing, i.e. dependents-first rather than dependencies-first. 
Order does matter because we check whether a port has dependents when 
uninstalling and raise an error if so. You can set a flag to ignore this 
check, but warnings will still be printed, so it's better just to do it 
in the right order.

Technically the structure of the dependency relationships of a set of 
ports is a directed acyclic graph, not a tree. A DAG can be 
topologically sorted, which is a bit like flattening a tree. When you're 
dealing with a set of ports that don't all necessarily have dependencies 
in common, only a partial ordering can be established, and that's what 
you see in the sorting done by portlist_sortdependents in port.tcl (each 
port comes earlier in the list than all its dependencies) and sort_ports 
in restore_ports.tcl (each port is later in the list than all its 
dependencies).

- Josh


More information about the macports-dev mailing list