Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What needs to go in the %files section of an RPM

I have a tar.gz that I am wanting to create a RPM out of and am currently working on the spec file. I couldn't seem to understand what the rule for including files in the %files section of the .spec was. My tar.gz consists of two python packages and is installed via a makefile that simply calls setup.py which uses distutils setup() to install them.

I currently have my documentation included but wasn't sure how to select what else to include:

%files
%doc README changelog
...

Also, my makefile generates a man page for the application; where/how should this be included in the .spec file?

I'm doing this on redhat.

like image 898
alh Avatar asked Dec 09 '12 10:12

alh


People also ask

What is %install in RPM spec file?

The section of the . spec file following the %build section is the %install section. This script installs the binaries, man pages, configuration files, and all other components that belong in your RPM package to their respective locations in our virtual build root directory.

What does an RPM contain?

What is an RPM? An RPM package is simply a file containing other files and information about them needed by the system. Specifically, an RPM package consists of the cpio archive, which contains the files, and the RPM header, which contains metadata about the package.


1 Answers

The %files section must list every file which will be included in the binary package, and therefore installed on target machines.

If you're making the RPM by the book, then the spec files serves two somewhat separate purposes. It's a build script, detailing how to convert the source code into build artifacts, and a packaging script, detailing what build products should be installed on the destination machines. In your case, the build aspect is very lightweight.

In this traditional approach, the makefile is run during the build phase, and the %files directive lists which of the resulting build artifacts should be installed. To be clear, you would either not use make install with the traditional approach, or you would use it with DESTDIR to install into the RPM build directory (ie not into /usr/lib/python/foo but into ~/rpmbuild/BUILD/usr/lib/python/foo or something), from where you would then select files with %files.

So, what you should do is to have some prior section (probably %install) run the makefile to install into the build area, and then use the %files section to pick out the results. Remember that you can use wildcards in the %files section, so you don't have to explicitly name every individual file.

Does that make sense? Have i misunderstood your question?

like image 102
Tom Anderson Avatar answered Oct 11 '22 03:10

Tom Anderson