Commit 3589c753 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune Committed by Denis Brækhus

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 100fe4af
#!/bin/bash #!/bin/sh
#
# This script is used to inject the Varnish ABI into the RPM Provides. # 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 BUILD_DIR=$(dirname "$0")
/usr/lib/rpm/redhat/find-provides "$@" FIND_PROVIDES="$1"
elif [ -x /usr/lib/rpm/find-provides ]; then shift
/usr/lib/rpm/find-provides "$@"
fi
# We don't install vcs_version.h, so we can't use RPM_BUILD_ROOT directly. expand_macro() {
cd /builddir/build/BUILD/varnish* || true cpp - -Iinclude <<-EOF |
cd ${RPM_BUILD_ROOT}/../../BUILD/varnish* || true #include "vcs_version.h"
#include "vdef.h"
#include "vrt.h"
$1
EOF
tail -1
}
printf '#include "vcs_version.h"\nVCS_Version\n' \ varnishd_provides() (
| cpp - -Iinclude | sed -e '/^"/!d' -e 's/\"//g' -e 's/^/varnishabi-strict-/' cd "$BUILD_DIR"
printf '#include "vrt.h"\nvarnishabi- VRT_MAJOR_VERSION . VRT_MINOR_VERSION\n' \ ABI=$(expand_macro VCS_Version | tr -d '"')
| cpp - -Iinclude \ VRT_MAJOR=$(expand_macro VRT_MAJOR_VERSION | tr -c -d '[0-9]')
| sed -e '/^varnishabi-/!d' -e 's/U//g' -e 's/ //g' 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 %global _use_internal_dependency_generator 0
%define __find_provides %{_builddir}/%{srcname}/find-provides %global __find_provides %{_builddir}/%{srcname}/find-provides %__find_provides
%define debug_package %{nil} %global debug_package %{nil}
Summary: High-performance HTTP accelerator 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