Validate and normalize target_root earlier in the config constructor.
authorZac Medico <zmedico@gentoo.org>
Mon, 19 May 2008 23:19:19 +0000 (23:19 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 19 May 2008 23:19:19 +0000 (23:19 -0000)
(trunk r10369)

svn path=/main/branches/2.1.2/; revision=10370

pym/portage.py

index ba79b2d43e7eee653886be5ab881290379ce1423..cfc998999ddd6e0aabae4d4884dcce36902e22de 100644 (file)
@@ -1438,6 +1438,12 @@ class config:
                        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
@@ -1551,12 +1557,6 @@ class config:
                                        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