RPM build errors
RPM is expecting your package to follow the standard packaging guidelines for Unix software. The GNU release guidelines are typical, but a lot of non-GNU software follows these rules, too.
Specifically here, you have a package called supportScripts, version 1, so the tarball is expected to be called supportScripts-1.tar.gz
, and it is expected to unpack into a directory called supportScripts-1
.
While there may be ways to arm-twist RPM into coping with a nonstandard scheme, it's simplest to just follow the one it expects.
Related videos on Youtube
Matej Vrzala M4
Updated on September 18, 2022Comments
-
Matej Vrzala M4 over 1 year
I am trying to build an RPM but when I use this command to build it:
[root@vmdb SPEC]# rpmbuild -v -bb SPEC/supportScripts.spec
I always get this error:
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.gG9C7Y + umask 022 + cd /root/rpmbuild/BUILD + cd /root/rpmbuild/BUILD + rm -rf supportScripts-1 + /usr/bin/gzip -dc /root/rpmbuild/SOURCES/supportScripts-1.tar.gz + /bin/tar -xf - + STATUS=0 + '[' 0 -ne 0 ']' + cd supportScripts-1 /var/tmp/rpm-tmp.gG9C7Y: line 34: cd: supportScripts-1: No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.gG9C7Y (%prep) RPM build errors: Bad exit status from /var/tmp/rpm-tmp.gG9C7Y (%prep)
I have looked on the internet as to why this error might occur and it is due to a bad argument with the macro I am using in %prep/%setup. I am not sure what I need in replacement to fix it and it is getting frustrating. This is what my spec file looks like:
Name: supportScripts Version: 1 Release: 1 Summary: All the support scripts bundled into an RPM. BuildArch: noarch Group: Development/Tools License: GPL URL: http://localhost Source0: supportScripts-1.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description These are all the support tools we need for new Hardware Agent builds. This will package all the scripts support uses for new builds. %prep %setup -q %install mkdir -p "$RPM_BUILD_ROOT/opt" cp -R * "$RPM_BUILD_ROOT/opt" %files /opt/ %clean rm -rf $RPM_BUILD_ROOT %post chown -R support:support /opt/* chmod -R 775 /opt/
UPDATE: What is weird is that I have found the rpm completely built in
/root/rpmbuild/RPMS/noarch
. I have ran command:rpm -ivh supportScripts-1-1.noarch.rpm
to unpack all the scripts, and miraculously its there! My next question is: Should I be concerned of any mishaps with the rpmbuild command I have done?
-
Matej Vrzala M4 over 9 yearsI am not sure how to make the spec file conform to what it expects there to be. Like I mentioned, surprisingly I see the RPM already built and when I unwrraped it, all my scripts were there. Can I just use that RPM or would that produce future problems? I will be using that RPM on to unwrap our scripts at my job for when I build future servers.
-
Warren Young over 9 yearsI'm not telling you to change the spec file. I'm telling you to change how you build that tarball, so that it is called supportScripts-1.tar.gz, and so that it unpacks into a directory called supportScripts-1. The error is saying that it is trying to
cd
into that directory, and is failing because it is not there. -
Matej Vrzala M4 over 9 yearsHow should I build the tarball so that it conforms to everything else then?
-
Warren Young over 9 yearsElementary:
mkdir supportScripts-1 ; cp $STUFF supportScripts-1 ; tar cvzf supportScripts-1.tar.gz supportScripts-1
-
Matej Vrzala M4 over 9 yearsThat didnt work either but the rpm is still built. As long as the rpm is built and functional, that will work for me
-
Warren Young over 9 yearsYou probably didn't copy the new tarball into
SOURCES
. -
Matej Vrzala M4 over 9 yearsLet me try that.
-
Matej Vrzala M4 over 9 yearsThat worked! Your the man