diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2012-04-09 18:08:45 +0000 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2012-04-09 18:08:45 +0000 |
commit | a55674b05b23d27b8214f5d59eba1d0af2c94c04 (patch) | |
tree | 11e5159fa016a74d01f03ac732e1b5765ebd12dc /eclass/ghc-package.eclass | |
parent | Add ~mips and ~ppc-macos; arch teams were taking too long. (diff) | |
download | gentoo-2-a55674b05b23d27b8214f5d59eba1d0af2c94c04.tar.gz gentoo-2-a55674b05b23d27b8214f5d59eba1d0af2c94c04.tar.bz2 gentoo-2-a55674b05b23d27b8214f5d59eba1d0af2c94c04.zip |
Remove outdated bits for <ghc-6.10 and <cabal-1.8. Switch from 'eerror' to 'eqawarn' as suggested by Paweł Hajdan, Jr. (http://www.gossamer-threads.com/lists/gentoo/dev/251259). Install empty '.conf' files for binaries to help 'haskell-updater' pick binaries built with onder haskell toolchain on ghc upgrade.
Diffstat (limited to 'eclass/ghc-package.eclass')
-rw-r--r-- | eclass/ghc-package.eclass | 148 |
1 files changed, 26 insertions, 122 deletions
diff --git a/eclass/ghc-package.eclass b/eclass/ghc-package.eclass index 593c9c58b04d..a100e04f90f1 100644 --- a/eclass/ghc-package.eclass +++ b/eclass/ghc-package.eclass @@ -1,6 +1,6 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.32 2011/11/24 00:04:13 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.33 2012/04/09 18:08:45 slyfox Exp $ # @ECLASS: ghc-package.eclass # @MAINTAINER: @@ -36,17 +36,10 @@ ghc-getghcpkg() { # because for some reason the global package file # must be specified ghc-getghcpkgbin() { - if version_is_at_least "6.10" "$(ghc-version)"; then - # the ghc-pkg executable changed name in ghc 6.10, as it no longer needs - # the wrapper script with the static flags - echo '[]' > "${T}/empty.conf" - echo "$(ghc-libdir)/ghc-pkg" "--global-conf=${T}/empty.conf" - elif ghc-cabal; then - echo '[]' > "${T}/empty.conf" - echo "$(ghc-libdir)/ghc-pkg.bin" "--global-conf=${T}/empty.conf" - else - echo "$(ghc-libdir)/ghc-pkg.bin" - fi + # the ghc-pkg executable changed name in ghc 6.10, as it no longer needs + # the wrapper script with the static flags + echo '[]' > "${T}/empty.conf" + echo "$(ghc-libdir)/ghc-pkg" "--global-conf=${T}/empty.conf" } # @FUNCTION: ghc-version @@ -60,30 +53,14 @@ ghc-version() { echo "${_GHC_VERSION_CACHE}" } -# @FUNCTION: ghc-cabal -# @DESCRIPTION: -# this function can be used to determine if ghc itself -# uses the Cabal package format; it has nothing to do -# with the Cabal libraries ... ghc uses the Cabal package -# format since version 6.4 -ghc-cabal() { - version_is_at_least "6.4" "$(ghc-version)" -} - # @FUNCTION: ghc-bestcabalversion # @DESCRIPTION: # return the best version of the Cabal library that is available ghc-bestcabalversion() { - local cabalversion - if ghc-cabal; then - # We ask portage, not ghc, so that we only pick up - # portage-installed cabal versions. - cabalversion="$(ghc-extractportageversion dev-haskell/cabal)" - echo "Cabal-${cabalversion}" - else - # older ghc's don't support package versioning - echo Cabal - fi + # We ask portage, not ghc, so that we only pick up + # portage-installed cabal versions. + local cabalversion="$(ghc-extractportageversion dev-haskell/cabal)" + echo "Cabal-${cabalversion}" } # @FUNCTION: ghc-sanecabal @@ -101,27 +78,6 @@ ghc-sanecabal() { return 1 } -# @FUNCTION: ghc-saneghc -# @DESCRIPTION: -# checks if ghc and ghc-bin are installed in the same version -# (if they're both installed); if this is not the case, we -# unfortunately cannot trust portage's dependency resolution -ghc-saneghc() { - local ghcversion - local ghcbinversion - if [[ "${PN}" == "ghc" || "${PN}" == "ghc-bin" ]]; then - return - fi - if has_version dev-lang/ghc && has_version dev-lang/ghc-bin; then - ghcversion="$(ghc-extractportageversion dev-lang/ghc)" - ghcbinversion="$(ghc-extractportageversion dev-lang/ghc-bin)" - if [[ "${ghcversion}" != "${ghcbinversion}" ]]; then - return 1 - fi - fi - return -} - # @FUNCTION: ghc-supports-shared-libraries # @DESCRIPTION: # checks if ghc is built with support for building @@ -182,14 +138,7 @@ ghc-makeghcilib() { # @DESCRIPTION: # tests if a ghc package exists ghc-package-exists() { - local describe_flag - if version_is_at_least "6.4" "$(ghc-version)"; then - describe_flag="describe" - else - describe_flag="--show-package" - fi - - $(ghc-getghcpkg) "${describe_flag}" "$1" > /dev/null 2>&1 + $(ghc-getghcpkg) describe "$1" > /dev/null 2>&1 } # @FUNCTION: ghc-setup-pkg @@ -201,17 +150,11 @@ ghc-package-exists() { # no arguments are given, the resulting file is # empty ghc-setup-pkg() { - local localpkgconf - localpkgconf="${S}/$(ghc-localpkgconf)" + local localpkgconf="${S}/$(ghc-localpkgconf)" echo '[]' > "${localpkgconf}" - local update_flag - if version_is_at_least "6.4" "$(ghc-version)"; then - update_flag="update -" - else - update_flag="--update-package" - fi + for pkg in $*; do - $(ghc-getghcpkgbin) -f "${localpkgconf}" ${update_flag} --force \ + $(ghc-getghcpkgbin) -f "${localpkgconf}" update - --force \ < "${pkg}" || die "failed to register ${pkg}" done } @@ -242,22 +185,13 @@ ghc-install-pkg() { # registers all packages in the local (package-specific) # package configuration file ghc-register-pkg() { - local localpkgconf - localpkgconf="$(ghc-confdir)/$1" - local update_flag - local describe_flag - if version_is_at_least "6.4" "$(ghc-version)"; then - update_flag="update -" - describe_flag="describe" - else - update_flag="--update-package" - describe_flag="--show-package" - fi + local localpkgconf="$(ghc-confdir)/$1" + if [[ -f "${localpkgconf}" ]]; then for pkg in $(ghc-listpkg "${localpkgconf}"); do ebegin "Registering ${pkg} " - $(ghc-getghcpkgbin) -f "${localpkgconf}" "${describe_flag}" "${pkg}" \ - | $(ghc-getghcpkg) ${update_flag} --force > /dev/null + $(ghc-getghcpkgbin) -f "${localpkgconf}" describe "${pkg}" \ + | $(ghc-getghcpkg) update - --force > /dev/null eend $? done fi @@ -286,17 +220,9 @@ ghc-reregister() { # protected are all packages that are still contained in # another package configuration file ghc-unregister-pkg() { - local localpkgconf + local localpkgconf="$(ghc-confdir)/$1" local i local pkg - local unregister_flag - localpkgconf="$(ghc-confdir)/$1" - - if version_is_at_least "6.4" "$(ghc-version)"; then - unregister_flag="unregister" - else - unregister_flag="--remove-package" - fi if [[ -f "${localpkgconf}" ]]; then for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do @@ -304,7 +230,7 @@ ghc-unregister-pkg() { einfo "Package ${pkg} is not installed for ghc-$(ghc-version)." else ebegin "Unregistering ${pkg} " - $(ghc-getghcpkg) "${unregister_flag}" "${pkg}" --force > /dev/null + $(ghc-getghcpkg) unregister "${pkg}" --force > /dev/null eend $? fi done @@ -345,36 +271,14 @@ ghc-listpkg() { extra_flags="${extra_flags} -v0" fi for i in $*; do - if ghc-cabal; then - echo $($(ghc-getghcpkg) list ${extra_flags} -f "${i}") \ - | sed \ - -e "s|^.*${i}:\([^:]*\).*$|\1|" \ - -e "s|/.*$||" \ - -e "s|,| |g" -e "s|[(){}]||g" - else - echo $($(ghc-getghcpkgbin) -l -f "${i}") \ - | cut -f2 -d':' \ - | sed 's:,: :g' - fi + echo $($(ghc-getghcpkg) list ${extra_flags} -f "${i}") \ + | sed \ + -e "s|^.*${i}:\([^:]*\).*$|\1|" \ + -e "s|/.*$||" \ + -e "s|,| |g" -e "s|[(){}]||g" done } -# @FUNCTION: ghc-package_pkg_setup -# @DESCRIPTION: -# exported function: check if we have a consistent ghc installation -ghc-package_pkg_setup() { - if ! ghc-saneghc; then - eerror "You have inconsistent versions of dev-lang/ghc and dev-lang/ghc-bin" - eerror "installed. Portage currently cannot work correctly with this setup." - eerror "There are several possibilities to work around this problem:" - eerror "(1) Up/downgrade ghc-bin to the same version as ghc." - eerror "(2) Unmerge ghc-bin." - eerror "(3) Unmerge ghc." - eerror "You probably want option 1 or 2." - die "Inconsistent versions of ghc and ghc-bin." - fi -} - # @FUNCTION: ghc-package_pkg_postinst # @DESCRIPTION: # exported function: registers the package-specific package @@ -393,4 +297,4 @@ ghc-package_pkg_prerm() { ghc-unregister-pkg "$(ghc-localpkgconf)" } -EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm +EXPORT_FUNCTIONS pkg_postinst pkg_prerm |