On 2023-01-25 10:45:53 +0100, Julian Andres Klode wrote: > You want to use `apt list > '?any-version(?installed?depends(?exact-name(libpcre3)))'` > instead (with apt >= 2.5.4). In earlier versions you may use: > apt list '?any-version(?archive(now)?depends(?exact-name(libpcre3)))'
Note that this is not documented. The apt(8) man page just says list list is somewhat similar to dpkg-query --list in that it can display a list of packages satisfying certain criteria. It supports glob(7) patterns for matching package names as well as options to list installed (--installed), upgradeable (--upgradeable) or all available (--all-versions) versions. but the glob(7) man page is just about globbing pathnames. And the dpkg-query(1) man page doesn't mention anything about the above syntax (in case it would be accepted). > The behavior of patterns is better defined than that of the legacy > (r)depends tools. The behavior of rdepends here is not necessarily > useful, but it is the way it is. These commands are provided as-is > and will not receive drastic changes in behavior. > > The --installed flag here behaves exactly as it is documented. The documentation in apt-cache(8) is confusing, because "package" could either refer to a package name or to a particular version. However, the dependency relation makes sense only with a particular version. And the (r)depends entries in apt-cache(8) should suggest to use patterns instead. Moreover, it should be clear for the user how to find the documentation. > It filters the output list by packages that are installed; it > doesn't say anything about restricting matching to installed > versions only - matching always happens on all versions effectively. > > The same behavior you can get with patterns by using > > `apt list '?installed?depends(?exact-name(libpcre3))'` > > For a machine readable output, pass the pattern to apt-cache show. Apparently with the "?any-version" as mentioned above, otherwise the output is incorrect (and is even more confusing, because for instance, bti 034-6+b1 is output while this is actually only the older version bti 034-5+b1 that depends on libpcre3). But this is not documented in the man pages ("man -K any-version" finds no man pages). -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)