Hi,
So I have been thinking a bit more about the install scripts in the guidelines, since there seems to me to be no good reason to run ghc-pkg and gen_contents_index more than once per rpm transaction. (Perhaps we should even recommend subpackaging ghc packages.)
But I thought I would just ask here once before committing and building the change below to make sure I am not missing something:
--- ghc-rpm-macros.ghc 23 Oct 2008 08:31:20 -0000 1.8 +++ ghc-rpm-macros.ghc 24 Nov 2008 07:30:44 -0000 @@ -40,7 +40,6 @@ %{nil}
%ghc_preinst_script \ -[ "$1" = 2 ] && %{pkg_libdir}/unregister.sh >&/dev/null || : \ %{nil}
%ghc_postinst_script \ @@ -48,11 +47,10 @@ %{nil}
%ghc_preun_script \ -%{pkg_libdir}/unregister.sh >&/dev/null \ +[ "$1" = 0 ] && %{pkg_libdir}/unregister.sh >&/dev/null \ %{nil}
%ghc_postun_script \ -[ "$1" = 1 ] && %{pkg_libdir}/register.sh >& /dev/null || : \ %{nil}
%ghc_reindex_haddock \
Summarizing: %ghc_preinst_script and %ghc_postun_script should not been needed since ghc_postinst_script runs "ghc-pkg update". And %ghc_reindex_haddock only needs to be run in %post not %postun.
Jens
ps We probably also need to think a bit of how to handle indexing with different haddock versions: gtk2hs.darcs requires haddock-2.4 to build docs, so we can't index with it unless we rebuild ghc with haddock-2.4 - we could just skip %ghc_reindex_haddock for gtk2hs for now though, but probably need to ressurrect haddock in rawhide for gtk2hs docs.
Jens Petersen wrote:
Summarizing: %ghc_preinst_script and %ghc_postun_script should not been needed since ghc_postinst_script runs "ghc-pkg update".
This change seems reasonable to me. If you want to test the corner-case that the old preinst/postun logic was added to handle, try the following:
1. Install a Haskell-flavored RPM that uses the new install scripts.
2. In the spec file for that RPM, bump the Release (but leave everything else the same) and rebuild the RPM.
3. Update (rpm -Uhv) to the new release of the RPM.
4. Check to see that the package is properly registered w/ GHC.
More background on the original problem: http://www.redhat.com/archives/fedora-haskell-list/2008-August/msg00009.html
Cheers, Tom
haskell-devel@lists.fedoraproject.org