RPM 构建在安装部分失败

发布于 2024-12-03 16:45:02 字数 846 浏览 1 评论 0原文

我正在尝试构建我的第一个 rpm 包,它是一个简单的可执行文件 (mysh)。

我的规范文件:

Summary: bla <br>
Name: mysh <br>
Version: 1.0 <br>
Release: 1 <br>
Group: Applications <br>
Source: mysh-1.0.tar.gz <br>
URL: http://www.google.com <br>
Vendor: tadas sofware inc. <br>
Packager: tadas <br>
License: GPL 

%description <br>
a very good program!

%prep <br>
rm -rf $RPM_BUILD_DIR/mysh-1.0 <br>
zcat $RPM_SOURCE_DIR/mysh-1.0.tar.gz | tar -xvf -

%build <br>
make 

%install <br>
cp mysh /usr/local/bin/mysh

%files <br>
/usr/local/bin/mysh

它失败并出现以下错误:

cd: 8: can't cd to /home/tadzys/rpm/BUILDROOT/mysh-1.0-1.x86_64

当然该文件不存在。我已经尝试将其复制到那里仍然存在相同的错误。不确定我的安装部分是否应该将任何内容放入 BUILDROOT 文件夹中。

我使用的是 Ubuntu 11.04。

I am trying to build my first rpm package, which is one simple executable (mysh).

My spec file:

Summary: bla <br>
Name: mysh <br>
Version: 1.0 <br>
Release: 1 <br>
Group: Applications <br>
Source: mysh-1.0.tar.gz <br>
URL: http://www.google.com <br>
Vendor: tadas sofware inc. <br>
Packager: tadas <br>
License: GPL 

%description <br>
a very good program!

%prep <br>
rm -rf $RPM_BUILD_DIR/mysh-1.0 <br>
zcat $RPM_SOURCE_DIR/mysh-1.0.tar.gz | tar -xvf -

%build <br>
make 

%install <br>
cp mysh /usr/local/bin/mysh

%files <br>
/usr/local/bin/mysh

It fails with the following error:

cd: 8: can't cd to /home/tadzys/rpm/BUILDROOT/mysh-1.0-1.x86_64

Of course this file doesn't exist there. I've tried copying it there still there same error. Not sure if my install section should put anything to BUILDROOT folder.

I am on Ubuntu 11.04.

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

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

发布评论

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

评论(1

彻夜缠绵 2024-12-10 16:45:02

当您在 %install 部分中引用目标计算机中的目录时,您需要引用与 $RPM_BUILD_ROOT (或 %{buildroot}):

%install
cp mysh $RPM_BUILD_ROOT/usr/local/bin/mysh

但是,%files 部分不需要需要更新。

另外,在复制文件时,您应该考虑使用 install 命令。它与 cp 类似,但 install 允许您设置目标文件的权限位:

%install
install -m 755 mysh $RPM_BUILD_ROOT/usr/local/bin/mysh

When you refer to directories in the target machine within the %install section, you need to reference everything relative to $RPM_BUILD_ROOT (or %{buildroot}):

%install
cp mysh $RPM_BUILD_ROOT/usr/local/bin/mysh

The %files section does not need to be updated, however.

Also, you should consider using the install command when copying files around. It's similar to cp, but install allows you to set the permission bits for the target file:

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