如何在rpmbuild期间自动创建$ {buildroot}? [英] how ${buildroot} is created automatically during rpmbuild?

查看:113
本文介绍了如何在rpmbuild期间自动创建$ {buildroot}?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从centos 6.4中从生成的二进制包中创建二进制rpm文件,并注意到在我的一个构建系统中, $ {buildroot} 是自动创建的,我想要知道如何实现。

I want to create the binary rpm files from generated binary packages in centos 6.4 and noticed in one of my build system the ${buildroot} is created automatically, I want to know how it can be achieved.

样本 wget.spec 如下所示。详细规格在我的要旨中 https://gist.github.com/larrycai/1ffe134bce1860f1cf87

The sample wget.spec looks like below. detail spec is in my gist https://gist.github.com/larrycai/1ffe134bce1860f1cf87

%install
tar xf ~/wget.tar.gz -C %{buildroot}/

%files
%defattr(-,root,root)
/usr/bin/wget

可以创建 wget.tar.gz tar -zcvf〜/ wget.tar.gz / usr / bin / wget

当我使用 rpmbuild -bb wget.spec 进行构建时,

When I build it using rpmbuild -bb wget.spec, I got the

+ rpmbuild -bb wget.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.VNDZg4
+ umask 022
+ cd /home/larry/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.S8koPW
+ umask 022
+ cd /home/larry/rpmbuild/BUILD
+ '[' /home/larry/rpmbuild/BUILDROOT/wget-1.12-1.x86_64 '!=' / ']'
+ rm -rf /home/larry/rpmbuild/BUILDROOT/wget-1.12-1.x86_64
++ dirname /home/larry/rpmbuild/BUILDROOT/wget-1.12-1.x86_64
+ mkdir -p /home/larry/rpmbuild/BUILDROOT
+ mkdir /home/larry/rpmbuild/BUILDROOT/wget-1.12-1.x86_64
+ LANG=C
+ export LANG
+ unset DISPLAY
+ tar xf /home/larry/wget.tar.gz -C /home/larry/rpmbuild/BUILDROOT/wget-1.12-1.x86_64/
+ /usr/lib/rpm/check-buildroot
... (it is successful)

我想知道为什么行 mkdir /home/larry/rpmbuild/BUILDROOT/wget-1.12- 1.x86_64 自动执行。

I wonder why line mkdir /home/larry/rpmbuild/BUILDROOT/wget-1.12-1.x86_64 is executed automatically.

是否为此启用了任何脚本或rpmmacros?

Are there any script or rpmmacros is enabled for this ?

推荐答案

主要原因是在构建机器上安装了 redhat-rpm-config 软件包,详细列表如下

The main reason is that build machines installed redhat-rpm-config package, the detail list below

此宏设置位于 / usr / lib / rpm / redhat / macros

%__spec_install_pre %{___build_pre}\
    [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
    mkdir -p `dirname "$RPM_BUILD_ROOT"`\
    mkdir "$RPM_BUILD_ROOT"\
%{nil}

我们可以安装此软件包或将宏放入〜/ .rpmmacros

We can either install this package or put this macros into ~/.rpmmacros

我通过运行命令 rpmbuild --showrc 可以找到 mkdir 代码段在那里,所以我开始检查是否安装了特殊软件包。

I find it by running command rpmbuild --showrc can see that mkdir code segment is there, so I start to check whether there is special package is installed.

这篇关于如何在rpmbuild期间自动创建$ {buildroot}?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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