Changes

Jump to: navigation, search

ReleaseEngineering/PuppetAgain/HowTo/Build RPMs

541 bytes added, 17:13, 6 May 2013
no edit summary
=How to Build RPMs=
==Prepare the Package== For this example, I want to build a new mozilla-python27 package based on 2.7.3 instead of 2.7.2. I'm going to fetch the original .src.rpm and extract it into a subdirectory: <pre>$ wget http://repos/repos/yum/releng/public/CentOS/6/x86_64/mozilla-python27-mercurial-2.1.1-4.el6.src.rpm$ mkdir mozilla-python27 && cd mozilla-python27$ rpm2cpio ../mozilla-python27-mercurial-2.1.1-4.el6.src.rpm | cpio -ivd</pre> Then edit these .spec file lines to update the Python version and package release number: <pre>%define pyrel 3Release: 0%{?dist}</pre> ==Build a .src.rpm== There are two ways to build a source RPM described below. ===Build an .src.rpm Using Mach=== Mach automatically downloads required source tarballs and patches and can handle multi-package builds with inter-dependencies. ====Install /Configure Mach====
Start with a minimal install of CentOS 6.2.
</pre>
==Prepare ==Build the Package.src.rpm====  $ mach build /path/to/spec ===Build an .src.rpm Using Mock=== ====Install/Configure Mock==== * Install mock* Copy the [http://hg.mozilla.org/users/john.hopkins_mozillamessaging.com/misc/file/default/mock mock-config] folder to your home directory (this example uses /home/cltbld/mock-config). Find a suitable machine with 'mock' installed. It's best to do this on a target machine, since its /etc/mock/default.cfg will already be set up correctly. Download the srpm 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.
For this example, I want Edit the spec file to build a new mozilla-python27 package based on 2.7.3 instead of 2.7.2. Iyour heart'm going to fetch the original .srcs content.rpm and extract it into a subdirectory:
<pre>$ wget http://repos/repos/yum/releng/public/CentOS/6/x86_64/mozilla-python27-mercurial-2.1.1-4.el6.src.rpm$ mkdir mozilla-python27 && cd mozilla-python27$ rpm2cpio ../mozilla-python27-mercurial-2.1.1-4.el6====Build the .src.rpm | cpio -ivd</pre>====
Then edit these . $ mock --buildsrpm --spec file lines /path/to update the Python version and package release number:/spec --sources $PWD
<pre>%define pyrel 3Release: 0%{?dist}</pre>The script output will tell you where the SRPM is. Copy it somewhere else, or mock will delete it.
==Build the Package==
Now we want to rebuild the package using our updated .spec filesrc.rpm created above. ===Build using Mach=== Included here for reference, but it is preferable to use Mock to build the final binary package (see "Build Using Mock", below) as the steps have been tweaked to use only our internal Yum repos. This is desirable to get exactly the right binary package output.
<pre>
Note that this is a simple example. mach has an advantage over mock in that it figures out dependencies when building multiple packages and automatically pulls in source files (normally a manual operation). This can save a lot of time and hassle.
==Configure Mock== * Install mock* Copy the [http://hg.mozilla.org/users/john.hopkins_mozillamessaging.com/misc/file/default/mock mock-config] folder to your home directory (this example uses /home/cltbld/mock-config). ==Build Using Mock===
* Fetch the .src.rpm you built earlier.
* The script will tell you where the results are available.
* Use 'epel-6-i386' to build a 32-bit package.
 
==Build an .src.rpm Using Mock==
 
Find a suitable machine with 'mock' installed. It's best to do this on a target machine, since its /etc/mock/default.cfg will already be set up correctly.
 
Download the srpm 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.
 
Edit the spec file to your heart's content. To build an RPM, you'll need to stop off at an SRPM:
mock --buildsrpm --spec /path/to/spec --sources $PWD
The script output will tell you where the SRPM is. Copy it somewhere else, or mock will delete it. Then build the SRPM into an RPM:
mock --rebuild /path/to/srpm
== Other Dependencies ==
Confirm
1,018
edits

Navigation menu