From 531f10764b7159dd9578f914fa7a862132c582e1 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 6 Jun 2011 04:51:54 -0700 Subject: [PATCH] bintree: populate REPO header for empty pkgindex --- pym/portage/dbapi/bintree.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) -- 2.26.2