RPM spec files with rpmbuild can have errors

425 views Asked by At

Every time I try to make my own spec file and build it, I get an error like this:

many lines on the screen of the build starting...

+ '[' 0 -ne 0 ']'
+ cd foobar
/var/tmp/rpm-tmp.dN7L6s: line 35: cd: foobar: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.dN7L6s (%prep)

I've noticed that "foobar" is the name of the package in the line with the %setup under the prep section of the spec file (foobar.spec). But I don't know what to do with this problem that keeps happening. What can I do to make a spec file work and not have this error? I have tried installing three different packages and re-writing the spec files. But I always get this error.

What file formats are permissible for the source file in the spec file? bz2? tar.gz? I know .tar.gz is ok.

If the source is not on an FTP server or on a website, what can you do to make the .spec file work? I have the source file local to the server. In very secure environments, you wouldn't have access to the Internet or an FTP server.

1

There are 1 answers

0
Jeff Johnson On

The problem has to do with specifying a build subdir.

See options for %setup, including -n (if the name in tar ball is different) and -c/-a/-b (if the build subduer needs to be created before untar'ing)

All file paths that exist are permitted in SourceN: directives, but only the basename is used. Compression and unarchiving is usually handled automatically (but %setup options are needed to handle naming issues).