如何为rpmbuild每次调用设置构建区域 [英] How to set the build area for rpmbuild per-invocation

查看:135
本文介绍了如何为rpmbuild每次调用设置构建区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在修改自动构建,并希望告诉rpmbuild在调用它时使用特定的构建区域.

I'm modifying an automated build, and want to tell rpmbuild to use a specific build area when invoking it.

这类似于现有问题,但更具体

  • 我不想以root用户身份运行任何构建命令.目的只是拥有一个RPM,而不是将任何东西安装到系统中.

  • I don't want to run any of the build commands as the root user; the aim is only to have an RPM, not to install anything into the system.

我不想要求用户更改其点文件(例如$HOME/.rpmrc);构建应该是自包含的,并且不影响用户的现有设置.

I don't want to require the user to change their dotfiles (e.g. $HOME/.rpmrc); the build should be self-contained and not affect the user's existing settings.

我不想将该位置硬编码到foo.spec文件中;如果用户要在其他位置构建该文件,则该文件应可按原样使用.

I don't want to hard-code the location into the foo.spec file; that file should be useable as-is if the user wants to build in a different location.

--buildroot选项不是我所需要的;会为构建过程的make部分设置伪根文件系统,但是我需要为 entire RPM构建过程指定构建区域".

The --buildroot option is not what I need; that sets a pseudo-root filesystem for the make part of the build process, but I need to specify the "build area" for the entire RPM build process.

我正在寻找的是一个假定的--build-area FOODIR选项,可以将其提供给rpmbuild命令或等效的环境变量.因此,它应该只影响该命令的单次调用,并使其在构建区域中使用指定的用户可写位置.

What I'm looking for is a hypothetical --build-area FOODIR option that can be given to the rpmbuild command, or an equivalent environment variable. It should thus affect just that single invocation of the command and cause it to use a specified user-writable location for its build area.

我已经看到了对_topdir宏的引用,这似乎是我在说的,但似乎无法通过每次调用对其进行配置.

I've seen references to a _topdir macro that seems to be what I'm talking about, but it doesn't appear to be configurable per invocation.

如果rpmbuild可以在需要时在该位置设置自己的环境,那将是理想的选择,但是我不介意为每个构建都设置该目录,因为它可以作为构建的一部分自动进行.目标是仅在构建运行期间存在用户可写位置,然后在生成RPM文件后通过删除整个位置来进行清理.

It would be ideal if rpmbuild could set up its own environment in that location when it needs it, but I don't mind setting up the directories for that per build, since that can be automated as part of the build. The goal is to have that user-writable location exist only for the duration of the build run, and then clean up by deleting that entire location once the RPM file is generated.

推荐答案

未记录,但是 _topdir确定了构建区域.

It's not documented, but the _topdir macro determines the build area.

因此,您可以使用rpmbuild --define "_topdir ${PWD}/foobar" ...设置每次调用,以将目录设置为所需的目录.

So you can set this per-invocation with rpmbuild --define "_topdir ${PWD}/foobar" ... to set the directory to whatever you want.

--define是为任何宏设置值的键,而不仅仅是_topdir.

--define is the key to setting values for any macro, not just _topdir.

这篇关于如何为rpmbuild每次调用设置构建区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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