Skip to content

Instantly share code, notes, and snippets.

@borisisok
Last active June 17, 2020 14:58
Show Gist options
  • Save borisisok/e5b173072646bd3fd75138c784e9a463 to your computer and use it in GitHub Desktop.
Save borisisok/e5b173072646bd3fd75138c784e9a463 to your computer and use it in GitHub Desktop.
Rebuild varnish-6.2.0 Centos7 rpm packages with the help of mock.
yum -y install mock
adduser mockbuild
usermod -a -G mock mockbuild
su - mockbuild
mock -r epel-7-x86_64 --init
wget https://packagecloud.io/varnishcache/varnish62/el/7/SRPMS/varnish-6.2.0-1.el7.src.rpm
# rebuild without modification
mock -r epel-7-x86_64 --target=x86_64 \
--define "srcname varnish-6.2.0" \
--define "versiontag 6.2.0" \
--define "releasetag 1" \
--rebuild varnish-6.2.0-1.el7.src.rpm
# rebuild with some modification in spec or source
rpm -ivh varnish-6.2.0-1.el7.src.rpm
cd ~/rpmbuild/
vi SPECS/varnish.spec
mock -r epel-7-x86_64 --target=x86_64 \
--define "srcname varnish-6.2.0" \
--define "versiontag 6.2.0" \
--define "releasetag 1" \
--spec=SPECS/varnish.spec \
--sources=SOURCES/ \
--buildsrpm
cp /var/lib/mock/epel-7-x86_64/result/varnish-6.2.0-1.el7.src.rpm /tmp/
mock -r epel-7-x86_64 --target=x86_64 \
--define "srcname varnish-6.2.0" \
--define "versiontag 6.2.0" \
--define "releasetag 1" \
--rebuild /tmp/varnish-6.2.0-1.el7.src.rpm
rpm -qip /var/lib/mock/epel-7-x86_64/result/varnish-6.2.0-1.el7.x86_64.rpm
@borisisok
Copy link
Author

borisisok commented Aug 30, 2019

The varnish package is a nice example for a mock build since it fails on a plain Centos7 due to a python version clash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment