GSOC09 MacPorts GUI

Joshua Root jmr at macports.org
Fri Jul 17 12:49:22 PDT 2009


On 2009-7-18 04:58, Juan Germán Castañeda Echevarria wrote:
> The framework
> gets the list roughly in this way:
> 
>    1. performs a mportsearch with the regex ".+".
>    2. Transforms the returned list to a Cocoa NSDictionary.
>    3. Creates a MPPort object for each entry in the NSDictionary (i.e.
>       one per port)
>    4. Iterates over the MPPort objects setting their state to Not Installed
>    5. performs a registry::installed to get the list of installed ports
>    6. Transforms the returned list to a Cocoa NSDictionary
>    7. Creates a MPReceipt
>    8. Iterates over the MPRecipt objects changing the corresponding
>       MPPort object state (Installed, Active, Outdated). 
> 
> As you can see, It is a very complicated process and I haven't worked in
> make it faster. If anybody has some recommendation, I'll be glad to hear it.

The macports API could do with a proc that just returns the list of all
ports in the index, which should be faster than using mportsearch to do
the same thing. The other place where a lot of time is probably being
spent is registry::installed. Unfortunately the flat-file registry has
performance issues that can't be addressed without switching to a new
format (i.e. registry2.0).

Make sure you profile and find out for certain where you should be
focusing your optimisation efforts.

>     Also there is the possibility to have ports installed which are no
>     longer in the index. They can be found with port(1) using the 'obsolete'
>     pseudo-port on trunk. I think those would not be shown at all in the
>     current port list.
> 
> 
> I haven't thought of that, I think I can add it to my TODO and come with
> a solution. If I can get the list, It shouldn't be difficult to add.  

These will be in the list returned by registry::installed, so if you
take the union of the two lists (taking into account that the full
PortInfo won't be available for all ports) it should work as desired.

- Josh


More information about the macports-dev mailing list