2010-05-25 04:13:45 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-05-25 10:02:47 +00:00
|
|
|
# script to generate dependency graph for fedora haskell libraries
|
|
|
|
# requires ghc, ghc-*-devel and graphviz to be installed
|
|
|
|
|
2010-06-03 12:38:38 +00:00
|
|
|
set -e +x
|
2010-05-25 04:13:45 +00:00
|
|
|
|
|
|
|
mkdir -p .pkg-deps
|
|
|
|
|
|
|
|
cd .pkg-deps
|
|
|
|
|
2010-06-02 08:31:03 +00:00
|
|
|
# remove the closing line
|
|
|
|
ghc-pkg dot --global | sed '$d' > pkgs.dot
|
2010-05-25 04:13:45 +00:00
|
|
|
|
2010-06-28 05:52:48 +00:00
|
|
|
# check for binary deps too
|
2010-09-13 03:40:56 +00:00
|
|
|
for i in alex cabal-install cpphs darcs ghc happy gtk2hs-buildtools haskell-platform hedgewars hscolour kaya xmobar xmonad; do
|
2010-06-03 12:38:38 +00:00
|
|
|
PKG_THERE=yes
|
|
|
|
PKG=`rpm -q --qf "%{name}-%{version}" $i` || PKG_THERE=no
|
|
|
|
if [ "$PKG_THERE" = "yes" ]; then
|
2010-06-28 05:52:48 +00:00
|
|
|
echo \"$PKG\" >> pkgs.dot
|
2010-06-03 12:38:38 +00:00
|
|
|
case $i in
|
|
|
|
haskell-platform)
|
|
|
|
rpm -q --requires $i | grep -v rpmlib | grep -v ghc | sed -e "s/^/\"$PKG\" -> \"/g" -e "s/ = \(.*\)/-\1\"/" >> pkgs.dot
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
rpm -q --requires $i | grep ghc6 | sed -e "s/libHS/\"$PKG\" -> \"/g" -e "s/-ghc6.*/\"/" >> pkgs.dot
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2010-06-02 08:31:03 +00:00
|
|
|
done
|
|
|
|
|
2010-06-28 05:52:48 +00:00
|
|
|
# make sure all libs there
|
2010-09-13 03:40:56 +00:00
|
|
|
rpm -qa --qf "\"%{name}-%{version}\"\n" ghc-\* | egrep -v -- "(ghc-libs|-prof|-devel|-doc|rpm-macros)-" | sed -e s/^\"ghc-/\"/g >> pkgs.dot
|
2010-06-28 05:52:48 +00:00
|
|
|
|
2010-06-02 08:31:03 +00:00
|
|
|
# and add it back
|
|
|
|
echo "}" >> pkgs.dot
|
2010-05-25 04:13:45 +00:00
|
|
|
|
2010-06-02 08:31:03 +00:00
|
|
|
cp -p pkgs.dot pkgs.dot.orig
|
2010-05-25 04:13:45 +00:00
|
|
|
|
2010-06-03 12:38:38 +00:00
|
|
|
# ignore library packages provided by ghc (except ghc-6.12)
|
|
|
|
GHC_PKGS="array base-4 base-3 bin-package-db bytestring Cabal containers directory dph extensible-exceptions filepath ffi ghc-binary ghc-prim haskell98 hpc integer-gmp old-locale old-time pretty process random rts syb template-haskell time unix Win32"
|
2010-05-25 04:13:45 +00:00
|
|
|
for i in $GHC_PKGS; do sed -i -e /$i/d pkgs.dot; done
|
|
|
|
|
|
|
|
cat pkgs.dot | tred | dot -Nfontsize=8 -Tsvg >pkgs.svg
|
2010-05-25 10:02:47 +00:00
|
|
|
|
2010-06-03 07:25:14 +00:00
|
|
|
if [ -n "$DISPLAY" ]; then
|
2010-06-03 07:22:29 +00:00
|
|
|
xdg-open pkgs.svg
|
2010-06-28 05:52:48 +00:00
|
|
|
else
|
|
|
|
echo open ".pkg-deps/pkgs.svg" to display pkg graph
|
2010-06-03 07:22:29 +00:00
|
|
|
fi
|