ghc-rpm-macros/ghc-deps.sh
Jens Petersen 37fe2b4ab7 support packaging Cabal bundled internal libraries
for some reason installing with Cabal (rather than cabal-install)
gives different hashes for the sublibrary

simplification of initial work in opensuse by Ondřej Súkup
https://github.com/fedora-haskell/ghc-rpm-macros/pull/7

testcase was haddock-library-1.4.5
2018-05-25 19:24:07 +09:00

44 lines
1009 B
Bash
Executable File

#!/bin/sh
# find rpm provides and requires for Haskell GHC libraries
[ $# -ne 2 ] && echo "Usage: $(basename $0) [--provides|--requires] %{buildroot}%{ghclibdir}" && exit 1
set +x
mode=$1
pkgbasedir=$2
pkgconfdir=$pkgbasedir/package.conf.d
ghc_pkg="/usr/lib/rpm/ghc-pkg-wrapper $pkgbasedir"
case $mode in
--provides) field=id ;;
--requires) field=depends ;;
*) echo "$(basename $0): Need --provides or --requires"
exit 1
;;
esac
ghc_ver=$(basename $pkgbasedir | sed -e s/ghc-//)
files=$(cat)
for i in $files; do
case $i in
# exclude builtin_rts.conf
$pkgconfdir/*-*.conf)
name=$(grep "^name: " $i | sed -e "s/name: //")
ids=$($ghc_pkg field $name $field | sed -e "s/rts//" -e "s/bin-package-db-[^ ]\+//")
for d in $ids; do
case $d in
*-*) echo "ghc-devel($d)" ;;
*) ;;
esac
done
;;
*)
;;
esac
done