add a cronjob for haddock indexing and disable gen_contents_index by default
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.
This commit is contained in:
parent
a7486154e6
commit
e89f5f0022
39
ghc-doc-index.cron
Executable file
39
ghc-doc-index.cron
Executable file
@ -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
|
23
ghc-gen_contents_index-cron-batch.patch
Normal file
23
ghc-gen_contents_index-cron-batch.patch
Normal file
@ -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
|
15
ghc.spec
15
ghc.spec
@ -26,7 +26,7 @@
|
||||
Name: ghc
|
||||
# part of haskell-platform-2010.2.0.0
|
||||
Version: 6.12.3
|
||||
Release: 7%{?dist}
|
||||
Release: 8%{?dist}
|
||||
Summary: Glasgow Haskell Compilation system
|
||||
# fedora ghc has only been bootstrapped on the following archs:
|
||||
ExclusiveArch: %{ix86} x86_64 ppc alpha
|
||||
@ -39,6 +39,7 @@ Source1: http://www.haskell.org/ghc/dist/%{version}/ghc-%{version}-src-extralibs
|
||||
%if %{with testsuite}
|
||||
Source2: http://www.haskell.org/ghc/dist/%{version}/testsuite-%{version}.tar.bz2
|
||||
%endif
|
||||
Source3: ghc-doc-index.cron
|
||||
URL: http://haskell.org/ghc/
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
# introduced for f14
|
||||
@ -69,6 +70,7 @@ BuildRequires: python
|
||||
%endif
|
||||
Patch1: ghc-6.12.1-gen_contents_index-haddock-path.patch
|
||||
Patch2: ghc-gen_contents_index-type-level.patch
|
||||
Patch3: ghc-gen_contents_cron-batch.patch
|
||||
|
||||
%description
|
||||
GHC is a state-of-the-art programming suite for Haskell, a purely
|
||||
@ -113,6 +115,8 @@ They should be installed when GHC's profiling subsystem is needed.
|
||||
%patch1 -p1 -b .orig
|
||||
# type-level too big so skip it in gen_contents_index
|
||||
%patch2 -p1
|
||||
# disable gen_contents_index when not --batch for cron
|
||||
%patch3 -p1
|
||||
|
||||
# make sure we don't use these
|
||||
rm -r ghc-tarballs/{mingw,perl}
|
||||
@ -190,6 +194,10 @@ done
|
||||
|
||||
%ghc_strip_dynlinked
|
||||
|
||||
%if %{with doc}
|
||||
mkdir -p %{_sysconfdir}/cron.hourly
|
||||
install -p --mode=755 %SOURCE3 %{_sysconfdir}/cron.hourly/ghc-doc-index
|
||||
%endif
|
||||
|
||||
%check
|
||||
# stolen from ghc6/debian/rules:
|
||||
@ -269,6 +277,7 @@ fi
|
||||
%ghost %{ghcdocbasedir}/libraries/index*.html
|
||||
%ghost %{ghcdocbasedir}/libraries/minus.gif
|
||||
%ghost %{ghcdocbasedir}/libraries/plus.gif
|
||||
%{_sysconfdir}/cron.hourly/ghc-doc-index
|
||||
%endif
|
||||
|
||||
%if %{with shared}
|
||||
@ -282,6 +291,10 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Nov 4 2010 Jens Petersen <petersen@redhat.com> - 6.12.3-8
|
||||
- add a cronjob for doc indexing
|
||||
- disable gen_contents_index when not run with --batch for cron
|
||||
|
||||
* Thu Nov 4 2010 Jens Petersen <petersen@redhat.com> - 6.12.3-7
|
||||
- skip huge type-level docs from haddock re-indexing (#649228)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user