RPM Build Notes: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
Line 22: Line 22:
Create /root/.machrc:
Create /root/.machrc:


<code>
<pre>
config['centos-6-x86_64-os']['macros']['dist'] = '.el6'
config['centos-6-x86_64-os']['macros']['dist'] = '.el6'
config['centos-6-i386-os']['macros']['dist'] = '.el6'
config['centos-6-i386-os']['macros']['dist'] = '.el6'
</code>
</pre>


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:
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:


<code>
<pre>
$ wget http://repos/repos/yum/releng/public/CentOS/6/x86_64/mozilla-python27-mercurial-2.1.1-4.el6.src.rpm
$ 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
$ mkdir mozilla-python27 && cd mozilla-python27
$ rpm2cpio ../mozilla-python27-mercurial-2.1.1-4.el6.src.rpm | cpio -ivd
$ rpm2cpio ../mozilla-python27-mercurial-2.1.1-4.el6.src.rpm | cpio -ivd
</code>
</pre>


Then edit the .spec file to
Then edit these .spec file lines to update the Python version and package release number:
 
<pre>
%define pyrel 3
Release:        0%{?dist}
</pre>
 
Now we want to rebuild the package.
 
<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.

Revision as of 15:44, 10 April 2013

RPM Build Notes

Install Mach

Start with a minimal install of CentOS 6.2.

$ 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

Due to a permissions bug I hit with mach (during a file copy), we'll continue as root.

Create /root/.machrc:

config['centos-6-x86_64-os']['macros']['dist'] = '.el6'
config['centos-6-i386-os']['macros']['dist'] = '.el6'

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:

$ 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

Then edit these .spec file lines to update the Python version and package release number:

%define pyrel 3
Release:        0%{?dist}

Now we want to rebuild the package.

$ rm -rf /usr/local/var/tmp/mach/*
$ mach='mach --debug -r centos-6-x86_64-os'
$ $mach clean
$ $mach build mozilla-python27/python27.spec

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.