Use shlex_split for splitting PORTDIR_OVERLAY.
authorZac Medico <zmedico@gentoo.org>
Wed, 28 Apr 2010 06:45:15 +0000 (23:45 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 28 Apr 2010 06:45:15 +0000 (23:45 -0700)
pym/portage/dbapi/porttree.py
pym/portage/package/ebuild/config.py

index fd7dbe6b718a5dbe8b6a629a69a539566c2dca6e..cbbb290f82718bd841462b5ecfbf36b332d1c632 100644 (file)
@@ -12,7 +12,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
        'portage.dep:dep_getkey,flatten,match_from_list,paren_reduce,use_reduce',
        'portage.env.loaders:KeyValuePairFileLoader',
        'portage.package.ebuild.doebuild:doebuild',
-       'portage.util:ensure_dirs,writemsg,writemsg_level',
+       'portage.util:ensure_dirs,shlex_split,writemsg,writemsg_level',
        'portage.util.listdir:listdir',
        'portage.versions:best,catpkgsplit,_pkgsplit@pkgsplit,ver_regexp',
 )
@@ -194,7 +194,7 @@ class portdbapi(dbapi):
 
                porttrees = [os.path.realpath(porttree_root)]
                porttrees.extend(os.path.realpath(x) for x in \
-                       self.settings.get('PORTDIR_OVERLAY', '').split())
+                       shlex_split(self.settings.get('PORTDIR_OVERLAY', '')))
                treemap = {}
                repository_map = {}
                self.treemap = treemap
index 30035e6fdf918b0537e54d3917b8974b10672622..dc7e1a857bc9a63287f68c2d3e29a0a36d07df22 100644 (file)
@@ -40,7 +40,7 @@ from portage.output import colorize
 from portage.process import fakeroot_capable, sandbox_capable
 from portage.util import ensure_dirs, getconfig, grabdict, \
        grabdict_package, grabfile, grabfile_package, LazyItemsDict, \
-       normalize_path, stack_dictlist, stack_dicts, stack_lists, \
+       normalize_path, shlex_split, stack_dictlist, stack_dicts, stack_lists, \
        writemsg, writemsg_level
 from portage.versions import catpkgsplit, catsplit, cpv_getkey
 
@@ -784,8 +784,22 @@ class config(object):
 
                        """ repoman controls PORTDIR_OVERLAY via the environment, so no
                        special cases are needed here."""
+
+                       overlays = shlex_split(self.get('PORTDIR_OVERLAY', ''))
+                       if overlays:
+                               new_ov = []
+                               for ov in overlays:
+                                       ov = normalize_path(ov)
+                                       if os.path.isdir(ov):
+                                               new_ov.append(ov)
+                                       else:
+                                               writemsg(_("!!! Invalid PORTDIR_OVERLAY"
+                                                       " (not a dir): '%s'\n") % ov, noiselevel=-1)
+                               self["PORTDIR_OVERLAY"] = " ".join(new_ov)
+                               self.backup_changes("PORTDIR_OVERLAY")
+
                        overlay_profiles = []
-                       for ov in self["PORTDIR_OVERLAY"].split():
+                       for ov in shlex_split(self.get('PORTDIR_OVERLAY', '')):
                                ov = normalize_path(ov)
                                profiles_dir = os.path.join(ov, "profiles")
                                if os.path.isdir(profiles_dir):
@@ -966,19 +980,6 @@ class config(object):
                        self["PORTAGE_DEPCACHEDIR"] = self.depcachedir
                        self.backup_changes("PORTAGE_DEPCACHEDIR")
 
-                       overlays = self.get("PORTDIR_OVERLAY","").split()
-                       if overlays:
-                               new_ov = []
-                               for ov in overlays:
-                                       ov = normalize_path(ov)
-                                       if os.path.isdir(ov):
-                                               new_ov.append(ov)
-                                       else:
-                                               writemsg(_("!!! Invalid PORTDIR_OVERLAY"
-                                                       " (not a dir): '%s'\n") % ov, noiselevel=-1)
-                               self["PORTDIR_OVERLAY"] = " ".join(new_ov)
-                               self.backup_changes("PORTDIR_OVERLAY")
-
                        if "CBUILD" not in self and "CHOST" in self:
                                self["CBUILD"] = self["CHOST"]
                                self.backup_changes("CBUILD")