RPM build fails on install section

雨燕双飞 提交于 2019-12-24 03:48:14

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/7374379/rpm-build-fails-on-install-section

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!