gpt4 book ai didi

centos - rpmbuild 没有那个文件或目录

转载 作者:太空宇宙 更新时间:2023-11-03 17:16:35 30 4
gpt4 key购买 nike

我只是在学习为一些从源代码编译的自定义构建的软件制作 rpm 包(一些遗留的东西需要这个,所以我正在努力学习,因为一些包不能使用最新版本),但是遇到错误(我在 Vagrant 中以 root 身份执行此操作,但通常我尽量不使用 root,因为我知道它有可能造成损坏,只是这个示例似乎需要对 root 进行一些更改)。

sudo rpmbuild -ba testspec.spec --define "_topdir /tmp/"

到目前为止,它看起来正在使用我预期的目录,/tmp/rpmbuild

make[2]: Entering directory `/tmp/rpmbuild/BUILD/exim-4.80.1/build-Linux-x86_64/pdkim'
make[2]: `pdkim.a' is up to date.
make[2]: Leaving directory `/tmp/rpmbu

但后来我看到了这些错误...

/usr/lib/rpm/brp-compress: line 8: cd: /tmp/BUILDROOT/custom-exim-4.80.1-1.x86_64: No such file or directory
+ /usr/lib/rpm/brp-strip
find: `/tmp/BUILDROOT/custom-exim-4.80.1-1.x86_64': No such file or directory
+ /usr/lib/rpm/brp-strip-static-archive
find: `/tmp/BUILDROOT/custom-exim-4.80.1-1.x86_64': No such file or directory
+ /usr/lib/rpm/brp-strip-comment-note

所以它现在似乎在寻找/tmp/BUILDROOT

我是 rpmbuild 的新手,不太了解其中的一些过程。

我的测试规范文件位于...


%define myversion exim-4.80.1
##%define mybase %{getenv:HOME}
%define mybase /tmp

%define _topdir %{mybase}/rpmbuild
%define _tmppath %{mybase}/rpmbuild/tmp
%define name custom-exim
%define release 1
%define version 4.80.1
%define buildroot %{_topdir}/%{name}-%{version}-root


BuildRoot: %{buildroot}
Summary: %{name}
Name: %{name}
Version: %{version}
Release: %{release}
Source0: ftp://exim.noris.de/exim/exim4/old/exim-4.80.1.tar.gz

License: GPLv1+
Group: Language
AutoReq: no
AutoProv: no
Requires: db4-devel pcre-devel libdb-devel libXt-devel libXaw-devel

%description
Custom Exim Build

%prep

#Do the following manually before building rpm
#mkdir -p /tmp/rpmbuild/BUILD /tmp/rpmbuild/SPECS /tmp/rpmbuild/SOURCES /tmp/rpmbuild/BUILDROOT /tmp/rpmbuild/RPMS /tmp/rpmbuild/SRPMS
#wget ftp://exim.noris.de/exim/exim4/old/exim-4.80.1.tar.gz -O /tmp/rpmbuild/SOURCES/exim-4.80.1.tar.gz


%setup -q -n %{myversion}
grep exim /etc/passwd || useradd -c "Exim" -d /var/spool/exim -m -s /bin/bash exim

%build

# exim needs to config changes before compiling, may do these first and repackage

cp %{mybase}/rpmbuild/BUILD/%{myversion}/src/EDITME %{mybase}/rpmbuild/BUILD/%{myversion}/Local/Makefile
cp %{mybase}/rpmbuild/BUILD/%{myversion}/exim_monitor/EDITME %{mybase}/rpmbuild/BUILD/%{myversion}/Local/eximon.conf

sed -i -e 's/EXIM_USER=$/EXIM_USER=exim/g' "%{mybase}/rpmbuild/BUILD/%{myversion}/Local/Makefile"
sed -i -e 's/LOOKUP_DNSDB=yes/#LOOKUP_DNSDB=yes/g' "%{mybase}/rpmbuild/BUILD/%{myversion}/Local/Makefile"

make

%install

rm -rf $RPM_BUILD_ROOT
#%{__mkdir_p} '%{buildroot}%{_sbindir}'
make install

%clean
rm -rf $RPM_BUILD_ROOT

%post

%postun

%files

为什么它按字面意义使用/tmp/BUILDROOT 而不是/tmp/rpmbuild,还有其他明显的错误吗?我看过许多关于 rpmbuild 的其他教程,但对最佳实践或每个阶段发生的事情不是很清楚。

最佳答案

由于 buildroot 参数未传递给 rpmbuild,您的规范文件正在使用默认路径:

BuildRoot:      %{buildroot}

尝试添加 buildroot 参数...将 buildroot/tmp/rpmbuild 添加到 --define

或者如果使用 makefile:

BUILD_TMP=/tmp/rpmbuild
TOP_DIR=/tmp

rpmbuild -bb
--buildroot $(BUILD_TMP)
--topdir $(TOP_DIR)
$(SPEC_DIR)/testspec.spec

关于centos - rpmbuild 没有那个文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30321805/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com