Command line to find units in a p2 repository using p2 query language

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 00:00:20

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))'

p2diff tool written by Ian Bull is is well worth mentioning. His article provides an overview of the p2 API and introduces some of the key concepts that should be understood to work with the p2 API.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!