Gentoo Archives: gentoo-commits

From: "Markus Duft (mduft)" <mduft@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: vim-plugin.eclass
Date: Fri, 29 Oct 2010 07:01:19
Message-Id: 20101029070108.218E020051@flycatcher.gentoo.org
1 mduft 10/10/29 07:01:08
2
3 Modified: vim-plugin.eclass
4 Log:
5 merge changes from prefix-tree, thanks radhermit for the review.
6
7 Revision Changes Path
8 1.25 eclass/vim-plugin.eclass
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/vim-plugin.eclass?rev=1.25&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/vim-plugin.eclass?rev=1.25&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/vim-plugin.eclass?r1=1.24&r2=1.25
13
14 Index: vim-plugin.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/vim-plugin.eclass,v
17 retrieving revision 1.24
18 retrieving revision 1.25
19 diff -u -r1.24 -r1.25
20 --- vim-plugin.eclass 29 Oct 2010 06:44:06 -0000 1.24
21 +++ vim-plugin.eclass 29 Oct 2010 07:01:08 -0000 1.25
22 @@ -1,6 +1,6 @@
23 # Copyright 1999-2004 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/vim-plugin.eclass,v 1.24 2010/10/29 06:44:06 mduft Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/vim-plugin.eclass,v 1.25 2010/10/29 07:01:08 mduft Exp $
27 #
28 # This eclass simplifies installation of app-vim plugins into
29 # /usr/share/vim/vimfiles. This is a version-independent directory
30 @@ -20,36 +20,22 @@
31 SLOT="0"
32
33 vim-plugin_src_install() {
34 - has "${EAPI:-0}" 0 1 2 && use !prefix && ED="${D}"
35 -
36 + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
37 local f
38 - local _portage_user='portage'
39 - local _portage_group='portage'
40 - local _root=root
41 - local _group=wheel
42 -
43 - # no wheel group here.
44 - if use userland_BSD || use userland_Darwin; then
45 - _group=root
46 - fi
47
48 - # in prefix, we don't want to give away rights to root
49 - if use prefix; then
50 - _portage_user=${PORTAGE_USER}
51 - _portage_group=${PORTAGE_GROUP}
52 - _root=${PORTAGE_ROOT_USER}
53 - _group=${_portage_group}
54 + if use !prefix || [[ ${EUID} -eq 0 ]] ; then
55 + ebegin "Fixing file permissions"
56 + # Make sure perms are good
57 + chmod -R a+rX "${S}" || die "chmod failed"
58 + find "${S}" -user 'portage' -exec chown root '{}' \; || die "chown failed"
59 + if use userland_BSD || [[ ${CHOST} == *-darwin* ]] ; then
60 + find "${S}" -group 'portage' -exec chgrp wheel '{}' \; || die "chgrp failed"
61 + else
62 + find "${S}" -group 'portage' -exec chgrp root '{}' \; || die "chgrp failed"
63 + fi
64 + eend $?
65 fi
66
67 - ebegin "Fixing file permissions"
68 - # Make sure perms are good
69 - chmod -R a+rX "${S}" || die "chmod failed"
70 - [[ ${_portage} != ${_root} ]] && \
71 - find "${S}" -user ${_portage_user} -exec chown ${_root} '{}' \; || die "chown failed"
72 - [[ ${_portage} != ${_group} ]] && \
73 - find "${S}" -group ${_portage_group} -exec chgrp ${_group} '{}' \; || die "chgrp failed"
74 - eend $?
75 -
76 # Install non-vim-help-docs
77 cd "${S}"
78 for f in *; do
79 @@ -78,25 +64,27 @@
80 }
81
82 vim-plugin_pkg_postrm() {
83 + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
84 update_vim_helptags # from vim-doc
85 update_vim_afterscripts # see below
86
87 # Remove empty dirs; this allows
88 # /usr/share/vim to be removed if vim-core is unmerged
89 - find /usr/share/vim/vimfiles -depth -type d -exec rmdir {} \; 2>/dev/null
90 + find "${EPREFIX}/usr/share/vim/vimfiles" -depth -type d -exec rmdir {} \; 2>/dev/null
91 }
92
93 # update_vim_afterscripts: create scripts in
94 # /usr/share/vim/vimfiles/after/* comprised of the snippets in
95 # /usr/share/vim/vimfiles/after/*/*.d
96 update_vim_afterscripts() {
97 - has "${EAPI:-0}" 0 1 2 && use !prefix && EROOT="${ROOT}"
98 + has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
99 + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
100 local d f afterdir="${EROOT}"/usr/share/vim/vimfiles/after
101
102 # Nothing to do if the dir isn't there
103 [ -d "${afterdir}" ] || return 0
104
105 - einfo "Updating scripts in /usr/share/vim/vimfiles/after"
106 + einfo "Updating scripts in ${EPREFIX}/usr/share/vim/vimfiles/after"
107 find "${afterdir}" -type d -name \*.vim.d | \
108 while read d; do
109 echo '" Generated by update_vim_afterscripts' > "${d%.d}"
110 @@ -104,7 +92,7 @@
111 sort -z | xargs -0 cat >> "${d%.d}"
112 done
113
114 - einfo "Removing dead scripts in /usr/share/vim/vimfiles/after"
115 + einfo "Removing dead scripts in ${EPREFIX}/usr/share/vim/vimfiles/after"
116 find "${afterdir}" -type f -name \*.vim | \
117 while read f; do
118 [[ "$(head -n 1 ${f})" == '" Generated by update_vim_afterscripts' ]] \