使用p2查询语言在p2存储库中查找单位的命令行 [英] Command line to find units in a p2 repository using p2 query language

查看:139
本文介绍了使用p2查询语言在p2存储库中查找单位的命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

p2具有查询语言,该语言允许对p2存储库的内容进行查询.但是,文档中的所有示例都假定该查询语言是在Java内部使用的,例如

p2 has a query language that allows to run queries on the content of a p2 repository. However all examples in the documentation assume that the query language is used from within Java, e.g.

IQuery<IInstallableUnit> q = QueryUtil.createMatchQuery("this.id == $0", id);
metadataRepository.query(q);

如何在不编写我自己的Java应用程序的情况下从命令行执行查询?

How can I execute a query from the command line (without writing my own Java application)?

推荐答案

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.

表达式必须是一个集合查询,因此您需要使用等效的集合查询来代替上面给出的示例中的匹配查询.同样,必须将$1之类的占位符替换为实际值.

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.

示例:在Juno发布培训存储库中查找所有org.eclipse.sdk.ide单元的命令行将是

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

作为一个更有用的示例,您可以使用此命令查找在p2用户界面中类别中显示的所有单位(尽管我不会尝试使用大型存储库,但查询速度似乎很慢):

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

这篇关于使用p2查询语言在p2存储库中查找单位的命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆