Validate and normalize target_root earlier in the config constructor.
authorZac Medico <zmedico@gentoo.org>
Mon, 19 May 2008 23:19:00 +0000 (23:19 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 19 May 2008 23:19:00 +0000 (23:19 -0000)
svn path=/main/trunk/; revision=10369

pym/portage/__init__.py

index c8902b9bb2d844ca1c57b39a5d5eab58e0814900..e0d99e6e8b90d6e9e6664c53297f4b6ed64daa95 100644 (file)
@@ -1278,6 +1278,12 @@ class config(object):
                        if target_root is None:
                                target_root = "/"
 
+                       target_root = normalize_path(os.path.abspath(
+                               target_root)).rstrip(os.path.sep) + os.path.sep
+
+                       portage.util.ensure_dirs(target_root)
+                       check_var_directory("ROOT", target_root)
+
                        # The expand_map is used for variable substitution
                        # in getconfig() calls, and the getconfig() calls
                        # update expand_map with the value of each variable
@@ -1391,12 +1397,6 @@ class config(object):
                                        cfg.pop(blacklisted, None)
                        del blacklisted, cfg
 
-                       target_root = normalize_path(os.path.abspath(
-                               target_root)).rstrip(os.path.sep) + os.path.sep
-
-                       portage.util.ensure_dirs(target_root)
-                       check_var_directory("ROOT", target_root)
-
                        self["PORTAGE_CONFIGROOT"] = config_root
                        self.backup_changes("PORTAGE_CONFIGROOT")
                        self["ROOT"] = target_root