如何为不同的环境使用相同的路径创建RPM子包? [英] How to create RPM subpackages using the same paths for different envs?

查看:89
本文介绍了如何为不同的环境使用相同的路径创建RPM子包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用rpm为不同的环境(实时,测试,开发人员)但为相同文件构建子软件包,因此有一个名为name-config-live的软件包,一个名为name-config-testing的软件包和一个名为name-config-developer并在其中具有相同的路径,但每个路径都具有与它所命名的环境相对应的配置. 例如

假设在所有环境中我都有一个名为/etc/name.conf的文件,在测试中我希望该文件包含"1",在开发中"2"并在活动"3"中.是否可以在同一规范中执行此操作,因为子包的生成只发生在最后,而不是按我输入的顺序进行. (希望不是%post -n)

我尝试使用BuildRoot,但这似乎是全局属性

解决方案

我不认为这是一种本机方法.我会像您提到的那样执行%post.

但是,我会这样做(类似于我为工作而开发的内部专用软件包所做的事情):

  1. 三个独立的文件/etc/name.conf-developer/etc/name.conf-live
  2. 是否所有三个软件包都提供了一个虚拟软件包,例如name-config
  3. 主程序包需要name-config
    • 这将使rpmyum或需要在同一事务中至少安装一个的任何东西
  4. 三个软件包都相互冲突
  5. 具有每个配置包的%post(可能还有%verify)符号链接/etc/name.conf到正确的配置
    • 这也有助于向用户显示正在发生的事情

缺点:

  1. 有点黑
  2. rpm --whatprovides /etc/name.conf会说它不属于任何软件包

I would like to use a rpm to build subpackages for different environments (live,testing,developer) but for the same files, so having a package called name-config-live, one called name-config-testing and one called name-config-developer and in them to have the same paths but each with the configs corresponding to the environment it's named after. as an example

let's say on all environments I have a file called /etc/name.conf and on testing I want it to contain "1", on development "2" and on live "3". Is it possible to do this in the same spec since the subpackage generation only happens last not in the order I enter it. ( and hopefully not with %post -n )

I tried using BuildRoot but it seems that's a global attribute

解决方案

I don't think there's a native way; I would do a %post like you had noted.

However, I would do this (similar to something I do with an internal-only package I develop for work):

  1. Three separate files /etc/name.conf-developer, /etc/name.conf-live, etc.
  2. Have all three packages provide a virtual package, e.g. name-config
  3. Have main package require name-config
    • This will make rpm, yum, or whatever require at least one be installed in the same transaction
  4. Have all three packages conflict with each other
  5. Have each config package's %post (and possibly %verify) symlink /etc/name.conf to the proper config
    • This also helps show the user what is happening

Cons:

  1. It's a little hackish
  2. rpm --whatprovides /etc/name.conf will say it is not owned by any package

这篇关于如何为不同的环境使用相同的路径创建RPM子包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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