Changes

Jump to: navigation, search

ReleaseEngineering/PuppetAgain/HowTo/Build RPMs

2,364 bytes added, 16:22, 10 April 2013
no edit summary
= Building =
=How to Build RPMs= ==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 3Release: 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: Updated 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 instructions are available at httpsthe 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://wikihg.mozilla.org/RPM_Build_Notes#RPM_Build_Notesusers/john. Those 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 be merged into this document once they have been reviewedtell 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.
Confirm
1,018
edits

Navigation menu