ReleaseEngineering/PuppetAgain/HowTo/Build RPMs

From MozillaWiki
< ReleaseEngineering‎ | PuppetAgain‎ | HowTo
Revision as of 19:14, 17 March 2014 by Jhopkins (talk | contribs) (→‎Build a .src.rpm: tweak to make more copy/paste friendly)
Jump to navigation Jump to search

How to Build RPMs

Build a .src.rpm

Use a machine configured to build RPMs, with the toplevel::server::pkgbuilder class. In moco, see ReleaseEngineering/How_To/Start_RPM_Ubuntu_Packager_Instances

If you're upgrading or modifying an existing package, download the source RPM of the old version of the package you'd like to build from puppetagain.pub.build.mozilla.org/data/repos/yum/releng/public and unpack it:

$ mkdir foopkg && cd foopkg
$ rpm2cpio $srpm | cpio -ivd

You should see a .spec file appear. Check that it is identical to the one in http://hg.mozilla.org/build/puppet under modules/packages/manifests/mozilla e.g., with an md5 hash. If not, figure out what the differences are, and which corresponds to the running version of the package.

If you're starting a fresh package, make yourself a new .spec file and download any Source files to the current directory.

Edit the spec file to your heart's content. To actually build the .src.rpm:

$ mock -r puppetagain-centos6-64 --buildsrpm --sources $PWD --spec /path/to/spec

The script output will tell you where the SRPM is. Copy it somewhere else, or mock will delete it in the next step.

Build the Package

Now we want to rebuild the package using our .src.rpm created above.

  • If necessary, fetch the .src.rpm you built earlier.
  • Execute these steps to build:
$ rm -rf /var/cache/mock/epel-6-x86_64/ccache
$ mock --rebuild -r puppetagain-centos6-64 mozilla-python27-2.7.3-0.el6.src.rpm

The script will tell you where the results are available.

Use '-r puppetagain-centos6-32' instead to build a 32-bit package.

Other Dependencies

If your package depends on other packages, it's best to build and land those first. The mock configs point to the local puppetagain repositories, so once the dependency is landed, it will be available in your mock build environment.

Testing

For testing purposes, it's best to install the RPM locally on a test host (NOT on the pkgbuilder host!), rather than dropping it into the puppetagain data directory and risking affecting production. You can do that too, if you're confident it won't affect anything.

Review

For review, include the modified .spec in your r? for changes to the puppet repository.

Remember, if the package can't be 100% re-created from data in the PuppetAgain Mercurial repository, you're doing it wrong!

Landing

See ReleaseEngineering/PuppetAgain/Packages for details on landing the change.