RPM规范文件可以“包含"吗?其他文件? [英] can an RPM spec file "include" other files?

查看:53
本文介绍了RPM规范文件可以“包含"吗?其他文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RPM规范中是否存在一种包含"指令?我无法通过谷歌搜索找到答案.

动机:我有一个RPM规范模板,构建过程会使用版本,修订和其他特定于构建的数据对其进行修改.目前,这是通过 sed 完成的.我认为,如果规范会 #include 一个特定于构建的定义文件(由构建过程生成)会更干净,因此我不需要在规范中进行搜索和替换./p>

如果没有 include ,是否有一种惯用的方式来执行此任务(我认为很常见)?

解决方案

RPM不支持包含.

我已经解决了类似的问题,无论是使用m4宏处理器还是仅连接规范的一部分(当"include"在开头时).

如果您只需要在构建时传递几个变量,而不必包含另一个文件中的几行,则可以运行

  rpmbuild --define'myvar SOMEVALUE'-bb myspec.spec 

,您可以在规范中使用%myvar.

Is there a kind of "include" directive in RPM spec? I couldn't find an answer by googling.

Motivation: I have a RPM spec template which the build process modifies with the version, revision and other build-specific data. This is done by sed currently. I think it would be cleaner if the spec would #include a build-specific definitions file, which would be generated by the build process, so I don't need to search and replace in the spec.

If there is no include, is there an idiomatic way to do this (quite common, I believe) task?

解决方案

RPM does not support includes.

I have solved similar problems with either m4 macro processor or by just concatenating parts of spec (when the "include" was at the beginning).

If you only need to pass a few variables at build time, and not include several lines from another file, you can run

rpmbuild --define 'myvar SOMEVALUE' -bb myspec.spec

and you can use %myvar in the spec.

这篇关于RPM规范文件可以“包含"吗?其他文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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