RPM Build Notes: Difference between revisions

no edit summary
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.
Confirmed users
1,018

edits