Steve Emmerson
Steve Emmerson

Reputation: 7832

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

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

Upvotes: 7

Views: 3609

Answers (1)

Corey Henderson
Corey Henderson

Reputation: 7455

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.

Upvotes: 6

Related Questions