1 |
mduft 10/10/29 06:44:06 |
2 |
|
3 |
Modified: vim-plugin.eclass |
4 |
Log: |
5 |
added prefix support. on prefix, use portage users/groups, not root/root/wheel |
6 |
|
7 |
Revision Changes Path |
8 |
1.24 eclass/vim-plugin.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/vim-plugin.eclass?rev=1.24&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/vim-plugin.eclass?rev=1.24&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/vim-plugin.eclass?r1=1.23&r2=1.24 |
13 |
|
14 |
Index: vim-plugin.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/vim-plugin.eclass,v |
17 |
retrieving revision 1.23 |
18 |
retrieving revision 1.24 |
19 |
diff -u -r1.23 -r1.24 |
20 |
--- vim-plugin.eclass 30 Aug 2008 07:59:18 -0000 1.23 |
21 |
+++ vim-plugin.eclass 29 Oct 2010 06:44:06 -0000 1.24 |
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.23 2008/08/30 07:59:18 hawking Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/vim-plugin.eclass,v 1.24 2010/10/29 06:44:06 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,17 +20,34 @@ |
31 |
SLOT="0" |
32 |
|
33 |
vim-plugin_src_install() { |
34 |
+ has "${EAPI:-0}" 0 1 2 && use !prefix && ED="${D}" |
35 |
+ |
36 |
local f |
37 |
+ local _portage_user='portage' |
38 |
+ local _portage_group='portage' |
39 |
+ local _root=root |
40 |
+ local _group=wheel |
41 |
+ |
42 |
+ # no wheel group here. |
43 |
+ if use userland_BSD || use userland_Darwin; then |
44 |
+ _group=root |
45 |
+ fi |
46 |
+ |
47 |
+ # in prefix, we don't want to give away rights to root |
48 |
+ if use prefix; then |
49 |
+ _portage_user=${PORTAGE_USER} |
50 |
+ _portage_group=${PORTAGE_GROUP} |
51 |
+ _root=${PORTAGE_ROOT_USER} |
52 |
+ _group=${_portage_group} |
53 |
+ fi |
54 |
|
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 || use userland_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 |
+ [[ ${_portage} != ${_root} ]] && \ |
65 |
+ find "${S}" -user ${_portage_user} -exec chown ${_root} '{}' \; || die "chown failed" |
66 |
+ [[ ${_portage} != ${_group} ]] && \ |
67 |
+ find "${S}" -group ${_portage_group} -exec chgrp ${_group} '{}' \; || die "chgrp failed" |
68 |
eend $? |
69 |
|
70 |
# Install non-vim-help-docs |
71 |
@@ -48,10 +65,10 @@ |
72 |
# Install remainder of plugin |
73 |
cd "${WORKDIR}" |
74 |
dodir /usr/share/vim |
75 |
- mv "${S}" "${D}"/usr/share/vim/vimfiles |
76 |
+ mv "${S}" "${ED}"/usr/share/vim/vimfiles |
77 |
|
78 |
# Fix remaining bad permissions |
79 |
- chmod -R -x+X "${D}"/usr/share/vim/vimfiles/ || die "chmod failed" |
80 |
+ chmod -R -x+X "${ED}"/usr/share/vim/vimfiles/ || die "chmod failed" |
81 |
} |
82 |
|
83 |
vim-plugin_pkg_postinst() { |
84 |
@@ -73,7 +90,8 @@ |
85 |
# /usr/share/vim/vimfiles/after/* comprised of the snippets in |
86 |
# /usr/share/vim/vimfiles/after/*/*.d |
87 |
update_vim_afterscripts() { |
88 |
- local d f afterdir="${ROOT}"/usr/share/vim/vimfiles/after |
89 |
+ has "${EAPI:-0}" 0 1 2 && use !prefix && EROOT="${ROOT}" |
90 |
+ local d f afterdir="${EROOT}"/usr/share/vim/vimfiles/after |
91 |
|
92 |
# Nothing to do if the dir isn't there |
93 |
[ -d "${afterdir}" ] || return 0 |