move package cache file for doc cronjob to /var (#664850)

Also cache long listing to notice library rebuilds.
This commit is contained in:
Jens Petersen 2010-12-30 11:06:23 +09:00
parent 9556d647dd
commit 04dec3dc5e
2 changed files with 19 additions and 12 deletions

View File

@ -12,28 +12,30 @@ 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
# two cron scripts get run close to each other to keep
# them from stepping on each other's toes.
[ -f $LOCKFILE ] && exit 0
trap "{ rm -f $LOCKFILE ; exit 255; }" EXIT
touch $LOCKFILE
PKGDIRCACHE=/var/lib/ghc/pkg-dir.cache
LISTING="env LANG=C ls -dl"
# 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)
if [ -r "$PKGDIRCACHE" ]; then
$LISTING */ > $PKGDIRCACHE.new
DIR_DIFF=$(diff $PKGDIRCACHE $PKGDIRCACHE.new)
else
ls -d */ > .pkg-dir.cache
$LISTING */ > $PKGDIRCACHE
fi
if [ -x "gen_contents_index" -a ! -r ".pkg-dir.cache.new" -o -n "$DIR_DIFF" ]; then
if [ -x "gen_contents_index" -a ! -r "$PKGDIRCACHE.new" -o -n "$DIR_DIFF" ]; then
./gen_contents_index --batch
fi
if [ -f .pkg-dir.cache.new ]; then
mv -f .pkg-dir.cache{.new,}
if [ -f $PKGDIRCACHE.new ]; then
mv -f $PKGDIRCACHE{.new,}
fi
exit 0

View File

@ -26,9 +26,9 @@
%global debug_package %{nil}
Name: ghc
# breaks haskell-platform-2010.2.0.0
# haskell-platform-2011.1.0.0
Version: 7.0.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Glasgow Haskell Compilation system
# fedora ghc has only been bootstrapped on the following archs:
ExclusiveArch: %{ix86} x86_64 ppc alpha
@ -211,6 +211,7 @@ done
%if %{with doc}
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.hourly
install -p --mode=755 %SOURCE3 ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.hourly/ghc-doc-index
mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/lib/ghc
%endif
%check
@ -291,6 +292,7 @@ fi
%ghost %{ghcdocbasedir}/libraries/minus.gif
%ghost %{ghcdocbasedir}/libraries/plus.gif
%{_sysconfdir}/cron.hourly/ghc-doc-index
%{_localstatedir}/lib/ghc
%endif
%if %{with shared}
@ -304,6 +306,9 @@ fi
%endif
%changelog
* Thu Dec 30 2010 Jens Petersen <petersen@redhat.com> - 7.0.1-3
- store doc cronjob package cache file under /var (#664850)
* Wed Nov 24 2010 Jens Petersen <petersen@redhat.com> - 7.0.1-2
- require libffi-devel