wiki:RpmBuilding

Version 5 (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

Create a ~/.rpmmacros file with the following content

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

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

Singing of packages can now be done with:

rpm --addsign *.rpm

get the src rpms

wget -r --no-parent -A *.src.rpm -R *drpms* *repodata*  https://ast.tucny.com/repo/asterisk-common/el7/SRPMS/

Make sure the right target release is specified in /etc/mock/default.cfg