2

I am trying to create an RPM file for the wget utility. Both of my attempts (with sudo and without sudo) to use the rpmbuild comman fail to create an .rpm file.

I run a "sudo rpmbuild" command to use a spec file. But I get these errors:

error: File not found: /root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/bin/wget error: File not found: /root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/share/man/man1/wget.1

If I manually create the directory paths and manually copy the files, I run into other problems down the road. I think something is wrong if the rpmbuild command expects key files to be in the locations above.

I read it was recommended to not use sudo. When I do not use sudo, the rpmbuild command (rpmbuild -v -bb --clean SPECS/wget.spec) shows this:

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.NiuIFV + umask 022 + cd /home/ec2-user/mywget/BUILD + cd /home/ec2-user/mywget/BUILD + rm -rf wget-1.19 rm: cannot remove 'wget-1.19/po/[email protected]': Permission denied rm: cannot remove 'wget-1.19/po/zh_CN.po': Permission denied rm: cannot remove 'wget-1.19/po/id.gmo': Permission denied rm: cannot remove 'wget-1.19/po/gl.gmo': Permission denied ...

I see other "rm cannot remove ... Permission denied" lines. I expected the rpmbuild command to work. I have changed the permissions of the wget-1.19 folder to be 777 (via sudo chmod) with the owner and group being identical to the user running the rpmbuild command. I still had the problem.

What can I do to create an RPM package of the wget utility?

# This is a sample spec file for wget

%define _topdir     /home/ec2-user/mywget
%define name            wget 
%define release     1
%define version     1.19
%define buildroot %{_topdir}/%{name}-%{version}-root

BuildRoot:  %{buildroot}
Summary:        GNU wget
License:        GPL
Name:           %{name}
Version:        %{version}
Release:        %{release}
Source:         %{name}-%{version}.tar.gz
Prefix:         /usr
Group:          Development/Tools

%description
The GNU wget program downloads files from the Internet using the command-line.

%prep
%setup -q

%build
./configure
make

%install
make install prefix=$RPM_BUILD_ROOT/usr

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

%doc %attr(0444,root,root) /usr/local/share/man/man1/wget.1

The above was modified but heavily based on the spec file example here: https://www.ibm.com/developerworks/library/l-rpm1/index.html

1
  • hard to say without seeing the contents of your wget.spec where did that file come from and how did you modify it?
    – thrig
    Nov 29, 2017 at 2:00

1 Answer 1

2

This error:

error: File not found: /root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/bin/wget

means that you specified this file in %files section:

%files
/usr/local/bin/wget

so rpmbuild is expecting this file in $RPM_BUILD_ROOT/usr/local/bin/wget path but it is not there. Therefore this error. Vice versa for the man page.

You can run rpmbuild -bi which will stop just after %install phase and you can check the content of /root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/ where the make install actually put the files.

I guess that either

%install
make install prefix=$RPM_BUILD_ROOT/usr/local

or

%files
%defattr(-,root,root)
/usr/bin/wget
%doc %attr(0444,root,root) /usr/share/man/man1/wget.1

will fix your error. (just one of those!)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .