Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r10846 - main/trunk/pym/portage
Date: Sun, 29 Jun 2008 08:23:23
Message-Id: E1KCsBq-0004Vf-9g@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-06-29 08:23:17 +0000 (Sun, 29 Jun 2008)
3 New Revision: 10846
4
5 Modified:
6 main/trunk/pym/portage/__init__.py
7 Log:
8 Split out a _post_src_install_uid_fix() function from spawnebuild().
9
10
11 Modified: main/trunk/pym/portage/__init__.py
12 ===================================================================
13 --- main/trunk/pym/portage/__init__.py 2008-06-29 08:09:58 UTC (rev 10845)
14 +++ main/trunk/pym/portage/__init__.py 2008-06-29 08:23:17 UTC (rev 10846)
15 @@ -4267,28 +4267,7 @@
16 _eqawarn(msg)
17
18 if mydo == "install":
19 - # User and group bits that match the "portage" user or group are
20 - # automatically mapped to PORTAGE_INST_UID and PORTAGE_INST_GID if
21 - # necessary. The chown system call may clear S_ISUID and S_ISGID
22 - # bits, so those bits are restored if necessary.
23 - inst_uid = int(mysettings["PORTAGE_INST_UID"])
24 - inst_gid = int(mysettings["PORTAGE_INST_GID"])
25 - for parent, dirs, files in os.walk(mysettings["D"]):
26 - for fname in chain(dirs, files):
27 - fpath = os.path.join(parent, fname)
28 - mystat = os.lstat(fpath)
29 - if mystat.st_uid != portage_uid and \
30 - mystat.st_gid != portage_gid:
31 - continue
32 - myuid = -1
33 - mygid = -1
34 - if mystat.st_uid == portage_uid:
35 - myuid = inst_uid
36 - if mystat.st_gid == portage_gid:
37 - mygid = inst_gid
38 - apply_secpass_permissions(fpath, uid=myuid, gid=mygid,
39 - mode=mystat.st_mode, stat_cached=mystat,
40 - follow_links=False)
41 + _post_src_install_uid_fix(mysettings)
42 qa_retval = _spawn_misc_sh(mysettings, ["install_qa_check",
43 "install_symlink_html_docs"], **kwargs)
44 if qa_retval != os.EX_OK:
45 @@ -4297,6 +4276,33 @@
46 return qa_retval
47 return phase_retval
48
49 +def _post_src_install_uid_fix(mysettings):
50 + """
51 + Files in $D with user and group bits that match the "portage"
52 + user or group are automatically mapped to PORTAGE_INST_UID and
53 + PORTAGE_INST_GID if necessary. The chown system call may clear
54 + S_ISUID and S_ISGID bits, so those bits are restored if
55 + necessary.
56 + """
57 + inst_uid = int(mysettings["PORTAGE_INST_UID"])
58 + inst_gid = int(mysettings["PORTAGE_INST_GID"])
59 + for parent, dirs, files in os.walk(mysettings["D"]):
60 + for fname in chain(dirs, files):
61 + fpath = os.path.join(parent, fname)
62 + mystat = os.lstat(fpath)
63 + if mystat.st_uid != portage_uid and \
64 + mystat.st_gid != portage_gid:
65 + continue
66 + myuid = -1
67 + mygid = -1
68 + if mystat.st_uid == portage_uid:
69 + myuid = inst_uid
70 + if mystat.st_gid == portage_gid:
71 + mygid = inst_gid
72 + apply_secpass_permissions(fpath, uid=myuid, gid=mygid,
73 + mode=mystat.st_mode, stat_cached=mystat,
74 + follow_links=False)
75 +
76 def _spawn_misc_sh(mysettings, commands, **kwargs):
77 """
78 @param mysettings: the ebuild config
79
80 --
81 gentoo-commits@l.g.o mailing list