The p2 director application has an option to list or query the content of the given p2 repositories. With -list
you'd get all units, and with -list Q:<p2 QL collection query>
you can query for a subset.
The expression needs to be a collection query, so instead of the match query in the example given above, you need to use the equivalent collection query. Also, placeholders like $1
must be replaced by the actual values.
Example: The command line to look for the all org.eclipse.sdk.ide
units in the Juno release train repository would be
eclipse -application org.eclipse.equinox.p2.director \
-repository http://download.eclipse.org/releases/juno \
-list 'Q:everything.select(x | x.id == "org.eclipse.sdk.ide")'
As a more useful example, you could use this command to find all units which are shown in categories in the p2 user interface (although I wouldn't try a large repository, the query seems to be quite slow):
eclipse -application org.eclipse.equinox.p2.director \
-repository <URL of some small repository> \
-list 'Q:everything.select(y | everything.select(x | x.properties ~= filter("(org.eclipse.equinox.p2.type.category=true)")).collect(x | x.requirements).flatten().exists(r | y ~= r))'