How we build packages in Grid Dynamics (using Gear + Mock)

As we stated before we are building OpenStack RPM packages directly from Git repositories. All bug fixes and patches specific for our RedHat OpenStack distribution are committed into corresponding Git repos. The process of building is fully automated. You just need to setup a build system like we made.

Some details about our build system. All packages are built in a chroot, populated by Mock tool. It allows us to build packages in an isolated environment with minimal packages installed and only right repositories set for dependency resolution. For RHEL it is only repo from distribution ISO and Grid Dynamics repo itself. So to bootstrap we had to build many dependencies from sources.  That is not all the story. Having ready RPM specs and sources was not enough for good automated builds. It is also necessary to have a uniform mechanism for gathering everything into tarball: sources, patches, specs, scripts. We chose Gear as a tool for this purpose. It automates source code checkouts from Git and packs everything according to “gear-rules” which should be added to Git repo. We also improved Gear by adding integration with Mock, so we could produce a chroot-built SRPMs directly from Git. So basically commands to build Gear repo are the following:

  1. In the Git repo dir execute: gear-mock --root=<mock-chroot-config>
    (gear-mock is command introduced in our fork of Gear)
  2. Take SRPM and build it via Mock:  mock --rebuild <mock-chroot-config> <SRPM>

Summarizing benefits of using Mock and Gear:

  1. It is possible to build for different platforms (e.g. RedHat, CentOS, SL, Fedora)
  2. Built packages are independent of current host configuration
  3. Convenient source code updates (It is stored in Git, not tarballs)
  4. No more manual patch creation (Gear is able to generate .patch files from commits and put it into SRPM automatically)
  5. Uniform way to manage projects’ source code

RPM packages for Mock and Gear are also available at our YUM repository. You may try to do it yourself.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s