An Example with R Statistical Software
Sometimes the repos have fairly old RPMs. If you want a newer version of the software, you can either compile it from source. Or create your own (newer) RPM. This process is pretty easy if you can utilize someone else’s existing work. It just takes some time and persistence.
In this example, I’m building an RPM for R-2.11.1. The currently published RPMs are for R-2.10.0. I’m using Centos 5.3.
1) Get the src.rpm file, available from Berkeley (Go Bears!) here. Also download the source code, which is in tar.gz format.
2) Make sure you have the correct RPM build package on your server.
CentOS5# yum install rpm-build
3) Install the src.rpm file
CentOS5# rpm -i R-2.10.0-2.el5.src.rpm
4) Redhat places the build files in /usr/src/redhat. Examine the R.spec file located in /usr/src/redhat/SPECS. In this case, we only need to edit the Version number. Change
Version: 2.10.0
to
Version: 2.11.1
5) Copy the R-2.11.1.tar.gz source file to /usr/src/redhat/SOURCES.
6) Run the build. And resolve the errors.
CentOS5# rpmbuild -ba /usr/src/redhat/SPECS/R.spec
error: Failed build dependencies:
tetex-latex is needed by R-2.10.0-2.x86_64
texinfo-tex is needed by R-2.10.0-2.x86_64
readline-devel is needed by R-2.10.0-2.x86_64
tcl-devel is needed by R-2.10.0-2.x86_64…
7) Sigh. Perform a yum install of the needed packages and try again.
CentOS5# yum install tetex-latex texinfo-tex readline-devel …
CentOS5# rpmbuild -ba /usr/src/redhat/SPECS/R.spec
8) Got an error indicating that a number of files located in library/survival/noweb/ were not packaged. Addressed this by adding this line in R.spec:
%{_libdir}/R/library/survival/noweb
Specifically, I placed it below the core files section:
—
%files
# Metapackage
%files core
%defattr(-, root, root, -)
…
%{_libdir}/R/etc
%{_libdir}/R/lib
%{_libdir}/R/library/survival/noweb
…
9) Ran the build command again. This time I got it to run successfully. The resultant RPMS are located in /usr/src/redhat/RPMS
