wiki:RpmBuilding

Version 9 (modified by jorrit, 6 years ago) (diff)

--

Building RPMs with Mock

I'll try to write down what I need to do to set-up a simple rpm build system using mock, whereby some packages have dependencies on my own builds.

Requirements for the build system

yum install mock createrepo yum-utils

Create the following directories to allow inspection and modification of RPM packages

mkdir -p ~/rpm/BUILD ~/rpm/RPMS ~/rpm/SOURCES ~/rpm/SPECS ~/rpm/SRPMS

Create a ~/.rpmmacros file with the following content

%HOME       %{expand:%%(cd; pwd)}
%_topdir    %{HOME}/rpm

Any source rpm you now install (as regular user) will end up under $HOME/rpm/*

Generate a GPG signing key:

gpg --gen-key

follow the instructions

gpg --export -a 'Jorrit Jorritsma' > ~/RPM-GPG-KEY-jorrit

Import your public key to your RPM DB

sudo rpm --import RPM-GPG-KEY-jorrit

Add the following to your ~/.rpmmacros file

%_signature gpg
%_gpg_path ~/.gnupg
%_gpg_name Jorrit Jorritsma
%_gpgbin /usr/bin/gpg

Singing of packages can now be done with:

rpm --addsign *.rpm

Create a rpm repository under your web server:

sudo mkdir -p /var/www/html/repos
sudo chown jorrit. /var/www/html/repos
mkdir /var/www/html/repos/x86_64
createrepo /var/www/html/repo/x86_64

Add your own repo to your mock config for the target build (e.g. /etc/mock/epel-7-x86_64.cfg)

[jj]
name=jj
baseurl=http://centos7.fritz.box/repo/x86_64/
gpgcheck=1
skip_if_unavailable=False

get the src rpms

mkdir ~/asterisk
cd asterisk
wget -r --no-parent -A *.src.rpm https://ast.tucny.com/repo/

Build the packages

move to the package download location

cd asterisk/ast.tucny.com/repo/asterisk-common/el7/SRPMS

Build

mock --target=epel-7-x86_64 --rebuild dahdi-linux-2.11.1-2.el7.centos.src.rpm
rm -f /var/lib/mock/epel-7-x86_64/result/*src.rpm
rpm --addsign /var/lib/mock/epel-7-x86_64/result/*.rpm
cp /var/lib/mock/epel-7-x86_64/result/*.rpm /var/www/html/repo/x86_64
createrepo --update /var/www/html/repo/x86_64

mock --target=epel-7-x86_64 --rebuild dahdi-firmware-2.11.0-2.el7.centos.src.rpm