- add buildroot/ghcpkgbasedir to ghc-deps.sh args - calculate package and metadata by checking all library files in stdin - prof depends on devel, devel on base - update macros.ghc: - rename ghc_requires to ghc_devel_requires - drop ghc_doc_requires - ghc_reindex_haddock is deprecated and now a no-opepel9
parent
02c69a3bd2
commit
7232a81da9
@ -1,3 +1,7 @@
|
|||||||
|
Maintainer:
|
||||||
|
Jens Petersen <petersen@redhat.com>
|
||||||
|
|
||||||
|
Initial implementation:
|
||||||
Bryan O'Sullivan
|
Bryan O'Sullivan
|
||||||
Jens Petersen
|
Jens Petersen
|
||||||
Yaakov Nemoy
|
Yaakov Nemoy
|
@ -1,35 +1,50 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# find rpm provides and requires for Haskell GHC libraries
|
# find rpm provides and requires for Haskell GHC libraries
|
||||||
|
|
||||||
#set -x
|
|
||||||
|
|
||||||
# To use add the following lines to spec file:
|
# To use add the following lines to spec file:
|
||||||
# %define _use_internal_dependency_generator 0
|
# %define _use_internal_dependency_generator 0
|
||||||
# %define __find_requires /usr/lib/rpm/ghc-deps.sh --requires
|
# %define __find_requires /usr/lib/rpm/ghc-deps.sh --requires %{buildroot}%{ghcpkgbasedir}
|
||||||
# %define __find_provides /usr/lib/rpm/ghc-deps.sh --provides
|
# %define __find_provides /usr/lib/rpm/ghc-deps.sh --provides %{buildroot}%{ghcpkgbasedir}
|
||||||
|
|
||||||
[ $# -ne 1 ] && echo "Usage: `basename $0` [--provides|--requires]" && exit 1
|
[ $# -ne 2 ] && echo "Usage: `basename $0` [--provides|--requires] %{buildroot}" && exit 1
|
||||||
|
|
||||||
MODE=$1
|
MODE=$1
|
||||||
|
PKGBASEDIR=$2
|
||||||
case $MODE in
|
PKGCONFDIR=$PKGBASEDIR/package.conf.d
|
||||||
--provides) FIELD=id ;;
|
|
||||||
--requires) FIELD=depends
|
|
||||||
esac
|
|
||||||
|
|
||||||
files=$(cat)
|
files=$(cat)
|
||||||
|
|
||||||
PKGCONF=$(echo $files | tr [:blank:] '\n' | grep package.conf.d)
|
#set -x
|
||||||
|
|
||||||
if [ -n "$PKGCONF" ]; then
|
if [ -d "$PKGCONFDIR" ]; then
|
||||||
CONFDIR=$(dirname $PKGCONF)
|
for i in $files; do
|
||||||
PKGS=$(ghc-pkg -f $CONFDIR describe '*' | awk '/^name: / {print $2}')
|
LIB_FILE=$(echo $i | grep /libHS | grep -v /libHSrts)
|
||||||
for pkg in $PKGS; do
|
if [ -n "$LIB_FILE" ]; then
|
||||||
HASHS=$(ghc-pkg -f $CONFDIR field $pkg $FIELD | sed -e "s/^$FIELD: \+//")
|
case $LIB_FILE in
|
||||||
for i in $HASHS; do
|
*.so) META=ghc ;;
|
||||||
echo "ghc($i)"
|
*_p.a) META=ghc-prof SELF=ghc-devel ;;
|
||||||
done
|
*.a) META=ghc-devel SELF=ghc ;;
|
||||||
done
|
esac
|
||||||
|
if [ -n "$META" ]; then
|
||||||
|
case $MODE in
|
||||||
|
--provides) FIELD=id ;;
|
||||||
|
--requires) FIELD=depends ;;
|
||||||
|
*) echo "`basename $0`: Need --provides or --requires" ; exit 1
|
||||||
|
esac
|
||||||
|
PKGVER=$(echo $LIB_FILE | sed -e "s%$PKGBASEDIR/*\([^/]\+\)/libHS.*%\1%")
|
||||||
|
HASHS=$(ghc-pkg -f $PKGCONFDIR field $PKGVER $FIELD | sed -e "s/^$FIELD: \+//")
|
||||||
|
for i in $HASHS; do
|
||||||
|
echo $i | sed -e "s/\(.*\)-\(.*\)/$META(\1) = \2/"
|
||||||
|
done
|
||||||
|
if [ "$MODE" = "--requires" -a -n "$SELF" ]; then
|
||||||
|
HASHS=$(ghc-pkg -f $PKGCONFDIR field $PKGVER id | sed -e "s/^id: \+//")
|
||||||
|
for i in $HASHS; do
|
||||||
|
echo $i | sed -e "s/\(.*\)-\(.*\)/$SELF(\1) = \2/"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $files | tr [:blank:] '\n' | /usr/lib/rpm/rpmdeps $MODE
|
echo $files | tr [:blank:] '\n' | /usr/lib/rpm/rpmdeps $MODE
|
||||||
|
Loading…
Reference in new issue