Gentoo Archives: gentoo-commits

From: "Lennart Kolmodin (kolmodin)" <kolmodin@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: ghc-package.eclass
Date: Mon, 23 Mar 2009 20:06:22
Message-Id: E1LlqPb-0003h0-KI@stork.gentoo.org
1 kolmodin 09/03/23 20:06:19
2
3 Modified: ghc-package.eclass
4 Log:
5 Update ghc-package eclass to make it work with >=dev-lang/ghc-6.10, and
6 ghc-reregistering to work with paludis.
7
8 Revision Changes Path
9 1.27 eclass/ghc-package.eclass
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/ghc-package.eclass?rev=1.27&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/ghc-package.eclass?rev=1.27&content-type=text/plain
13 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/ghc-package.eclass?r1=1.26&r2=1.27
14
15 Index: ghc-package.eclass
16 ===================================================================
17 RCS file: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v
18 retrieving revision 1.26
19 retrieving revision 1.27
20 diff -u -r1.26 -r1.27
21 --- ghc-package.eclass 6 Jan 2008 19:30:24 -0000 1.26
22 +++ ghc-package.eclass 23 Mar 2009 20:06:19 -0000 1.27
23 @@ -1,6 +1,6 @@
24 # Copyright 1999-2004 Gentoo Foundation
25 # Distributed under the terms of the GNU General Public License v2
26 -# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.26 2008/01/06 19:30:24 swegener Exp $
27 +# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.27 2009/03/23 20:06:19 kolmodin Exp $
28 #
29 # Author: Andres Loeh <kosmikus@g.o>
30 # Maintained by: Haskell herd <haskell@g.o>
31 @@ -31,7 +31,12 @@
32 # because for some reason the global package file
33 # must be specified
34 ghc-getghcpkgbin() {
35 - if ghc-cabal; then
36 + if version_is_at_least "6.10" "$(ghc-version)"; then
37 + # the ghc-pkg executable changed name in ghc 6.10, as it no longer needs
38 + # the wrapper script with the static flags
39 + echo '[]' > "${T}/empty.conf"
40 + echo "$(ghc-libdir)/ghc-pkg" "--global-conf=${T}/empty.conf"
41 + elif ghc-cabal; then
42 echo '[]' > "${T}/empty.conf"
43 echo "$(ghc-libdir)/ghc-pkg.bin" "--global-conf=${T}/empty.conf"
44 else
45 @@ -142,7 +147,14 @@
46
47 # tests if a ghc package exists
48 ghc-package-exists() {
49 - $(ghc-getghcpkg) -s "$1" > /dev/null 2>&1
50 + local describe_flag
51 + if version_is_at_least "6.4" "$(ghc-version)"; then
52 + describe_flag="describe"
53 + else
54 + describe_flag="--show-package"
55 + fi
56 +
57 + $(ghc-getghcpkg) "${describe_flag}" "$1" > /dev/null 2>&1
58 }
59
60 # creates a local (package-specific) package
61 @@ -155,8 +167,14 @@
62 local localpkgconf
63 localpkgconf="${S}/$(ghc-localpkgconf)"
64 echo '[]' > "${localpkgconf}"
65 + local update_flag
66 + if version_is_at_least "6.4" "$(ghc-version)"; then
67 + update_flag="update -"
68 + else
69 + update_flag="--update-package"
70 + fi
71 for pkg in $*; do
72 - $(ghc-getghcpkgbin) -f "${localpkgconf}" -u --force \
73 + $(ghc-getghcpkgbin) -f "${localpkgconf}" ${update_flag} --force \
74 < "${pkg}" || die "failed to register ${pkg}"
75 done
76 }
77 @@ -183,11 +201,20 @@
78 ghc-register-pkg() {
79 local localpkgconf
80 localpkgconf="$(ghc-confdir)/$1"
81 + local update_flag
82 + local describe_flag
83 + if version_is_at_least "6.4" "$(ghc-version)"; then
84 + update_flag="update -"
85 + describe_flag="describe"
86 + else
87 + update_flag="--update-package"
88 + describe_flag="--show-package"
89 + fi
90 if [[ -f "${localpkgconf}" ]]; then
91 for pkg in $(ghc-listpkg "${localpkgconf}"); do
92 ebegin "Registering ${pkg} "
93 - $(ghc-getghcpkgbin) -f "${localpkgconf}" -s "${pkg}" \
94 - | $(ghc-getghcpkg) -u --force > /dev/null
95 + $(ghc-getghcpkgbin) -f "${localpkgconf}" "${describe_flag}" "${pkg}" \
96 + | $(ghc-getghcpkg) ${update_flag} --force > /dev/null
97 eend $?
98 done
99 fi
100 @@ -197,11 +224,11 @@
101 # package conf file, to be used on a ghc reinstallation
102 ghc-reregister() {
103 einfo "Re-adding packages (may cause several harmless warnings) ..."
104 - if [ -d "$(ghc-confdir)" ]; then
105 - pushd "$(ghc-confdir)" > /dev/null
106 + PATH="/usr/bin:${PATH}" CONFDIR="$(ghc-confdir)"
107 + if [ -d "${CONFDIR}" ]; then
108 + pushd "${CONFDIR}" > /dev/null
109 for conf in *.conf; do
110 -# einfo "Processing ${conf} ..."
111 - ghc-register-pkg "${conf}"
112 + PATH="/usr/bin:${PATH}" ghc-register-pkg "${conf}"
113 done
114 popd > /dev/null
115 fi
116 @@ -215,8 +242,15 @@
117 local i
118 local pkg
119 local protected
120 + local unregister_flag
121 localpkgconf="$(ghc-confdir)/$1"
122
123 + if version_is_at_least "6.4" "$(ghc-version)"; then
124 + unregister_flag="unregister"
125 + else
126 + unregister_flag="--remove-package"
127 + fi
128 +
129 for i in $(ghc-confdir)/*.conf; do
130 [[ "${i}" != "${localpkgconf}" ]] && protected="${protected} $(ghc-listpkg ${i})"
131 done
132 @@ -231,7 +265,7 @@
133 # einfo "Package ${pkg} is not installed for ghc-$(ghc-version)."
134 else
135 ebegin "Unregistering ${pkg} "
136 - $(ghc-getghcpkg) -r "${pkg}" --force > /dev/null
137 + $(ghc-getghcpkg) "${unregister_flag}" "${pkg}" --force > /dev/null
138 eend $?
139 fi
140 done