From c07dfc43dd426962e44ae3bd46ade3fac2acb362 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 27 Apr 2010 23:45:15 -0700 Subject: [PATCH] Use shlex_split for splitting PORTDIR_OVERLAY. --- pym/portage/dbapi/porttree.py | 4 ++-- pym/portage/package/ebuild/config.py | 31 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index fd7dbe6b7..cbbb290f8 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -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 diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 30035e6fd..dc7e1a857 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -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") -- 2.26.2