1 |
commit: 5bcd5b16d08ae263e9973196f144b72b8c7b7d0a |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jul 12 08:44:18 2011 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jul 12 08:44:18 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=5bcd5b16 |
7 |
|
8 |
Portage: support grabbing userpriv from config. |
9 |
|
10 |
--- |
11 |
gentoopm/basepm/config.py | 27 ++++++++++++++++++++++++++- |
12 |
gentoopm/portagepm/config.py | 14 ++++++++++++++ |
13 |
2 files changed, 40 insertions(+), 1 deletions(-) |
14 |
|
15 |
diff --git a/gentoopm/basepm/config.py b/gentoopm/basepm/config.py |
16 |
index 90dbb67..d011001 100644 |
17 |
--- a/gentoopm/basepm/config.py |
18 |
+++ b/gentoopm/basepm/config.py |
19 |
@@ -8,4 +8,29 @@ from abc import abstractproperty |
20 |
from gentoopm.util import ABCObject |
21 |
|
22 |
class PMConfig(ABCObject): |
23 |
- pass |
24 |
+ @abstractproperty |
25 |
+ def userpriv_enabled(self): |
26 |
+ """ |
27 |
+ Check whether root privileges are dropped for build-time. |
28 |
+ |
29 |
+ @type: bool |
30 |
+ """ |
31 |
+ pass |
32 |
+ |
33 |
+ @abstractproperty |
34 |
+ def userpriv_uid(self): |
35 |
+ """ |
36 |
+ The UID used for userpriv. |
37 |
+ |
38 |
+ @type: string/numeric |
39 |
+ """ |
40 |
+ pass |
41 |
+ |
42 |
+ @abstractproperty |
43 |
+ def userpriv_gid(self): |
44 |
+ """ |
45 |
+ The GID used for userpriv. |
46 |
+ |
47 |
+ @type: string/numeric |
48 |
+ """ |
49 |
+ pass |
50 |
|
51 |
diff --git a/gentoopm/portagepm/config.py b/gentoopm/portagepm/config.py |
52 |
index 5f80506..5bb697d 100644 |
53 |
--- a/gentoopm/portagepm/config.py |
54 |
+++ b/gentoopm/portagepm/config.py |
55 |
@@ -3,8 +3,22 @@ |
56 |
# (c) 2011 Michał Górny <mgorny@g.o> |
57 |
# Released under the terms of the 2-clause BSD license. |
58 |
|
59 |
+import portage.data |
60 |
+ |
61 |
from gentoopm.basepm.config import PMConfig |
62 |
|
63 |
class PortageConfig(PMConfig): |
64 |
def __init__(self, settings): |
65 |
self._settings = settings |
66 |
+ |
67 |
+ @property |
68 |
+ def userpriv_enabled(self): |
69 |
+ return 'userpriv' in self._settings.features |
70 |
+ |
71 |
+ @property |
72 |
+ def userpriv_uid(self): |
73 |
+ return portage.data.portage_uid |
74 |
+ |
75 |
+ @property |
76 |
+ def userpriv_gid(self): |
77 |
+ return portage.data.portage_gid |