rpm包信息:自增版本
我想知道是否有人知道是否有一种方法可以自动增加 rpm 包中信息的版本/发布号。
IE
rpm -qil 'package_name'
会返回类似以下内容:
Name: package_name
Version: 1.5
Release: 000001
有没有办法在每次执行 rpmbuild 时自动递增版本号? rpm 信息位于spec 文件中。
提前致谢!
I wondering if any one knew if there was a way to auto increment the Version/Release number for the information found in an rpm package.
i.e.
rpm -qil 'package_name'
Would return something like:
Name: package_name
Version: 1.5
Release: 000001
Is there a way to auto increment the release number every time i perform an rpmbuild? The rpm information is located in a spec file.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您不介意将 epoch 作为发布号,您可以这样做:
我将 0. 放在前面的原因是,如果您想使用 epoch 以外的其他内容作为发布标记,并且不更改版本,您可以能。
If you don't mind having epoch as a release number, you could do this:
The reason I put 0. in front is so if you want to ever use something other than epoch as the release tag, and not change the version, you can.
您可以尝试在 makefile 中添加如下内容:
每次运行此 oneliner 时,它都会增加以“Release:”开头的行中找到的整数。
该操作就地完成,出于安全原因,SPEC 文件的先前内容保存在备份文件中,并在文件名中附加纪元号。如果您只需要一次备份,您也可以使用“-i.BAK”之类的内容,或者如果您确定没有任何错误发生,则可以简单地使用“-i”。
You may try to add to your makefile something like:
Every time this oneliner is run, it increments the integer found in the row beginning with "Release:".
The operation is done in-place and for safety reasons the previous contents of the SPEC file is saved in a backup file with the epoch number attached to the filename. You may also use something like "-i.BAK" if you need only one backup or simply "-i" if you are sure that nothing wrong ever happens.
您还可以像这样设置 ENV 变量:
然后使用 perl 来获取它:
这就是我在 Bamboo 中构建 RPM 时将要使用的内容。
you can also set and ENV Variable like so:
and then use perl to grab it:
This is what I'm about to use when building RPMs in Bamboo.