我可以使用 rpm 来扩展规范文件中的宏吗? [英] Can I use rpm to expand the macros in a specfile?

查看:39
本文介绍了我可以使用 rpm 来扩展规范文件中的宏吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

具体的例子是我有很多带有 Source0: 或其他包含宏的 Source 行的规范文件.如何在不实际开始构建规范文件或编写自己的解析器的情况下扩展这些宏?

The concrete example being I have lots of specfiles with Source0: or other Source lines containing macros. How can I have these macros expanded without actually starting a build on the specfile or writing my own parser?

推荐答案

您可以 grep 获取源代码行, sed 提取包含宏的字符串,然后 rpm --eval 'string' 对其进行评估.请注意,这只会扩展全局宏,而不是本规范中定义的宏.

You could grep to get the Source lines, sed to extract the string containing the macro and then rpm --eval 'string' to evaluate it. Note that this will only expand the global macros, not the ones defined in this spec.

要扩展它们,您可能需要为它们 grep 并将它们作为自定义宏文件提供给 rpm.

To expand those as well you'd probably need to grep for them and feed them to rpm as your custom macros file.

这篇关于我可以使用 rpm 来扩展规范文件中的宏吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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