On 07/07/2015 10:29 PM, Julian Andres Klode wrote:
I agree that dropping smart_target_pkg immediately would be rude and could break existing code. Though I didn't find any public code that would use smart_target_pkg: https://searchcode.com/?q=smart_target_pkgOn Fri, Jul 03, 2015 at 05:46:28PM +0200, Michael Schaller wrote: I'm not sure I want to drop it. We don't have any users in the archive, but that seems a bit rude (Package.auto, the only removed attribute, was a different case, that one always returns 0). Do you have a patch for the documentation? That would be great. If not, that's fine too, but I won't come up with one a week before this semester's exams start, so it will have to wait until DebCamp. We can deprecate it, though. Not sure what mvo thinks.
If someone really has working code that utilizes smart_target_pkg from Python then I would certainly like to see it to understand for what they use it. Especially the point that smart_target_pkg only returns one package at most, albeit there could be multiple suitable, makes this method rather dangerous. As I have no clue how someone would use it deprecating sounds really like the way to go to me.
Maybe this should be even deprecated in Apt itself as it is only used in 2 spots. A search for public code that uses SmartTargetPkg revealed only one project (besides Apt) that uses it and that code seems to be a straight copy from Apt's code: https://searchcode.com/?q=SmartTargetPkg
Fixing the documentation would also not be easy because Apt's documentation of this particular method doesn't make sense to me either:
-----DepIterator::SmartTargetPkg - Resolve dep target pointers w/provides ---------------------------------------------------------------------
This intellegently looks at dep target packages and tries to figure out which package should be used. This is needed to nicely handle provide mapping. If the target package has no other providing packages then it returned. Otherwise the providing list is looked at to see if there is one one unique providing package if so it is returned. Otherwise true is returned and the target package is set. The return result indicates whether the node should be expandable In Conjunction with the DepCache the value of Result may not be super-good since the policy may have made it uninstallable. Using AllTargets is better in this case. ----- My attempt for a new documentation would be bold honesty: -----smart_target_pkg is an Apt internal helper function that shouldn't be part of python-apt's API. This method has been deprecated and will be removed in future releases.
-----Julian, I wish you all the best for your exams. I'm glad that I don't have this stress anymore and so I really empathize with you. I hope for you that at least the excruciatingly hot weather in Germany doesn't affect your exams.