From 80df4d593c66a45d855c1986bae3328a866318c7 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 1 Jun 2007 01:50:06 +0000 Subject: [PATCH] Add some additional variables to the Packages header. svn path=/main/trunk/; revision=6705 --- pym/portage/dbapi/bintree.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 1b9367da1..c3a3aad1d 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -135,6 +135,9 @@ class binarytree(object): os.path.join(self.pkgdir, "All")) self._pkgindex_file = os.path.join(self.pkgdir, "Packages") self._pkgindex_keys = set(["CPV", "SLOT", "MTIME", "SIZE"]) + self._pkgindex_header_keys = set(["ACCEPT_KEYWORDS", "CBUILD", + "CHOST", "CONFIG_PROTECT", "CONFIG_PROTECT_MASK", "FEATURES", + "GENTOO_MIRRORS", "INSTALL_MASK", "SYNC", "USE"]) def move_ent(self, mylist): if not self.populated: @@ -682,6 +685,7 @@ class binarytree(object): else: del d[k] pkgindex.packages[cpv] = d + self._update_pkgindex_header(pkgindex.header) from portage.util import atomic_ofstream f = atomic_ofstream(os.path.join(self.pkgdir, "Packages")) try: @@ -692,6 +696,19 @@ class binarytree(object): if pkgindex_lock: unlockfile(pkgindex_lock) + def _update_pkgindex_header(self, header): + portdir = normalize_path(os.path.realpath(self.settings["PORTDIR"])) + profiles_base = os.path.join(portdir, "profiles") + profile_path = normalize_path(os.path.realpath(self.settings.profile_path)) + profile_path = profile_path.lstrip(profiles_base) + header["PROFILE"] = profile_path + for k in self._pkgindex_header_keys: + v = self.settings.get(k, None) + if v: + header[k] = v + else: + header.pop(k, None) + def exists_specific(self, cpv): if not self.populated: self.populate() -- 2.26.2