如何设置 rpmbuild 目标文件夹

发布于 2024-08-31 15:27:12 字数 270 浏览 5 评论 0原文

我注意到 rpmbuild(-bb 和 --buildroot 选项)根据您使用的操作系统在不同位置创建 .rpm:

  • GNU/Linux Ubuntu <= 9.04: /usr/src/rpm/...
  • GNU/Linux Ubuntu >= 9.10: /home/rpmbuild/...
  • GNU/Linux Fedora: /usr/src/redhat/...

那么如何手动设置所有操作系统的目标文件夹呢?

I noticed rpmbuild (-bb and --buildroot options) creates the .rpm in different locations depending of what OS are you using:

  • GNU/Linux Ubuntu <= 9.04: /usr/src/rpm/...
  • GNU/Linux Ubuntu >= 9.10: /home/rpmbuild/...
  • GNU/Linux Fedora: /usr/src/redhat/...

So how can I set manually the destination folder for all OS?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

别想她 2024-09-07 15:27:12

回复我自己,添加:

%define _rpmdir /outputdir

到 .spec 文件。

Replying myself, adding:

%define _rpmdir /outputdir

to .spec file.

左耳近心 2024-09-07 15:27:12

您可能需要使用命令参数 --define :例如,这会将 rpm 文件发送到当前目录。

rpmbuild anything.spec --bb --define "_rpmdir $(pwd)"

这将发送 rpmsto 输出目录

rpmbuild anything.spec --bb --define "_rpmdir /outputdir"

或者更复杂的东西,例如 rpmbuild 的自定义 gradle 任务 .

You may want to use the command argument --define : For example, this will send the rpm files into the current directory.

rpmbuild anything.spec --bb --define "_rpmdir $(pwd)"

This will send the rpmsto output dir

rpmbuild anything.spec --bb --define "_rpmdir /outputdir"

Or perhaps something more complicated such as Custom gradle task for rpmbuild .

深海少女心 2024-09-07 15:27:12

对我来说,解决方案是将 _topdir 设置为项目内名为 rpmbuild 的子目录。我还设置了一些宏来控制 .rpm 路径:

rpm:
rpmbuild -bb package.spec -D "_topdir $(shell pwd)/rpmbuild"  -D "SRC $(shell pwd)" -D "NAME $(NAME)" -D "ARCH $(ARCH)" -D "VERSION $(VERSION)" -D "RELEASE $(RELEASE)"
mv rpmbuild/RPMS/$(ARCH)/$(NAME)-$(VERSION)-$(RELEASE).$(ARCH).rpm ./
rm -rf rpmbuild

然后我使用 ma​​ke 生成 .rpm 文件并移动它。我更喜欢 rpmbuild 在其目录中运行。

make rpm

package.spec正在使用这些宏,例如

Name:           %{NAME_PACKAGE}

For me the solution was to set _topdir to a subdirectory called rpmbuild inside my project. I also set a few macros, to control the .rpm path:

rpm:
rpmbuild -bb package.spec -D "_topdir $(shell pwd)/rpmbuild"  -D "SRC $(shell pwd)" -D "NAME $(NAME)" -D "ARCH $(ARCH)" -D "VERSION $(VERSION)" -D "RELEASE $(RELEASE)"
mv rpmbuild/RPMS/$(ARCH)/$(NAME)-$(VERSION)-$(RELEASE).$(ARCH).rpm ./
rm -rf rpmbuild

Then I use make to generate the .rpm file and move it. I prefer rpmbuild to operate inside its directory.

make rpm

package.spec is using these macros, e.g.

Name:           %{NAME_PACKAGE}
不弃不离 2024-09-07 15:27:12

只是一个小小的评论..
AIX 操作系统中的 rpmbuild 也支持将“%define _rpmdir /outputdir”添加到spec文件中

Just a tiny comment..
adding "%define _rpmdir /outputdir" to spec file is also support by rpmbuild in AIX OS

鯉魚旗 2024-09-07 15:27:12

在 /home/ 中设置 rpmbuild 环境 http://www.linuxquestions.org/questions/linux-software-2/need-rpm-package-for -php-version-5-2-7-and-up-on-redhat-5-1-a-766486/#13

实际上不建议使用/usr/src/**。即通过使用 /home/[name]/rpms/ 您可以作为非特权用户工作。构建包不需要 su 或 sudo。



Setting up the rpmbuild environment in /home/ http://www.linuxquestions.org/questions/linux-software-2/need-rpm-package-for-php-version-5-2-7-and-up-on-redhat-5-1-a-766486/#13

Actually it is not recommended to use /usr/src/**. I.e. by using /home/[name]/rpms/ you can work as unprivileged user. No su or sudo is required to build packages.


~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文