Hello Brock,

Friday, October 3, 2008, 3:15:10 AM, you wrote:


>>> Instead of -f which for most users looks like some kind of "force"
>>> option maybe --all would be better?
>>>
>>>   
>>>     
>> My concern is that I find it strange that -a and --all do different 
>> things. How does --all-versions sound? My guess is that this will be a 
>> rarely used option, so having it be a long option shouldn't be that 
>> painful. Other options could be --versions, -V, --av...


I like all-versions.



>>> When I was playing with it I remember that pkg.get_name() already
>>> provides you with packages sorted by version with a most recent one
>>> being returned first. So instead of doing sorting again in
>>> last_inventory() something like below is sufficient and probably more
>>> lightweight.
>>>
>>>     list_inventory()
>>>         last_name = ""
>>>         [...]
>>>
>>>                                 if pf != last_name:
>>>                                         msg(fmt_str % (pf, 
>>> pkg.get_version(),
>>>                                         state["state"], ufix))
>>>                                 elif state["state"] == "installed":
>>>                                         msg(fmt_str % (pf, 
>>> pkg.get_version(),
>>>                                         state["state"], ufix))
>>>
>>>                                 last_name = pf
>>>
>>>
>>>   
>>>     
>> I don't think image.inventory commits to returning its list in a 
>> particular order. Since sorting the list seems to take about .02 
>> seconds, I'm inclined to not depend on that feature of inventory, unless 
>> I hear that its ordering is going to remain stable.
>>
>> I tried something similar to what you suggested, and it actually ran a 
>> bit slower than the existing code. Honestly, I'm not sure why because I 
>> would've expected your approach to prove to be a bit speedier.

That's strange - nevertheless if there is no much difference it
doesn't really matter. On the other hand maybe instead of implementing
sorting and only_most_recent_version around the code it would be
better to extend api and while requesting list of packages being able
to specify if list should be sorted and/or if you are interested only
in most recent versions of packages. That way we should avoid double,
triple, etc. sorting of the same list.


-- 
Best regards,
 Robert                            mailto:[EMAIL PROTECTED]
                                       http://milek.blogspot.com

_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to