4.2. RPM Packages

Use this section if the software you're packaging is already provided as an RPM package. Choose whether you want to package the ready-to-install RPM using the (binary) RPM file, or you want to package from the source RPM (SRPM) so that you can make detailed customizations to how the software is installed.

4.2.1. Binary RPM Packages

If you're using rBuilder 5 or later, you can create this type of package by using the Package Creator in its Web interface. rBuilder combines its custom Conary factories with your uploaded RPM file to generate the recipe code you need. Conary and rBuilder combine their built-in intelligence to determine a lot about how the package should be assembled. rPath recommends that you take advantage of this built-in intelligence by continuing to use rBuilder's factories, and adding any supplemental and overriding code to the preProcess and postProcess sections of the recipe.

Without factories, you could create and maintain your package recipe to take advantage of the rpm-import superclass associated with the platform for which you're developing. Use the following as a template for starting your recipe to package a binary RPM for Conary. There are currently no documents or recommended practices for using rpm-import, but you can view examples of its use by the RPM factories in each platform provided by rPath (such as in factory-centos-rpm.recipe in factory-centos-rpm:source=centos.rpath.com@rpath:centos-5).

4.2.2. Source RPM Packages

When you need to install your package differently from how the original RPM installs, you can also choose to package the software using the RPM source. The rpmpackage superclass from Conary is designed to parse information from a source RPM, apply any modifications you place in your recipe, and then package the software for Conary instead.

Use the following as a template for starting your recipe to assemble a Conary package from a source RPM:

# RECIPE TEMPLATE
# Package software from a source RPM

loadSuperClass('rpmpackage=conary.rpath.com@rpl:devel')
class ExampleApp(RPMPackageRecipe, AutoPackageRecipe):
    name = 'example'
    version = '3.1.0'
    rpmRelease = '4'
    rpmPatches = [ 'example-3.0.2.patch', 
                   'example-3.0.5.patch']
    externalArchive = 'http://www.example.com/%(name)s/%(name)s-%(version)s.tar.gz'
      

Replace the class name, package name, version, archive location, and RPM release as appropriate for your selected RPM. Each source and patch you add can be just a file name (if you're checking in those files with the recipe), or a network-accessible location as shown in the template example.

When you're using the rpmpackage superclass, you shouldn't need to define a setup or unpack method within your recipe, though you may add a setup method to check out your source RPM from a version control system (an action from among Conary's source actions). You can also add a policy method or similar to override some of Conary's default actions. For all the RPM-specific actions, though, you can just set variables from the rpmpackage superclass by adding other lines like the rpmRelease line shown in the template.

You can use any of the following variables from the rpmpackage superclass:

  • externalArchive -- Set this to pull patches or sources from the RPM, but want the upstream archive to come from a different location (expected input type is string)

  • tarballName -- Use this if rpmpackage cannot determine the correct archive name contained within the RPM (expected input type is string)

  • distroVersion -- Set this to the version of Red Hat Enterprise Linux (RHEL) or Fedora Core that should be used for fetching the RPM; defaults to "development" for Fedora Core and "4" for RHEL (expected input type is string)

  • rpmRelease -- Add the RPM release string, which occurs after the dash and before the dot in the RPM name (expected input type is string)

  • isRHEL -- RHEL sources are used of this is set to true; Fedora sources are used otherwise (expected input type is boolean)

  • rpmPatches -- Add one or more patches to apply from the RPM (expected input type is a list of strings)

  • rpmSources -- Add one or more sources to use from the RPM (expected input type is a list of strings)

  • rpmUpVer -- Set the upstream package version if it should be different than the default, which is the recipe's version (rare; expected input type is string)

  • rpmName -- Set the upstream package name if it should be different than the default, which is the recipe's name (rare; expected input type is string)

Reference all the other actions you can add to your recipe in Conary Recipe Actions, Macros, and Variables at docs.rpath.com/conary.