diff options
-rw-r--r-- | pym/portage/dbapi/bintree.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index ffa296c29..756ea6711 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -270,9 +270,23 @@ class binarytree(object): "REQUIRED_USE" : "" } self._pkgindex_inherited_keys = ["CHOST", "repository"] + + # Populate the header with appropriate defaults. self._pkgindex_default_header_data = { - "repository":"" + "VERSION" : str(self._pkgindex_version), + "repository" : "", } + + # It is especially important to populate keys like + # "repository" that save space when entries can + # inherit them from the header. If an existing + # pkgindex header already defines these keys, then + # they will appropriately override our defaults. + main_repo = self.settings.repositories.mainRepo() + if main_repo is not None: + self._pkgindex_default_header_data["repository"] = \ + main_repo.name + self._pkgindex_translated_keys = ( ("DESCRIPTION" , "DESC"), ("repository" , "REPO"), @@ -284,7 +298,6 @@ class binarytree(object): self._pkgindex_hashes, self._pkgindex_default_pkg_data, self._pkgindex_inherited_keys, - self._pkgindex_default_header_data, chain(*self._pkgindex_translated_keys) )) @@ -1280,14 +1293,7 @@ class binarytree(object): mode='r', encoding=_encodings['repo.content'], errors='replace') except EnvironmentError: - # 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 + pass else: try: pkgindex.read(f) |