diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2011-05-08 15:00:43 +0000 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2011-05-08 15:00:43 +0000 |
commit | 52694795945b6d48fd31e05193e498457f463794 (patch) | |
tree | 6ffae8215da35efdd116274dd7126052c2fddfcf /eclass/ghc-package.eclass | |
parent | Version bump to 1.12. (diff) | |
download | gentoo-2-52694795945b6d48fd31e05193e498457f463794.tar.gz gentoo-2-52694795945b6d48fd31e05193e498457f463794.tar.bz2 gentoo-2-52694795945b6d48fd31e05193e498457f463794.zip |
speed up package deregistration, add 'ghc-supports-shared-libraries' helper
- 'pkg_prerm' could take up to minute in a loop of checking protected packages.
We don't need to protect anything on modern ghc (6.12+)
- ghc-supports-shared-libraries returns success if installed ghc is able to
build shared objects
Diffstat (limited to 'eclass/ghc-package.eclass')
-rw-r--r-- | eclass/ghc-package.eclass | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/eclass/ghc-package.eclass b/eclass/ghc-package.eclass index 6702391e2142..98905d51fef1 100644 --- a/eclass/ghc-package.eclass +++ b/eclass/ghc-package.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.29 2011/03/13 20:12:13 slyfox Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.30 2011/05/08 15:00:43 slyfox Exp $ # # @ECLASS: ghc-package.eclass # @MAINTAINER: @@ -123,6 +123,14 @@ ghc-saneghc() { return } +# @FUNCTION: ghc-supports-shared-libraries +# @DESCRIPTION: +# checks if ghc is built with support for building +# shared libraries (aka '-dynamic' option) +ghc-supports-shared-libraries() { + $(ghc-getghc) --info | grep "RTS ways" | grep -q "dyn" +} + # @FUNCTION: ghc-extractportageversion # @DESCRIPTION: # extract the version of a portage-installed package @@ -282,7 +290,6 @@ ghc-unregister-pkg() { local localpkgconf local i local pkg - local protected local unregister_flag localpkgconf="$(ghc-confdir)/$1" @@ -292,23 +299,15 @@ ghc-unregister-pkg() { unregister_flag="--remove-package" fi - for i in $(ghc-confdir)/*.conf; do - [[ "${i}" != "${localpkgconf}" ]] && protected="${protected} $(ghc-listpkg ${i})" - done - # protected now contains the packages that cannot be unregistered yet - if [[ -f "${localpkgconf}" ]]; then for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do - if $(ghc-elem "${pkg}" "${protected}"); then - einfo "Package ${pkg} is protected." - elif ! ghc-package-exists "${pkg}"; then - : - # einfo "Package ${pkg} is not installed for ghc-$(ghc-version)." - else - ebegin "Unregistering ${pkg} " - $(ghc-getghcpkg) "${unregister_flag}" "${pkg}" --force > /dev/null - eend $? - fi + if ! ghc-package-exists "${pkg}"; then + einfo "Package ${pkg} is not installed for ghc-$(ghc-version)." + else + ebegin "Unregistering ${pkg} " + $(ghc-getghcpkg) "${unregister_flag}" "${pkg}" --force > /dev/null + eend $? + fi done fi } |