Commit ad281149 authored by Geoff Simmons's avatar Geoff Simmons

Add RPM packaging code.

parent 3141b735
#! /bin/bash -ex
# Build script for a VMOD re2 el7 RPM
# to be run in the rpmbuild/centos7 docker container.
# Env variables VERSION and RELEASE MUST be set in the docker invocation.
# DIST is set by the rpmbuild/centos7 container.
# The directory mounted to /srv MUST contain these files:
# - this script (named pkg)
# - VMOD re2 tarball (vmod-re2-$VERSION.tar.gz)
# - RPM spec file (vmod-re2.spec)
# - yum repo config for varnish5@packagecloud (varnishcache_varnish5.repo)
# (see https://packagecloud.io/varnishcache/varnish5/install#manual-rpm)
# At the end of the run, binary, source and debuginfo RPMs are in the
# directory mounted to /srv.
if [ -z $VERSION ]; then
echo "Env variable VERSION MUST be set"
exit 1
fi
if [ -z $RELEASE ]; then
echo "Env variable RELEASE MUST be set"
exit 1
fi
# delete the peculiar macros from the rpmbuild/centos7 image
rm /home/builder/.rpmmacros
# set up the build environment
cd /home/builder
mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
cp /srv/vmod-re2.spec rpmbuild/SPECS
cp /srv/vmod-re2-${VERSION}.tar.gz rpmbuild/SOURCES
# install epel7 repo
sudo yum install -y -q \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# set up varnish repo
sudo cp /srv/varnishcache_varnish5.repo /etc/yum.repos.d/
sudo yum -q makecache -y --disablerepo='*' --enablerepo='varnishcache_varnish5'
# build requirements
sudo yum install -y -q \
varnish-devel re2-devel pkgconfig make gcc gcc-c++ python-docutils
# build RPMs
rpmbuild -ba -D "dist .${DIST}" \
-D "_version ${VERSION}" \
-D "_release ${RELEASE}" \
rpmbuild/SPECS/vmod-re2.spec
sudo cp rpmbuild/RPMS/*/* /srv
sudo cp rpmbuild/SRPMS/* /srv
[varnishcache_varnish5]
name=varnishcache_varnish5
baseurl=https://packagecloud.io/varnishcache/varnish5/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/varnishcache/varnish5/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
[varnishcache_varnish5-source]
name=varnishcache_varnish5-source
baseurl=https://packagecloud.io/varnishcache/varnish5/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/varnishcache/varnish5/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
# -D MUST pass in _version and _release, and SHOULD pass in dist.
Summary: Google RE2 regular expression module for Varnish Cache
Name: vmod-re2
Version: %{_version}
Release: %{_release}%{?dist}
License: BSD
Group: System Environment/Daemons
URL: https://code.uplex.de/uplex-varnish/libvmod-re2
Source0: %{name}-%{version}.tar.gz
# varnish from varnish5 at packagecloud
Requires: varnish >= 5.2.0
Requires: re2 >= 20150501
BuildRequires: varnish-devel >= 5.2.0
BuildRequires: re2-devel >= 20150501
BuildRequires: pkgconfig
BuildRequires: make
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: python-docutils >= 0.6
# git builds
#BuildRequires: automake
#BuildRequires: autoconf
#BuildRequires: autoconf-archive
#BuildRequires: libtool
#BuildRequires: python-docutils >= 0.6
Provides: vmod-re2, vmod-re2-debuginfo
%description
Varnish Module (VMOD) for access to the Google RE2 regular expression
engine.
%prep
%setup -q -n %{name}-%{version}
%build
# if this were a git build
# ./autogen.sh
%configure
make
%check
make check
%install
make install DESTDIR=%{buildroot}
# Only use the version-specific docdir created by %doc below
rm -rf %{buildroot}%{_docdir}
# None of these for fedora/epel
find %{buildroot}/%{_libdir}/ -name '*.la' -exec rm -f {} ';'
find %{buildroot}/%{_libdir}/ -name '*.a' -exec rm -f {} ';'
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{_libdir}/varnish*/vmods/
%{_mandir}/man3/*.3*
%doc README.rst COPYING LICENSE
%post
/sbin/ldconfig
%changelog
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment