RPM: Difference between revisions

From OPeNDAP Documentation
⧼opendap2-jumptonavigation⧽
mNo edit summary
Line 11: Line 11:
Documentation for RPM and rpmbuild, in particular is hard to come by. Here's some good information: [http://fedoraproject.org/wiki/Packaging/Guidelines Fedora RPM Guidelines]
Documentation for RPM and rpmbuild, in particular is hard to come by. Here's some good information: [http://fedoraproject.org/wiki/Packaging/Guidelines Fedora RPM Guidelines]


<!-- Old
== How to configure RPM ==
== How to configure RPM ==


Line 22: Line 23:
</tt>
</tt>


Next, copy the directory structure found under `/usr/src/redhat` being careful to ''not'' copy all the files under the `BUILD` subdirectory (BUILD can become substantial over time, so take care to copy the directory structure and not any .rpm files in them).
Next, copy the directory structure found under `/usr/src/redhat` being careful to ''not'' copy all the files under the `BUILD` subdirectory (BUILD can become substantial over time, so take care to copy the directory structure and not any .rpm files in them). -->
 


= Building RPMs for use with EPEL =
= Building RPMs for use with EPEL =

Revision as of 23:59, 21 September 2015

<< back to Developer Info

About Building RPMs

Once a release is made, it's time to make the binaries.

The owner of a project is responsible for the source distribution and most of the binaries. Everyone should be able to make Linux binaries. For OS/X and Win32, if you have those platforms, build the binaries. If not, ask someone to help or post to the opendap-tech list and see if we can get a contributed binary.

About RPMs

Documentation for RPM and rpmbuild, in particular is hard to come by. Here's some good information: Fedora RPM Guidelines


Building RPMs for use with EPEL

There are some tricks to building the RPMs, but for the most part, its just make rpm. However, you can make this easier if you do two things:

  1. Install the EPEL yum repository. Get epel-release-6-8.noarch.rpm and install it using sudo yum install epel-release-6-8.noarch.rpm. Then install packages needed to read various file formats: yum install netcdf-devel hdf-devel hdf5-devel libicu-devel cfitsio-devel
  2. Set up the rpmbuild directory structure in $HOME and then build as yourself and not root. (Here are instructions for CentOS)
build the libdap rpms
cd libdap4, make rpm
install (temporarily) the libdap rpm packages
You need to do this because libdap and libdap-devel are dependencies for the BES rpms and their builds. Use sudo yum install ~/rpmbuild/RPMS/x86_64/libdap*.rpm
build the bes rpms
cd bes, make rpm
test the bes rpms (if you want)
sudo yum install ~/rpmbuild/RPMS/x86_64/bes.rpm, then run besctl start and bescmdln. Type show version; in to the latter, you should get an xml document that lists the BES's components. Stop the server with besctl stop
remove the packages you just installed
Do this step if you're on a build host an you don't want libdap, etc., permanently installed. sudo yum remove bes bes-devel libdap libdap-devel

Building RPMs that Include Statically Linked Handlers

Build RPMs that are usable for NASA takes a bit more work because NASA uses hdf4/hdfeos2 for lots of its data and there is no rpm for hdfeos2. As a result, you will need to build a version of the hdf4 handler that is statically linked to the hdfeps2 and hdf4 libraries. Not a huge problem, but it's an extra step. However, there is a bonus for doing this extra work: You also get the handlers that build GeoTIFF and JPEG2000 responses, an updated FITS handler and a handler that uses GDAL to read any of the formats it supports, including data stored in GeoTIFF files.

Note: There are actually two different 'static' RPM build options for the BES, and here I describe the one that builds every handler using static linking so that EPEL is not required at all. Read the Makefiles, and spec files to find out more. The 'it uses EPEL' and 'it uses static linking' are the two most useful options.

There's considerable overlap with the instructions from the above section, but there are key differences for the BES parts, highlighted in red below.

Build the dependencies for the BES handlers that have no (usable) RPM in CentOS 6
cd hyrax-dependencies, make -j9 for-static-rpm CONFIGURE_FLAGS=--disable-shared
Build the libdap rpms
cd libdap4, make rpm
install (temporarily) the libdap rpm packages
You need to do this because libdap and libdap-devel are dependencies for the BES rpms and their builds. Use sudo yum install ~/rpmbuild/RPMS/x86_64/libdap*.rpm
build the bes rpms
cd bes, make all-static-rpm
test the bes rpms (if you want)
sudo yum install ~/rpmbuild/RPMS/x86_64/bes*.rpm, then run besctl start and bescmdln. Type show version; in to the latter, you should get an xml document that lists the BES's components. Stop the server with besctl stop
remove the packages you just installed
Do this step if you're on a build host an you don't want libdap, etc., permanently installed. sudo yum remove bes bes-devel libdap libdap-devel

Procedure

  1. When a release is ready, follow the steps in [wiki:ReleaseGuide the release guide] for making a source release
  2. Make sure that Everyone in the project knows about the release. That's generally all the people that come to the developer's telecon but should definitely include whoever is writing docs for the group. This step is important so that we can keep our documentation up to date.
  3. Make binaries.
  4. To make RPMs for Linux:
    • When you're building things like libdap or the hdf4_handler, make sure that all of the dependencies are satisfied using RPMs and not source builds! This is a pain, but it's how RPM works. Using a mix of binary and source builds is OK if you're not distributing the result, but since we are distributing the result, it's not OK.
      • Make a tar.gz source distributions using make dist or make distcheck. Either use the source dist or check out the tagged code from SVN using export.
      • Use the rpm target in the Makefile.am or, if that's missing use rpmbuild -tb <<tar.gz>>, to make the actual RPM files.
        Potential issues:
        • One gotcha is that the tar.gz file is needed to run rpmbuild when using the -t option. It's best to list dist as a dependency for rpm in the Makefile.am.
        • The spec file must be included in the tar.gz file! If it's not (add it to the EXTRA_DIST variable in Makefile.am) rpmbuild will return a message saying that "Name field must be present in package: (main package)".
        • . The error messages from rpmbuild can be somewhat inscrutable. If you are getting an error and you just have no clue, Google the double quoted error message string since it's likely someone else has had the same problem.
      • You'll probably need to be root to do this. But don't, set up a .rpmmacros file and configure rpm to use an alternative set of directories. You'll then need to mirror the directories in /usr/src/redhat somewhere (e.g., under $HOME). See the explanation above.
      • It might be that you have to install a package (e.g. libdap) to build another (libnc-dap). If so, make sure to remove it once you're done, esp. on a development machine. Leaving a package installed makes it much more likely that package's files will wind up as 'required' by other packages (like libdap.so.6 requiring libdap.so.4).
  5. Transfer the binaries to the web site. They go under /pub/binary. Each group of files for a given version should go in a subdirectory named for that version. As of 15 April 2008, we're not doing that, but we should since it will make the pages lots easier to maintain (moving the old versions to the `old` subdirectory means the old links have to be updated on all of the pages). Also, it makes it confusing for users when we do a release in steps unless they pay attention to the version numbers on the rpm files.