|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
# find rpm provides and requires for Haskell GHC libraries
|
|
|
|
|
|
|
|
|
|
[ $# -lt 2 ] && echo "Usage: $(basename $0) [--provides|--requires] %{buildroot} %{ghclibdir} [%{?ghc_name}]" && exit 1
|
|
|
|
|
[ $# -lt 2 ] && echo "Usage: $(basename "$0") [--provides|--requires] %{buildroot} %{ghclibdir} [%{?ghc_version}]" && exit 1
|
|
|
|
|
|
|
|
|
|
set +x
|
|
|
|
|
|
|
|
|
@ -12,7 +12,7 @@ if [ -z "$4" ];
|
|
|
|
|
then GHCPREFIX=ghc
|
|
|
|
|
else GHCPREFIX=$4
|
|
|
|
|
fi
|
|
|
|
|
if [ -d $BUILDROOT$PKGBASEDIR/lib ];
|
|
|
|
|
if [ -d "$BUILDROOT$PKGBASEDIR/lib" ];
|
|
|
|
|
then PKGBASELIB=$PKGBASEDIR/lib
|
|
|
|
|
else PKGBASELIB=$PKGBASEDIR
|
|
|
|
|
fi
|
|
|
|
@ -23,20 +23,20 @@ GHC_PKG="/usr/lib/rpm/ghc-pkg-wrapper $BUILDROOT$PKGBASEDIR"
|
|
|
|
|
case $MODE in
|
|
|
|
|
--provides) field=id ;;
|
|
|
|
|
--requires) field=depends ;;
|
|
|
|
|
*) echo "$(basename $0): Need --provides or --requires"
|
|
|
|
|
*) echo "$(basename "$0"): Need --provides or --requires"
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
files=$(cat)
|
|
|
|
|
|
|
|
|
|
(
|
|
|
|
|
for i in $files; do
|
|
|
|
|
meta=""
|
|
|
|
|
case $i in
|
|
|
|
|
# exclude rts.conf
|
|
|
|
|
$BUILDROOT$PKGCONFDIR/*-*.conf)
|
|
|
|
|
name=$(grep "^name: " $i | sed -e "s/name: //")
|
|
|
|
|
ids=$($GHC_PKG field $name $field | sed -e "s/\(^\| \)rts\( \|$\)/ /")
|
|
|
|
|
name=$(grep "^name: " "$i" | sed -e "s/name: //")
|
|
|
|
|
ids=$($GHC_PKG field "$name" "$field" | sed -e "s/\(^\| \)rts\( \|$\)/ /")
|
|
|
|
|
for d in $ids; do
|
|
|
|
|
case $d in
|
|
|
|
|
*-*-internal) ;;
|
|
|
|
@ -46,8 +46,8 @@ for i in $files; do
|
|
|
|
|
done
|
|
|
|
|
;;
|
|
|
|
|
*/libHS*_p.a)
|
|
|
|
|
pkgver=$(basename $(dirname $i))
|
|
|
|
|
ids=$($GHC_PKG field $pkgver $field | sed -e "s/\(^\| \)rts\( \|$\)/ /" -e "s/bin-package-db-[^ ]\+//")
|
|
|
|
|
pkgver=$(basename "$(dirname "$i")")
|
|
|
|
|
ids=$($GHC_PKG field "$pkgver" "$field" | sed -e "s/\(^\| \)rts\( \|$\)/ /" -e "s/bin-package-db-[^ ]\+//")
|
|
|
|
|
for d in $ids; do
|
|
|
|
|
case $d in
|
|
|
|
|
*-*-internal) ;;
|
|
|
|
@ -57,7 +57,7 @@ for i in $files; do
|
|
|
|
|
echo "$GHCPREFIX-prof($d)"
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
if [ -f $PKGBASELIB/*/libHS${d}_p.a -o -f $BUILDROOT$PKGBASELIB/*/libHS${d}_p.a ]; then
|
|
|
|
|
if [ -f "$PKGBASELIB"/*/libHS"${d}"_p.a ] || [ -f "$BUILDROOT$PKGBASELIB"/*/libHS"${d}"_p.a ]; then
|
|
|
|
|
echo "$GHCPREFIX-prof($d)"
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
@ -68,3 +68,4 @@ for i in $files; do
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
) | sort | uniq
|
|
|
|
|