7

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
Steve Emmerson
  • 7,702
  • 5
  • 33
  • 59

1 Answers1

7

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.

Corey Henderson
  • 7,239
  • 1
  • 39
  • 43
  • 1
    Your answer seems at odds with the RPM documentation I'm using, `http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s04.html#id515031`. Can you suggest better documentation? – Steve Emmerson Jun 23 '11 at 22:12
  • I'm not seeing where my answer differs. Could you quote the text that I'm at odds with? – Corey Henderson Jun 23 '11 at 22:22
  • `This command changes to the build directory, typically /usr/src/redhat/BUILD, and then extracts the source files.` `The –T option disables the automatic extraction of compressed tar files.` (I don't specify the `-T` option; therefore, the compressed tar file should be automatically extracted.) – Steve Emmerson Jun 23 '11 at 22:37
  • 1
    @teve Emmerson Take a look at http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s03s03.html and http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s02s02.html However, regardless of whether you specify /web/ftp/pub/ldm/%{name}-%{version}.tar.gz, RPM will look for the %{name}-%{version}.tar.gz only in the %_topdir/SOURCES directory , which in your case is /home/steve/rpmbuild/SOURCES/ – nos Jun 23 '11 at 22:41
  • I was saying you could use the -T option in setup to bypass this problem, if for example you didn't want to copy the file to your own SOURCES directory. I'll edit my answer to be more specific about that. – Corey Henderson Jun 23 '11 at 23:41