gen_contents_index is run with --batch by cronjob, otherwise does nothing. This avoids overhead of running of re-indexing each time a ghc-*-devel package is installed, updated, or removed.epel9
parent
43cebbc1fd
commit
60d9f57f31
@ -0,0 +1,39 @@
|
||||
#! /bin/bash
|
||||
|
||||
if [ -e /etc/sysconfig/ghc-doc-index ]; then
|
||||
. /etc/sysconfig/ghc-doc-index
|
||||
fi
|
||||
|
||||
if [ "$CRON" = "no" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
LOCKFILE=/var/lock/ghc-doc-index.lock
|
||||
|
||||
# the lockfile is not meant to be perfect, it's just in case the
|
||||
# two man-db cron scripts get run close to each other to keep
|
||||
# them from stepping on each other's toes. The worst that will
|
||||
# happen is that they will temporarily corrupt the database
|
||||
[ -f $LOCKFILE ] && exit 0
|
||||
|
||||
trap "{ rm -f $LOCKFILE ; exit 255; }" EXIT
|
||||
touch $LOCKFILE
|
||||
|
||||
# only re-index ghc docs when there are changes
|
||||
cd /usr/share/doc/ghc/html/libraries
|
||||
if [ -r .pkg-dir.cache ]; then
|
||||
ls -d */ > .pkg-dir.cache.new
|
||||
DIR_DIFF=$(diff .pkg-dir.cache .pkg-dir.cache.new)
|
||||
else
|
||||
ls -d */ > .pkg-dir.cache
|
||||
fi
|
||||
if [ -x "gen_contents_index" -a ! -r ".pkg-dir.cache.new" -o -n "$DIR_DIFF" ]; then
|
||||
./gen_contents_index --batch
|
||||
fi
|
||||
|
||||
if [ -f .pkg-dir.cache.new ]; then
|
||||
mv -f .pkg-dir.cache{.new,}
|
||||
fi
|
||||
|
||||
exit 0
|
@ -0,0 +1,23 @@
|
||||
diff -u ghc-6.12.3/libraries/gen_contents_index\~ ghc-6.12.3/libraries/gen_contents_index
|
||||
--- ghc-6.12.3/libraries/gen_contents_index~ 2010-09-14 13:03:12.000000000 +1000
|
||||
+++ ghc-6.12.3/libraries/gen_contents_index 2010-11-04 18:26:00.000000000 +1000
|
||||
@@ -21,6 +21,6 @@
|
||||
HADDOCK_ARGS="$HADDOCK_ARGS $HADDOCK_ARG"
|
||||
done
|
||||
;;
|
||||
-*)
|
||||
+--batch)
|
||||
HADDOCK=/usr/bin/haddock
|
||||
# We don't want the GHC API to swamp the index
|
||||
@@ -32,6 +32,9 @@
|
||||
HADDOCK_ARGS="$HADDOCK_ARGS $HADDOCK_ARG"
|
||||
done
|
||||
;;
|
||||
+ *)
|
||||
+ HADDOCK=/bin/true
|
||||
+ tty -s && echo Run with '--batch' to index package haddock docs.
|
||||
esac
|
||||
|
||||
# Now create the combined contents and index pages
|
||||
|
||||
Diff finished. Thu Nov 4 18:26:04 2010
|
Loading…
Reference in new issue