Commit c6d66785 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

New RPM provides for the varnishd and VMODs

The find-provides script takes the original script and forwards almost
all lines to the original find-provides command provided by RPM. In
order for this to work, %global needs to be used instead of %define to
ensure immediate expansion and avoid infinite recursion.

VMODs are not forwared to find-provides because it matters little to
advertise them as shared objects in the traditional sense.

The output looks like this:

    vmod(blob)
    vmod(directors)
    vmod(purge)
    vmod(std)
    vmod(vtc)
    varnishd(abi) = <sha1>
    varnishd(vrt) = x.y

Partially fixes #8 because in order to make this useful for VMODs
without forcing package maintainers to manually require either the
exact ABI or a given VRT version, a means for automatic requires
for VMOD builds is missing. This doesn't address the NOGIT case,
but we don't support packaging not originating from a git commit.

This would make #92 obsolete once something similar is done on the
DPKG side.
parent b5b14211
#!/bin/bash
#!/bin/sh
#
# This script is used to inject the Varnish ABI into the RPM Provides.
set -o errexit
#set -e
if [ -x /usr/lib/rpm/redhat/find-provides ]; then
/usr/lib/rpm/redhat/find-provides "$@"
elif [ -x /usr/lib/rpm/find-provides ]; then
/usr/lib/rpm/find-provides "$@"
fi
BUILD_DIR=$(dirname "$0")
FIND_PROVIDES="$1"
shift
# We don't install vcs_version.h, so we can't use RPM_BUILD_ROOT directly.
cd /builddir/build/BUILD/varnish* || true
cd ${RPM_BUILD_ROOT}/../../BUILD/varnish* || true
expand_macro() {
cpp - -Iinclude <<-EOF |
#include "vcs_version.h"
#include "vdef.h"
#include "vrt.h"
$1
EOF
tail -1
}
printf '#include "vcs_version.h"\nVCS_Version\n' \
| cpp - -Iinclude | sed -e '/^"/!d' -e 's/\"//g' -e 's/^/varnishabi-strict-/'
varnishd_provides() (
cd "$BUILD_DIR"
printf '#include "vrt.h"\nvarnishabi- VRT_MAJOR_VERSION . VRT_MINOR_VERSION\n' \
| cpp - -Iinclude \
| sed -e '/^varnishabi-/!d' -e 's/U//g' -e 's/ //g'
ABI=$(expand_macro VCS_Version | tr -d '"')
VRT_MAJOR=$(expand_macro VRT_MAJOR_VERSION | tr -c -d '[0-9]')
VRT_MINOR=$(expand_macro VRT_MINOR_VERSION | tr -c -d '[0-9]')
cat <<-EOF
varnishd(abi) = $ABI
varnishd(vrt) = $VRT_MAJOR.$VRT_MINOR
EOF
)
while read -r FILE
do
case $FILE in
*bin/varnishd)
varnishd_provides
printf "%s\n" "$FILE" | $FIND_PROVIDES "$@"
;;
*/libvmod_*.so)
VMOD=${FILE##*/libvmod_}
VMOD=${VMOD%.so}
printf 'vmod(%s)\n' "$VMOD"
;;
*)
printf "%s\n" "$FILE" | $FIND_PROVIDES "$@"
;;
esac
done
%define vd_rc %{?v_rc:-%{?v_rc}}
%global vd_rc %{?v_rc:-%{?v_rc}}
%define _use_internal_dependency_generator 0
%define __find_provides %{_builddir}/%{srcname}/find-provides
%global _use_internal_dependency_generator 0
%global __find_provides %{_builddir}/%{srcname}/find-provides %__find_provides
%define debug_package %{nil}
%global debug_package %{nil}
Summary: High-performance HTTP accelerator
......
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