Bug#791345: python-apt: apt_pkg.Dependency: Documentation for smart_target_pkg is plain wrong
On Fri, Jul 03, 2015 at 05:46:28PM +0200, Michael Schaller wrote:
> Package: python-apt
> Version: 1.0.0~beta3
> Severity: minor
>
> Issues with the documentation:
> ------------------------------
> 1) The method returns an apt_pkg.Package object (or None) and not an
> apt_pkg.Version object as documented.
Not sure how this happened to be wrongly documented, probably just a
mixed those two up.
>
> 2) smart_target_pkg returns for most dependencies None which is unexpected
> as the apt_pkg.Dependency.all_targets method returns in nearly all cases
> apt_pkg.Version objects even if smart_target_pkg returns None. Once I had a
> look on the Apt's C++ code it was obvious that smart_target_pkg returns None
> for all target packages that have an empty provides list. The documentation
> for smart_target_pkg doesn't even mention the word "provides" though.
Oh well, it did not do that when I wrote the documentation IIRC.
> 5) Looking at the C++ code the first best package which meets the view
> criteria is retured and the rest aren't even looked at. Hardly a ‘natural
> target’ if you ask me.
>
>
> My conclusion:
> --------------
> To me it looks like smart_target_pkg is a very special helper function
> within Apt and not useful for python-apt at all. smart_target_pkg itself is
> only twice used within the whole Apt codebase:
> https://anonscm.debian.org/cgit/apt/apt.git/tree/apt-pkg/algorithms.cc?id=439b024abe8fd6b8227a8b2869aab65a1186cfda#n580
> https://anonscm.debian.org/cgit/apt/apt.git/tree/apt-private/private-output.cc?id=439b024abe8fd6b8227a8b2869aab65a1186cfda#n680
>
> IMHO smart_target_pkg should be removed as all_targets is the better
> alternative. If smart_target_pkg should stay then I recommend to fix its
> documentation and to add target_pkg as well.
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.
--
Julian Andres Klode - Debian Developer, Ubuntu Member
See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.
Be friendly, do not top-post, and follow RFC 1855 "Netiquette".
- If you don't I might ignore you.
Reply to: