summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-06-06 04:51:54 -0700
committerZac Medico <zmedico@gentoo.org>2011-06-06 04:51:54 -0700
commit531f10764b7159dd9578f914fa7a862132c582e1 (patch)
tree32d10f3bf3738e32853a57ffff7ee24c8f23df90
parentde0657223812d7768e6b474d6db84d87fa2242ff (diff)
downloadportage-531f10764b7159dd9578f914fa7a862132c582e1.tar.gz
portage-531f10764b7159dd9578f914fa7a862132c582e1.tar.bz2
portage-531f10764b7159dd9578f914fa7a862132c582e1.zip
bintree: populate REPO header for empty pkgindexv2.2.0_alpha38
-rw-r--r--pym/portage/dbapi/bintree.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 33cd6580c..ffa296c29 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -1280,7 +1280,14 @@ class binarytree(object):
mode='r', encoding=_encodings['repo.content'],
errors='replace')
except EnvironmentError:
- pass
+ # We're creating a new file, so populate the header
+ # with appropriate defaults. This is especially
+ # important for keys like REPO that save space when
+ # entries can inherit them from the header.
+ pkgindex.header["VERSION"] = str(self._pkgindex_version)
+ main_repo = self.settings.repositories.mainRepo()
+ if main_repo is not None:
+ pkgindex.header["REPO"] = main_repo.name
else:
try:
pkgindex.read(f)