Gentoo Archives: gentoo-commits

From: Reinis Danne <rei4dan@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: eclass/
Date: Wed, 22 Jan 2014 10:09:42
Message-Id: 1390334714.89fc5b43baf07787a4ad7f66606c2f5c95a641e9.rei4dan@gentoo
1 commit: 89fc5b43baf07787a4ad7f66606c2f5c95a641e9
2 Author: Reinis Danne <rei4dan <AT> gmail <DOT> com>
3 AuthorDate: Tue Jan 21 16:29:57 2014 +0000
4 Commit: Reinis Danne <rei4dan <AT> gmail <DOT> com>
5 CommitDate: Tue Jan 21 20:05:14 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=89fc5b43
7
8 alternatives-2.eclass: Fix check for uninstalling
9
10 ---
11 eclass/alternatives-2.eclass | 14 +++++++++-----
12 1 file changed, 9 insertions(+), 5 deletions(-)
13
14 diff --git a/eclass/alternatives-2.eclass b/eclass/alternatives-2.eclass
15 index a6c2ef6..217ba4d 100644
16 --- a/eclass/alternatives-2.eclass
17 +++ b/eclass/alternatives-2.eclass
18 @@ -200,17 +200,21 @@ alternatives-2_pkg_postinst() {
19 #
20 # Provided alternatives are set up using alternatives_for().
21 alternatives-2_pkg_prerm() {
22 - local a alt provider ignore
23 + local a alt provider ignore ret
24 local EAUTO="${EROOT%/}/usr/share/eselect/modules/auto"
25 - [[ -n ${REPLACED_BY_ID} ]] || ignore=" --ignore"
26 + # If we are uninstalling, update alternatives to valid provider
27 + [[ -n ${REPLACED_BY_VERSION} ]] || ignore="--ignore"
28 for a in "${ALTERNATIVES_PROVIDED[@]}"; do
29 alt="${a%:*}"
30 provider="${a#*:}"
31 - eselect "${alt}" update${ignore} "${provider}" && continue
32 - einfo "Removing ${provider} alternative module for ${alt}, current is $(eselect ${alt} show)"
33 - case $? in
34 + eselect "${alt}" update ${ignore} "${provider}"
35 + ret=$?
36 + [[ -n ${REPLACED_BY_VERSION} ]] || \
37 + einfo "Removing ${provider} alternative module for ${alt}, current is $(eselect ${alt} show)"
38 + case ${ret} in
39 0) : ;;
40 2)
41 + # This was last provider for the alternative, remove eselect module
42 einfo "Cleaning up unused alternatives module for ${alt}"
43 rm "${EAUTO}/${alt}.eselect" || \
44 eerror "rm ${EAUTO}/${alt}.eselect failed"