Fix binarytree._update_pkgindex_header() so that it can cope
authorZac Medico <zmedico@gentoo.org>
Thu, 20 Dec 2007 11:40:55 +0000 (11:40 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 20 Dec 2007 11:40:55 +0000 (11:40 -0000)
with a missing profile.

svn path=/main/trunk/; revision=8985

pym/portage/dbapi/bintree.py

index c3c514a4e92722fc1150ed5f4cb01057135bef8e..e950b2052093e29fe50ddac8e5fd8d82d4a3ffd4 100644 (file)
@@ -785,10 +785,12 @@ class binarytree(object):
        def _update_pkgindex_header(self, header):
                portdir = normalize_path(os.path.realpath(self.settings["PORTDIR"]))
                profiles_base = os.path.join(portdir, "profiles") + os.path.sep
-               profile_path = normalize_path(os.path.realpath(self.settings.profile_path))
-               if profile_path.startswith(profiles_base):
-                       profile_path = profile_path[len(profiles_base):]
-               header["PROFILE"] = profile_path
+               if self.settings.profile_path:
+                       profile_path = normalize_path(
+                               os.path.realpath(self.settings.profile_path))
+                       if profile_path.startswith(profiles_base):
+                               profile_path = profile_path[len(profiles_base):]
+                       header["PROFILE"] = profile_path
                header["VERSION"] = str(self._pkgindex_version)
                base_uri = self.settings.get("PORTAGE_BINHOST_HEADER_URI")
                if base_uri: