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
wget.spec
where did that file come from and how did you modify it?