2010-09-30 02:21:16 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# find rpm provides and requires for Haskell GHC libraries
|
|
|
|
|
2018-05-25 09:03:11 +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
|
|
|
|
2019-07-15 16:32:58 +00:00
|
|
|
MODE=$1
|
|
|
|
PKGBASEDIR=$2
|
|
|
|
PKGCONFDIR=$PKGBASEDIR/package.conf.d
|
2010-09-30 02:21:16 +00:00
|
|
|
|
2019-07-15 16:32:58 +00:00
|
|
|
GHC_PKG="/usr/lib/rpm/ghc-pkg-wrapper $PKGBASEDIR"
|
2016-10-12 10:22:07 +00:00
|
|
|
|
2019-07-15 16:32:58 +00:00
|
|
|
case $MODE in
|
2017-02-08 06:26:07 +00:00
|
|
|
--provides) field=id ;;
|
|
|
|
--requires) field=depends ;;
|
2018-05-25 09:03:11 +00:00
|
|
|
*) echo "$(basename $0): Need --provides or --requires"
|
|
|
|
exit 1
|
|
|
|
;;
|
2010-11-23 13:48:16 +00:00
|
|
|
esac
|
|
|
|
|
2010-09-30 02:21:16 +00:00
|
|
|
files=$(cat)
|
|
|
|
|
2011-01-23 05:05:38 +00:00
|
|
|
for i in $files; do
|
2019-07-15 16:32:58 +00:00
|
|
|
meta=""
|
2015-03-02 04:21:32 +00:00
|
|
|
case $i in
|
2019-07-31 08:05:32 +00:00
|
|
|
# exclude rts.conf
|
|
|
|
$pkgconfdir/*-*.conf)
|
|
|
|
name=$(grep "^name: " $i | sed -e "s/name: //")
|
2020-08-29 07:37:00 +00:00
|
|
|
ids=$($GHC_PKG field $name $field | sed -e "s/ rts\b//" -e "s/bin-package-db-[^ ]\+//")
|
2019-07-31 08:05:32 +00:00
|
|
|
for d in $ids; do
|
|
|
|
case $d in
|
2020-05-10 13:49:27 +00:00
|
|
|
*-*-internal) ;;
|
2019-07-31 08:05:32 +00:00
|
|
|
*-*) echo "ghc-devel($d)" ;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
done
|
2018-05-25 09:03:11 +00:00
|
|
|
;;
|
2019-07-31 08:05:32 +00:00
|
|
|
*/libHS*_p.a)
|
|
|
|
pkgver=$(basename $(dirname $i))
|
2020-08-29 07:37:00 +00:00
|
|
|
ids=$($GHC_PKG field $pkgver $field | sed -e "s/ rts\b//" -e "s/bin-package-db-[^ ]\+//")
|
2019-07-31 08:05:32 +00:00
|
|
|
for d in $ids; do
|
|
|
|
case $d in
|
2020-05-10 13:49:27 +00:00
|
|
|
*-*-internal) ;;
|
2019-08-10 20:43:05 +00:00
|
|
|
*-*)
|
|
|
|
case $field in
|
|
|
|
id)
|
|
|
|
echo "ghc-prof($d)"
|
|
|
|
;;
|
|
|
|
*)
|
2020-02-10 10:51:58 +00:00
|
|
|
if [ -f /usr/lib*/ghc-*/*/libHS${d}_p.a -o -f $PKGBASEDIR/*/libHS${d}_p.a ]; then
|
2019-08-10 20:43:05 +00:00
|
|
|
echo "ghc-prof($d)"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2019-07-31 08:05:32 +00:00
|
|
|
esac
|
|
|
|
done
|
2015-03-02 04:21:32 +00:00
|
|
|
;;
|
|
|
|
esac
|
2011-01-23 05:05:38 +00:00
|
|
|
done
|