2010-09-30 02:21:16 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# find rpm provides and requires for Haskell GHC libraries
|
|
|
|
|
2011-05-09 04:59:58 +00:00
|
|
|
[ $# -ne 2 ] && echo "Usage: `basename $0` [--provides|--requires] %{buildroot}%{ghclibdir}" && exit 1
|
2010-09-30 02:21:16 +00:00
|
|
|
|
2013-09-10 03:42:26 +00:00
|
|
|
set +x
|
2013-09-09 14:17:35 +00:00
|
|
|
|
2010-09-30 02:21:16 +00:00
|
|
|
MODE=$1
|
2010-11-23 05:01:27 +00:00
|
|
|
PKGBASEDIR=$2
|
|
|
|
PKGCONFDIR=$PKGBASEDIR/package.conf.d
|
2010-09-30 02:21:16 +00:00
|
|
|
|
2010-11-23 13:48:16 +00:00
|
|
|
case $MODE in
|
|
|
|
--provides) FIELD=id ;;
|
|
|
|
--requires) FIELD=depends ;;
|
|
|
|
*) echo "`basename $0`: Need --provides or --requires" ; exit 1
|
|
|
|
esac
|
|
|
|
|
2010-09-30 02:21:16 +00:00
|
|
|
files=$(cat)
|
|
|
|
|
2011-01-23 05:05:38 +00:00
|
|
|
for i in $files; do
|
2015-03-02 04:21:32 +00:00
|
|
|
case $i in
|
2016-06-03 04:16:35 +00:00
|
|
|
# exclude builtin_rts.conf
|
|
|
|
$PKGCONFDIR/*-*.conf)
|
|
|
|
PKGVER=$(echo $i | sed -e "s%$PKGCONFDIR/\(.\+\)-.\+.conf%\1%")
|
|
|
|
OUT=$(/usr/lib/rpm/ghc-pkg-wrapper $PKGBASEDIR field $PKGVER $FIELD | sed -e "s/^depends: \+//" -e "s/rts//" -e "s/bin-package-db-[^ ]\+//")
|
|
|
|
for d in $OUT; do
|
|
|
|
case $d in
|
|
|
|
*-*) echo "ghc-devel($d)" ;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
*)
|
2015-03-02 04:21:32 +00:00
|
|
|
;;
|
|
|
|
esac
|
2011-01-23 05:05:38 +00:00
|
|
|
done
|