Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15299 - in main/branches/prefix/pym/portage: . dbapi
Date: Sun, 31 Jan 2010 09:40:06
Message-Id: E1NbWHk-0002sh-A3@stork.gentoo.org
1 Author: grobian
2 Date: 2010-01-31 09:40:03 +0000 (Sun, 31 Jan 2010)
3 New Revision: 15299
4
5 Modified:
6 main/branches/prefix/pym/portage/data.py
7 main/branches/prefix/pym/portage/dbapi/vartree.py
8 Log:
9 Merged from trunk -r15272:15280
10
11 | 15277 | Define userpriv_groups earlier in order to avoid an |
12 | zmedico | AttributeError from lazy import code. Thanks to antarus for |
13 | | reporting. |
14
15 | 15278 | Bug #277902 - When excluding config files, instead of using |
16 | zmedico | an empty file as a placeholder, use a file containing a |
17 | | comment like this: # empty file because --include-config=n |
18 | | when `quickpkg` was used |
19
20 | 15279 | Fix conditional logic for userpriv_groups intialization. |
21 | zmedico | |
22
23 | 15280 | Fix code from r15278 for python3 unicode compatibility. |
24 | zmedico | |
25
26
27 Modified: main/branches/prefix/pym/portage/data.py
28 ===================================================================
29 --- main/branches/prefix/pym/portage/data.py 2010-01-31 09:36:30 UTC (rev 15298)
30 +++ main/branches/prefix/pym/portage/data.py 2010-01-31 09:40:03 UTC (rev 15299)
31 @@ -88,8 +88,7 @@
32 except KeyError:
33 portage_uid=0
34 portage_gid=0
35 - writemsg("\n")
36 - # warning: not localised
37 + userpriv_groups = [portage_gid]
38 writemsg(colorize("BAD",
39 "portage: "+portageuser+" user or "+portagegroup+" group missing.") + "\n", noiselevel=-1)
40 writemsg(colorize("BAD",
41 @@ -109,22 +108,23 @@
42 # writemsg(colorize("GOOD", " portage::250:portage") + "\n",
43 # noiselevel=-1)
44 portage_group_warning()
45 -
46 -userpriv_groups = [portage_gid]
47 -if secpass >= 2:
48 - # Get a list of group IDs for the portage user. Do not use grp.getgrall()
49 - # since it is known to trigger spurious SIGPIPE problems with nss_ldap.
50 - try:
51 - from subprocess import getstatusoutput
52 - except ImportError:
53 - from commands import getstatusoutput
54 - mystatus, myoutput = getstatusoutput("id -G " + portageuser)
55 - if mystatus == os.EX_OK:
56 - for x in myoutput.split():
57 - try:
58 - userpriv_groups.append(int(x))
59 - except ValueError:
60 - pass
61 - del x
62 - userpriv_groups = list(set(userpriv_groups))
63 - del getstatusoutput, mystatus, myoutput
64 +else:
65 + userpriv_groups = [portage_gid]
66 + if secpass >= 2:
67 + # Get a list of group IDs for the portage user. Do not use
68 + # grp.getgrall() since it is known to trigger spurious
69 + # SIGPIPE problems with nss_ldap.
70 + try:
71 + from subprocess import getstatusoutput
72 + except ImportError:
73 + from commands import getstatusoutput
74 + mystatus, myoutput = getstatusoutput("id -G " + portageuser)
75 + if mystatus == os.EX_OK:
76 + for x in myoutput.split():
77 + try:
78 + userpriv_groups.append(int(x))
79 + except ValueError:
80 + pass
81 + del x
82 + userpriv_groups = list(set(userpriv_groups))
83 + del getstatusoutput, mystatus, myoutput
84
85 Modified: main/branches/prefix/pym/portage/dbapi/vartree.py
86 ===================================================================
87 --- main/branches/prefix/pym/portage/dbapi/vartree.py 2010-01-31 09:36:30 UTC (rev 15298)
88 +++ main/branches/prefix/pym/portage/dbapi/vartree.py 2010-01-31 09:40:03 UTC (rev 15299)
89 @@ -54,6 +54,7 @@
90 import os as _os
91 import stat
92 import sys
93 +import tempfile
94 import time
95 import warnings
96
97 @@ -5593,8 +5594,15 @@
98 if protect and protect(path):
99 # Create an empty file as a place holder in order to avoid
100 # potential collision-protect issues.
101 - tarinfo.size = 0
102 - tar.addfile(tarinfo)
103 + f = tempfile.TemporaryFile()
104 + f.write(_unicode_encode(
105 + "# empty file because --include-config=n " + \
106 + "when `quickpkg` was used\n"))
107 + f.flush()
108 + f.seek(0)
109 + tarinfo.size = os.fstat(f.fileno()).st_size
110 + tar.addfile(tarinfo, f)
111 + f.close()
112 else:
113 f = open(_unicode_encode(path,
114 encoding=object.__getattribute__(os, '_encoding'),