RPM Build Notes: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Blanked the page)
 
Line 1: Line 1:


=RPM Build Notes=
==Install Mach==
Start with a minimal install of CentOS 6.2.
<pre>
$ yum install wget createrepo
$ wget http://thomas.apestaart.org/download/mach/mach-1.0.2.tar.gz
$ ./configure --disable-selinux
$ make
$ make install
$ chmod u+s /usr/local/sbin/mach-helper
$ groupadd mach
$ useradd -g mach -m mach
$ passwd mach
</pre>
Due to a permissions bug I hit with mach (during a file copy), we'll continue as root.
Create /root/.machrc:
<pre>
config['centos-6-x86_64-os']['macros']['dist'] = '.el6'
config['centos-6-i386-os']['macros']['dist'] = '.el6'
</pre>
==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 3
Release:        0%{?dist}
</pre>
==Build the Package==
Now we want to rebuild the package using our updated .spec file.
<pre>
$ rm -rf /usr/local/var/tmp/mach/*
$ mach='mach --debug -r centos-6-x86_64-os'
$ $mach clean
$ $mach build mozilla-python27/python27.spec
</pre>
Note: adjust the target to 'centos-6-i386-os' to generate a 32-bit package.
In this case, though, I wanted to use mock (not mach) to build the final package since my mach build machine does not have access to the Mozilla yum repos.  We can use the .src.rpm generated above and feed that to mock.
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.
* Execute these steps to build:
<pre>
$ mock='mock --configdir=/home/cltbld/mock-config -r epel-6-x86_64 -v'
$ $mock --rebuild mozilla-python27-2.7.3-0.el6.src.rpm
</pre>
* The script will tell you where the results are available.
* Use 'epel-6-i386' to build a 32-bit package.

Latest revision as of 16:23, 10 April 2013