1 |
slyfox 11/05/08 15:00:43 |
2 |
|
3 |
Modified: ghc-package.eclass |
4 |
Log: |
5 |
speed up package deregistration, add 'ghc-supports-shared-libraries' helper |
6 |
|
7 |
- 'pkg_prerm' could take up to minute in a loop of checking protected packages. |
8 |
We don't need to protect anything on modern ghc (6.12+) |
9 |
|
10 |
- ghc-supports-shared-libraries returns success if installed ghc is able to |
11 |
build shared objects |
12 |
|
13 |
Revision Changes Path |
14 |
1.30 eclass/ghc-package.eclass |
15 |
|
16 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ghc-package.eclass?rev=1.30&view=markup |
17 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ghc-package.eclass?rev=1.30&content-type=text/plain |
18 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ghc-package.eclass?r1=1.29&r2=1.30 |
19 |
|
20 |
Index: ghc-package.eclass |
21 |
=================================================================== |
22 |
RCS file: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v |
23 |
retrieving revision 1.29 |
24 |
retrieving revision 1.30 |
25 |
diff -u -r1.29 -r1.30 |
26 |
--- ghc-package.eclass 13 Mar 2011 20:12:13 -0000 1.29 |
27 |
+++ ghc-package.eclass 8 May 2011 15:00:43 -0000 1.30 |
28 |
@@ -1,6 +1,6 @@ |
29 |
# Copyright 1999-2011 Gentoo Foundation |
30 |
# Distributed under the terms of the GNU General Public License v2 |
31 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.29 2011/03/13 20:12:13 slyfox Exp $ |
32 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.30 2011/05/08 15:00:43 slyfox Exp $ |
33 |
# |
34 |
# @ECLASS: ghc-package.eclass |
35 |
# @MAINTAINER: |
36 |
@@ -123,6 +123,14 @@ |
37 |
return |
38 |
} |
39 |
|
40 |
+# @FUNCTION: ghc-supports-shared-libraries |
41 |
+# @DESCRIPTION: |
42 |
+# checks if ghc is built with support for building |
43 |
+# shared libraries (aka '-dynamic' option) |
44 |
+ghc-supports-shared-libraries() { |
45 |
+ $(ghc-getghc) --info | grep "RTS ways" | grep -q "dyn" |
46 |
+} |
47 |
+ |
48 |
# @FUNCTION: ghc-extractportageversion |
49 |
# @DESCRIPTION: |
50 |
# extract the version of a portage-installed package |
51 |
@@ -282,7 +290,6 @@ |
52 |
local localpkgconf |
53 |
local i |
54 |
local pkg |
55 |
- local protected |
56 |
local unregister_flag |
57 |
localpkgconf="$(ghc-confdir)/$1" |
58 |
|
59 |
@@ -292,23 +299,15 @@ |
60 |
unregister_flag="--remove-package" |
61 |
fi |
62 |
|
63 |
- for i in $(ghc-confdir)/*.conf; do |
64 |
- [[ "${i}" != "${localpkgconf}" ]] && protected="${protected} $(ghc-listpkg ${i})" |
65 |
- done |
66 |
- # protected now contains the packages that cannot be unregistered yet |
67 |
- |
68 |
if [[ -f "${localpkgconf}" ]]; then |
69 |
for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do |
70 |
- if $(ghc-elem "${pkg}" "${protected}"); then |
71 |
- einfo "Package ${pkg} is protected." |
72 |
- elif ! ghc-package-exists "${pkg}"; then |
73 |
- : |
74 |
- # einfo "Package ${pkg} is not installed for ghc-$(ghc-version)." |
75 |
- else |
76 |
- ebegin "Unregistering ${pkg} " |
77 |
- $(ghc-getghcpkg) "${unregister_flag}" "${pkg}" --force > /dev/null |
78 |
- eend $? |
79 |
- fi |
80 |
+ if ! ghc-package-exists "${pkg}"; then |
81 |
+ einfo "Package ${pkg} is not installed for ghc-$(ghc-version)." |
82 |
+ else |
83 |
+ ebegin "Unregistering ${pkg} " |
84 |
+ $(ghc-getghcpkg) "${unregister_flag}" "${pkg}" --force > /dev/null |
85 |
+ eend $? |
86 |
+ fi |
87 |
done |
88 |
fi |
89 |
} |