If you're developing packages for an appliance in rBuilder, you may have already seen how rBuilder creates a recipe for you to use that automatically assumes you want to use the factory recipe classes for your selected platform. rBuilder's Package Creator is designed to select the appropriate factory based on what you're packaging.
If you're packaging outside of rBuilder, you can still take advantage of some of the platforms' factories provided by rPath. The following lists the factories you can use as of the date of this publication, including information about where you can view the factory code:
Table 6.1. Factories from rPath that You Can Use
| Factory | Platform Location | Usage |
|---|---|---|
| factory-centos-rpm | Part of group-factories in your Centos platform repository | Create a package just by providing a list of RPMs in a file called "manifest" |
| factory-sle-rpm | Part of group-factories in your SLES platform repository | Create a package just by providing a list of RPMs in a file called "manifest" |
| factory-sl-rpm | Part of group-factories in your Scientific Linux platform repository | Create a package just by providing a list of RPMs in a file called "manifest" |
Each group-factories maintained by rPath has a lot of additional Python code that you probably don't need to reference. Much of this code is designed for efficient operation as part of rBuilder's Package Creator. For your reference as a packager outside of Package Creator, you should only use the non-Package-Creator factories listed in Table 6.1, “Factories from rPath that You Can Use”.
To use any of the factories listed here, use the following steps:
In your command line development environment, change to the directory where you have set up a context for building your package. If you're using the rbuild utility as outlined in rBuilder Packaging and Automation at docs.rpath.com, this means changing to the Development subdirectory for your appliance checkout. If you're using Conary or rMake independent of rBuild, be sure to configure your Conary context as appropriate (see Conary Contexts at docs.rpath.com/conary).
Use the following command to create your new package, replacing examplepkg with your desired package name, and replacing "centos-rpm" if necssary with the appropriate suffix from another factory you're using. For example, if you're using SLES, and you're using the factory from SLES called factory-sle-rpm, replace "centos-rpm" with "sle-rpm":
$> cvc newpkg examplepkg --factory=centos-rpm
Change to the new package's subdirectory. For examplepkg this would be:
$> cd examplepkg
Create a text file called manifest by opening it in your preferred text editor. For examplepkg edited in Vim this would be:
$> vim manifest
In the manifest file, list the filenames or other URIs, one per line, for the RPMs you want to package. Exactly one of the RPMs named must be a source RPM, which Conary will use to determine the correct package name and version. Though you must name the source RPM, you do not have to include the source RPM file in your build unless you need to do so for compliance with an Open Source license (such as GPL). For examplepkg the file might look like this:
/network_share/examplepkg/3.2/rpms/examplepkg-3.2-1.src.rpm /network_share/examplepkg/3.2/rpms/examplepkg-3.2-1.rpm /network_share/examplepkg/3.2/rpms/examplepkg-3.2.0.1.patch
Only if necessary, create a recipe file to define any overriding or supplemental actions in the preProcess(r) or postProcess(r) methods (originally defined in the factory code). You might want to skip this step the first time through, and come back to it if the package is not built like you need it. For examplepkg, the following could serve as a template for this override recipe:
# Override actions for ExamplePkg class ExamplePkgOverrides(FactoryRecipeClass): def preProcess(r): ''' Place pre-processing actions here ''' def postProcess(r): ''' Place post-processing actions here '''
Add your new files to Conary version control with cvc add, and then commit everything you've added with a single cvc ci command. For examplepkg, the following commands would apply:
$> cvc add manifest $> cvc add examplepkg.recipe $> cvc ci
Build the package with whatever build tool you have configured your environment to use (rBuild, rMake, or Conary). For examplepkg built with rBuild, this could be:
$> rbuild build packages examplepkg
Test and rebuild your package until it installs and functions as desired.