Merged from trunk -r13139:13144
authorFabian Groffen <grobian@gentoo.org>
Thu, 26 Mar 2009 20:36:48 +0000 (20:36 -0000)
committerFabian Groffen <grobian@gentoo.org>
Thu, 26 Mar 2009 20:36:48 +0000 (20:36 -0000)
   | 13140   | Fix argument validation to allow file paths. Thanks to       |
   | zmedico | Arfrever for reporting.                                      |

   | 13141   | Add a temporary workaround for bug #263081 (partially        |
   | zmedico | reverts r12757).                                             |

   | 13142   | Remove pointless usage of xrange(). Thanks to Douglass       |
   | zmedico | Anderson <dja@gendja.com> for this patch.                    |

   | 13143   | Inside config.environ(), skip stat call on $T/environment    |
   | zmedico | for phases such as 'clean' and 'depend' where environment    |
   |         | filtering isn't needed. Thanks to Piotr Jaroszyński         |
   |         | <peper@g.o> for reporting.                                   |

   | 13144   | Inside spawn(), avoid redundant os.access() and stat() calls |
   | zmedico | on commonly spawned binaries such as BASH_BINARY,            |
   |         | SANDBOX_BINARY, and FAKEROOT_BINARY. Thanks to Piotr         |
   |         | Jaroszyński <peper@g.o> for reporting.                      |

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

pym/_emerge/__init__.py
pym/portage/__init__.py
pym/portage/cache/sqlite.py
pym/portage/process.py

index 04da574427f5994e3affaf73ec64051af01be191..d78dea91ac4e68c7fd90484bd129b1d7e469e578 100644 (file)
@@ -15759,6 +15759,13 @@ def emerge_main():
                        if x.startswith(SETPREFIX) or \
                                is_valid_package_atom(x):
                                continue
+                       if x[:1] == os.sep:
+                               continue
+                       try:
+                               os.lstat(x)
+                               continue
+                       except OSError:
+                               pass
                        msg = []
                        msg.append("'%s' is not a valid package atom." % (x,))
                        msg.append("Please check ebuild(5) for full details.")
index a4f0c39dd56ab647a8ed3e34cf7e11e81b4e02cf..1d5c0b482d5aab2f2804b713d458f91fb9cb1c7e 100644 (file)
@@ -1365,9 +1365,9 @@ class config(object):
                        rawpkeywords = [grabdict_package(
                                os.path.join(x, "package.keywords"), recursive=1) \
                                for x in self.profiles]
-                       for i in xrange(len(self.profiles)):
+                       for pkeyworddict in rawpkeywords:
                                cpdict = {}
-                               for k, v in rawpkeywords[i].iteritems():
+                               for k, v in pkeyworddict.iteritems():
                                        cpdict.setdefault(dep_getkey(k), {})[k] = v
                                self._pkeywords_list.append(cpdict)
 
@@ -3006,11 +3006,13 @@ class config(object):
                mydict={}
                environ_filter = self._environ_filter
 
+               phase = self.get('EBUILD_PHASE')
                filter_calling_env = False
-               temp_dir = self.get("T")
-               if temp_dir is not None and \
-                       os.path.exists(os.path.join(temp_dir, "environment")):
-                       filter_calling_env = True
+               if phase not in ('clean', 'cleanrm', 'depend'):
+                       temp_dir = self.get('T')
+                       if temp_dir is not None and \
+                               os.path.exists(os.path.join(temp_dir, 'environment')):
+                               filter_calling_env = True
 
                environ_whitelist = self._environ_whitelist
                env_d = self.configdict["env.d"]
@@ -3036,7 +3038,6 @@ class config(object):
                        mydict["HOME"]=mydict["BUILD_PREFIX"][:]
 
                if filter_calling_env:
-                       phase = self.get("EBUILD_PHASE")
                        if phase:
                                whitelist = []
                                if "rpm" == phase:
index aa5c3046876d4a8c199daaed56a2b95dcb0f22cb..6588b3cc748b02c91b66e2f107e32d9bd4321c9b 100644 (file)
@@ -164,6 +164,18 @@ class database(fs_template.FsBased):
                        if k not in internal_columns:
                                d[k] = result[0][column_index]
 
+               # As a temporary workaround for bug #263081, convert unicode strings
+               # to raw byte strings. This helps to potential unicode errors that can
+               # be triggered elsewhere when attempting to join unicode strings with
+               # raw byte strings. TODO: Convert all string handling code to use
+               # unicode strings instead of raw byte strings (required for py3k
+               # compatibility).
+               for k, v in d.iteritems():
+                       try:
+                               d[k] = str(v)
+                       except UnicodeEncodeError:
+                               pass
+
                return d
 
        def _setitem(self, cpv, values):
index 6f449c3d6da8b325918883acd6309d667e0b0f70..a88f5bf28f24699f968a815d556b3c47a22843ea 100644 (file)
@@ -181,7 +181,8 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False,
        # If an absolute path to an executable file isn't given
        # search for it unless we've been told not to.
        binary = mycommand[0]
-       if (not os.path.isabs(binary) or not os.path.isfile(binary)
+       if binary not in (BASH_BINARY, SANDBOX_BINARY, FAKEROOT_BINARY) and \
+               (not os.path.isabs(binary) or not os.path.isfile(binary)
            or not os.access(binary, os.X_OK)):
                binary = path_lookup and find_binary(binary) or None
                if not binary: