[Aptitude-devel] Search term for existence

Daniel Burrows dburrows at debian.org
Wed Feb 4 15:50:22 UTC 2009


On Wed, Feb 04, 2009 at 03:35:00PM +0100, Martin Stjernholm <apt at stjernholm.org> was heard to say:
> My real use case is this:
> 
> I want to report auto packages that are ambiguous, i.e. packages that
> are satisified by automatic installs that could be satisfied by other
> (currently uninstalled) packages as well. This means that the report
> should include packages that are provided by both at least one
> autoinstalled package and at least one uninstalled package. It'd be
> like this using ?exists (linebreaks inserted for readability):
> 
>   ?for p: (?=p
>            ?exists(?provides(?=p) ?automatic)
>            ?exists(?provides(?=p) !?installed))

  I see.  BTW, "?for p: ?=p" is a synonym for "?true". :-)

  I think that you can get a similar effect with

  "?reverse-provides(?installed?automatic) ?reverse-provides(!?installed)"

  This will be a lot faster, since it doesn't have to scan the entire
list of packages for each package it tests.

  But IMO what you really want is:

  ?for p: ?reverse-depends(?depends(!?widen(?installed)
                                    !(?widen(?=p) |
                                       ?reverse-provides(?widen(?=p)))))


  i.e., what has a reverse-dependency that has a dependency that
is not the same package as p.  (?widen is probably redundant here, but
I added it for clarity)  This will return packages that are part of an
ORed dependency and packages that are a real package provided by
something else.

  At the same time, it won't answer the question you want, since if you
have

A Depends: B | C
D Depends: B

  it will return B as a possibly ambiguous install.  I don't think you
can get around that with the current search language -- it might need
an "exists", or better yet, an "exists" constrained to the current
"search window".  If we call that ?any, and its dual ?all, maybe
something like

  ?for p: ?reverse-depends(?not(?any(
    ?depends(?all(!?widen(?installed)
                  !(?widen(?=p) | ?reverse-provides(?widen(?=p))))))))

  to say that we want packages P where not a single reverse-dep has a
dependency where every target is the same package as P.

  I've thought a couple times about trying to add this, but I never
could figure out straightforward semantics that were also intuitive
and backwards-compatible.  e.g., should ?all there refer to all the
targets of *one* dependency of a package, or all the targets of *all*
dependencies, and once we have chosen one meaning, how do we get the
other one as an option?  And how do we choose consistently in all cases?
And will the default behave as expected for simple cases like
?not(?depends(?installed))?

  Daniel



More information about the Aptitude-devel mailing list