Merged from trunk -r15272:15280
authorFabian Groffen <grobian@gentoo.org>
Sun, 31 Jan 2010 09:40:03 +0000 (09:40 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sun, 31 Jan 2010 09:40:03 +0000 (09:40 -0000)
   | 15277   | Define userpriv_groups earlier in order to avoid an          |
   | zmedico | AttributeError from lazy import code. Thanks to antarus for  |
   |         | reporting.                                                   |

   | 15278   | Bug #277902 - When excluding config files, instead of using  |
   | zmedico | an empty file as a placeholder, use a file containing a      |
   |         | comment like this: # empty file because --include-config=n   |
   |         | when `quickpkg` was used                                     |

   | 15279   | Fix conditional logic for userpriv_groups intialization.     |
   | zmedico |                                                              |

   | 15280   | Fix code from r15278 for python3 unicode compatibility.      |
   | zmedico |                                                              |

svn path=/main/branches/prefix/; revision=15299

pym/portage/data.py
pym/portage/dbapi/vartree.py

index a2d3ecf4cd0c83916c42ceb242516e83fd0f4429..f2e24140481fe94406b3d280f035f67a271e7489 100644 (file)
@@ -88,8 +88,7 @@ try:
 except KeyError:
        portage_uid=0
        portage_gid=0
-       writemsg("\n")
-       # warning: not localised
+       userpriv_groups = [portage_gid]
        writemsg(colorize("BAD",
                "portage: "+portageuser+" user or "+portagegroup+" group missing.") + "\n", noiselevel=-1)
        writemsg(colorize("BAD",
@@ -109,22 +108,23 @@ except KeyError:
 #      writemsg(colorize("GOOD", "         portage::250:portage") + "\n",
 #              noiselevel=-1)
        portage_group_warning()
-
-userpriv_groups = [portage_gid]
-if secpass >= 2:
-       # Get a list of group IDs for the portage user.  Do not use grp.getgrall()
-       # since it is known to trigger spurious SIGPIPE problems with nss_ldap.
-       try:
-               from subprocess import getstatusoutput
-       except ImportError:
-               from commands import getstatusoutput
-       mystatus, myoutput = getstatusoutput("id -G " + portageuser)
-       if mystatus == os.EX_OK:
-               for x in myoutput.split():
-                       try:
-                               userpriv_groups.append(int(x))
-                       except ValueError:
-                               pass
-                       del x
-               userpriv_groups = list(set(userpriv_groups))
-       del getstatusoutput, mystatus, myoutput
+else:
+       userpriv_groups = [portage_gid]
+       if secpass >= 2:
+               # Get a list of group IDs for the portage user. Do not use
+               # grp.getgrall() since it is known to trigger spurious
+               # SIGPIPE problems with nss_ldap.
+               try:
+                       from subprocess import getstatusoutput
+               except ImportError:
+                       from commands import getstatusoutput
+               mystatus, myoutput = getstatusoutput("id -G " + portageuser)
+               if mystatus == os.EX_OK:
+                       for x in myoutput.split():
+                               try:
+                                       userpriv_groups.append(int(x))
+                               except ValueError:
+                                       pass
+                               del x
+                       userpriv_groups = list(set(userpriv_groups))
+               del getstatusoutput, mystatus, myoutput
index 1b1bec156810e77e0ef6fe5c0dec4fd163b8c916..6d2c74ae1d22f0f75565b412fed585e10c4045a0 100644 (file)
@@ -54,6 +54,7 @@ import logging
 import os as _os
 import stat
 import sys
+import tempfile
 import time
 import warnings
 
@@ -5593,8 +5594,15 @@ def tar_contents(contents, root, tar, protect=None, onProgress=None):
                        if protect and protect(path):
                                # Create an empty file as a place holder in order to avoid
                                # potential collision-protect issues.
-                               tarinfo.size = 0
-                               tar.addfile(tarinfo)
+                               f = tempfile.TemporaryFile()
+                               f.write(_unicode_encode(
+                                       "# empty file because --include-config=n " + \
+                                       "when `quickpkg` was used\n"))
+                               f.flush()
+                               f.seek(0)
+                               tarinfo.size = os.fstat(f.fileno()).st_size
+                               tar.addfile(tarinfo, f)
+                               f.close()
                        else:
                                f = open(_unicode_encode(path,
                                        encoding=object.__getattribute__(os, '_encoding'),