Gentoo Archives: gentoo-dev

From: Patrice Clement <monsieurp@g.o>
To: gentoo-dev@l.g.o
Cc: vim@g.o
Subject: Re: [gentoo-dev] [PATCH 2/3] vim-plugin.eclass: use Portage internal variables.
Date: Sun, 05 Nov 2017 13:53:51
Message-Id: 20171105135338.GC10892@patriceclement.me
In Reply to: Re: [gentoo-dev] [PATCH 2/3] vim-plugin.eclass: use Portage internal variables. by "Michał Górny"
1 Sunday 05 Nov 2017 00:26:33, Michał Górny wrote :
2 > W dniu sob, 04.11.2017 o godzinie 22∶48 +0100, użytkownik Patrice
3 > Clement napisał:
4 > > Closes: https://bugs.gentoo.org/469400
5 > > ---
6 > > eclass/vim-plugin.eclass | 6 +++---
7 > > 1 file changed, 3 insertions(+), 3 deletions(-)
8 > >
9 > > diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
10 > > index a05cdb4520b..3c809768cf8 100644
11 > > --- a/eclass/vim-plugin.eclass
12 > > +++ b/eclass/vim-plugin.eclass
13 > > @@ -39,11 +39,11 @@ vim-plugin_src_install() {
14 > > ebegin "Fixing file permissions"
15 > > # Make sure perms are good
16 > > chmod -R a+rX "${S}" || die "chmod failed"
17 > > - find "${S}" -user 'portage' -exec chown root '{}' \; || die "chown failed"
18 > > + find "${S}" -user "${PORTAGE_USERNAME}" -exec chown root '{}' \; || die "chown failed"
19 > > if use userland_BSD || [[ ${CHOST} == *-darwin* ]] ; then
20 > > - find "${S}" -group 'portage' -exec chgrp wheel '{}' \; || die "chgrp failed"
21 > > + find "${S}" -group "${PORTAGE_GRPNAME}" -exec chgrp wheel '{}' \; || die "chgrp failed"
22 > > else
23 > > - find "${S}" -group 'portage' -exec chgrp root '{}' \; || die "chgrp failed"
24 > > + find "${S}" -group "${PORTAGE_GRPNAME}" -exec chgrp root '{}' \; || die "chgrp failed"
25 > > fi
26 > > eend $?
27 > > fi
28 >
29 > This is going to die on every non-Portage package manager.
30 >
31 > --
32 > Best regards,
33 > Michał Górny
34 >
35 >
36
37 Michal, Ulrich,
38
39 ACK. This code has been there for ages and I also don't think it makes sense to
40 keep it as it seems these operations are handled by Portage already. Mike
41 (floppym) suggested to remove the whole if clause and call fperms instead:
42
43 diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
44 index abe9c7b3661..46908bb73e6 100644
45 --- a/eclass/vim-plugin.eclass
46 +++ b/eclass/vim-plugin.eclass
47 @@ -35,19 +35,6 @@ vim-plugin_src_install() {
48 has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
49 local f
50
51 - if use !prefix && [[ ${EUID} -eq 0 ]] ; then
52 - ebegin "Fixing file permissions"
53 - # Make sure perms are good
54 - chmod -R a+rX "${S}" || die "chmod failed"
55 - find "${S}" -user 'portage' -exec chown root '{}' \; || die "chown failed"
56 - if use userland_BSD || [[ ${CHOST} == *-darwin* ]] ; then
57 - find "${S}" -group 'portage' -exec chgrp wheel '{}' \; || die "chgrp failed"
58 - else
59 - find "${S}" -group 'portage' -exec chgrp root '{}' \; || die "chgrp failed"
60 - fi
61 - eend $?
62 - fi
63 -
64 # When globbing, if nothing exists, the shell literally returns the glob
65 # pattern. So turn on nullglob and extglob options to avoid this.
66 eshopts_push -s extglob
67 @@ -86,7 +73,7 @@ vim-plugin_src_install() {
68 "couldn't move ${S} to ${ED}/usr/share/vim/vimfiles"
69
70 # Fix remaining bad permissions
71 - chmod -R -x+X "${ED}"/usr/share/vim/vimfiles/ || die "chmod failed"
72 + fperms -R a+rX /usr/share/vim/vimfiles
73 }
74
75 Please let me know what you guys think.
76
77 --
78 Patrice Clement
79 Gentoo Linux developer
80 http://www.gentoo.org

Replies