= 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=0 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 rpm --addsign /var/lib/mock/epel-7-x86_64/result/*.rpm cp /var/lib/mock/epel-7-x86_64/result/*src.rpm /var/www/html/repo/SRPMS/ rm -f /var/lib/mock/epel-7-x86_64/result/*src.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.src.rpm # wrong change log dates, after correction and re-creation of src rpm it compiles nicely mock --target=epel-7-x86_64 --rebuild dahdi-tools-2.11.1-1.el7.src.rpm # had to re-create src.rpm from spec file before it wanted to set the arch correct in output (?) mock --target=epel-7-x86_64 --rebuild asterisk-sounds-core-1.5.0-1.el7.centos.src.rpm mock --target=epel-7-x86_64 --rebuild asterisk-moh-opsound-2.03-1.el7.centos.src.rpm mock --target=epel-7-x86_64 --rebuild libss7-2.0.0-1.el7.centos.src.rpm mock --target=epel-7-x86_64 --rebuild libresample-0.1.3-13.el7.centos.src.rpm mock --target=epel-7-x86_64 --rebuild libpri-1.6.0-1.el7.centos.src.rpm mock --target=epel-7-x86_64 --rebuild iksemel-1.5-0.1.git978b733.el7.src.rpm }}}