如何解决构建 RPM 时没有此类文件或目录错误:Bad exit status from (%prep)?

发布于 2024-08-13 02:28:24 字数 1232 浏览 7 评论 0原文

我正在构建一个 rpm,请让我知道哪里出了问题,

我的规范文件是 rpms.spec,内容是:

Summary: GNU indent
Name: rpms
Version: 1
Release: 1
Source0: %{name}-%{version}.tar.gz
License: GPL
Group: Development/Tools
%description
The GNU indent program reformats C code to any of a variety of
formatting standards, or you can define your own.
%prep
%setup -q
%build
./configure
make
%install
make install
%files
%defattr(-,root,root)
/usr/local/bin/indent
%doc /usr/local/info/indent.info
%doc %attr(0444,root,root) /usr/local/man/man1/indent.1
%doc COPYING AUTHORS README NEWS

我已将 tar 文件复制到 /usr/src/redhat/SOURCES/ 中 然后当我执行 rpmbuild -ba rpms.spec 时,我收到以下错误

rpmbuild -ba rpms.spec  Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.87218
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf rpms-1
+ /bin/gzip -dc /usr/src/redhat/SOURCES/rpms-1.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd rpms-1 /var/tmp/rpm-tmp.87218: line 35: cd: rpms-1: No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.87218 (%prep)

RPM 构建错误: /var/tmp/rpm-tmp.87218 (%prep) 的退出状态错误

没有 rpms-1 目录。我尝试在 BUILd 目录中创建目录,但没有成功。

I am building an rpm please let me know where i am going wrong,

My spec file is rpms.spec and the contents are:

Summary: GNU indent
Name: rpms
Version: 1
Release: 1
Source0: %{name}-%{version}.tar.gz
License: GPL
Group: Development/Tools
%description
The GNU indent program reformats C code to any of a variety of
formatting standards, or you can define your own.
%prep
%setup -q
%build
./configure
make
%install
make install
%files
%defattr(-,root,root)
/usr/local/bin/indent
%doc /usr/local/info/indent.info
%doc %attr(0444,root,root) /usr/local/man/man1/indent.1
%doc COPYING AUTHORS README NEWS

I have copied the tar file to /usr/src/redhat/SOURCES/ also
and then when i do rpmbuild -ba rpms.spec I get the following error

rpmbuild -ba rpms.spec  Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.87218
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf rpms-1
+ /bin/gzip -dc /usr/src/redhat/SOURCES/rpms-1.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd rpms-1 /var/tmp/rpm-tmp.87218: line 35: cd: rpms-1: No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.87218 (%prep)

RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.87218 (%prep)

There is no directory as rpms-1.I tried creating the directory in BUILd directory it didnt work.

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

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

发布评论

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

评论(1

吐个泡泡 2024-08-20 02:28:24

您已将“名称”设置为 rpms,并将“版本”设置为 1,

因此 rpmbuild 将假定解压 rpms-1.tar.gz 会生成一个名为 rpms-1 的目录,应在该目录中进行构建。

如果你想覆盖它,请将 %setup 更改为

%setup -n yourdir

其中 yourdir 是打包源代码的目录,位于 tar.gz 文件内

You have set Name to rpms and version to 1

rpmbuild will therefore assume that unpacking rpms-1.tar.gz results in a directory named rpms-1 in which is should step into to do the build.

if you want to override that, change the %setup to

%setup -n yourdir

where yourdir is whatever directory your sources are packaged in, inside your tar.gz file

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