Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does rpmbuild(1) ignore the compressed tar(1) file named by the "Source:" tag in the RPM "spec" file?

Tags:

rpm

rpmbuild

The file ldm.spec contains the line

Source:         /web/ftp/pub/ldm/%{name}-%{version}.tar.gz

in its first section. %{name} and %{version} are set correctly. The given file does exist.

The command rpmbuild --nobuild ldm.spec error-exits with the message

error: File /home/steve/rpmbuild/SOURCES/ldm-6.9.8.tar.gz: No such file or directory

What must be done to get this to work?

Additional information:

$ uname -a
Linux gilda.unidata.ucar.edu 2.6.27.41-170.2.117.fc10.x86_64 #1 SMP Thu Dec 10 10:36:29 EST 2009 x86_64 x86_64 x86_64 GNU/Linux
$ rpmbuild --version
RPM version 4.6.1
like image 863
Steve Emmerson Avatar asked Jun 23 '11 21:06

Steve Emmerson


People also ask

What is Rpmbuild in Linux?

rpmbuild is used to build both binary and source software packages. A package consists of an archive of files and meta- data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package.

How do I get spec files from RPM?

Install rpmrebuild and "extract" (actually re-create) the spec file of your rpm file or your already installed package. Looking at rpmrebuild's code and then actually testing it, it doesn't "extract" the spec file; it regenerates most of a spec file (header, log, pre/post scripts).

What is Buildroot in RPM spec file?

Macros set for the RPM (and SRPM) build process spec files is %{buildroot} , which points to the root of the installation target directory. It is used for setting DESTDIR in the package's %install step.

Which file specifies how an RPM source package is compiled?

The BUILD directory is used during the build process of the RPM package. This is where the temporary files are stored, moved around, etc. The RPMS directory holds RPM packages built for different architectures and noarch if specified in . spec file or during the build.


1 Answers

By default, rpmbuild expects the basename() of the source file to exist in the %_topdir/SOURCES directory, regardless of where it otherwise states. In spec files you'll often see a URL (wget.spec):

Source: ftp://ftp.gnu.org/gnu/wget/wget-%{version}.tar.bz2

It doesn't fetch it at build time, even if it was on your own filesystem. The "No such file or directory" error comes from the %setup macro looking for the file in the default location, and not seeing it.

The solution is to copy (or make a symlink) of the file to your rpmbuild/SOURCES directory.

If you, for whatever reason, don't want to have to copy that file to your user's SOURCES directory, you can use the the -T option to the %setup mecro, it tells it to "Not Perform Default Archive Unpacking":

%setup -T

You'll have to unpack the archive yourself in the %prep section, if you choose to go this route.

like image 163
Corey Henderson Avatar answered Oct 04 '22 03:10

Corey Henderson