diff options
Diffstat (limited to '')
-rw-r--r-- | portato/backend/package.py | 9 | ||||
-rw-r--r-- | portato/backend/portage/package.py | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/portato/backend/package.py b/portato/backend/package.py index 8df7dae..4f90765 100644 --- a/portato/backend/package.py +++ b/portato/backend/package.py @@ -330,6 +330,15 @@ class Package (_Package): raise NotImplementedError + def get_files (self): + """ + Returns an iterator over the installed files of a package. + If the package is not installed, the iterator should be "empty". + + @returns: the installed files + @rtype: string<iterator> + """ + def get_package_settings(self, var, tree = None): """Returns a package specific setting, such as DESCRIPTION, SRC_URI, IUSE ... diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py index 0c8e5f1..845cc0b 100644 --- a/portato/backend/portage/package.py +++ b/portato/backend/portage/package.py @@ -263,6 +263,13 @@ class PortagePackage (Package): def get_ebuild_path(self): return self._settings.porttree.dbapi.findname(self._cpv) + def get_files (self): + if self.is_installed(): + path = os.path.join(self.get_global_settings("ROOT"), portage.VDB_PATH, self.get_cpv(), "CONTENTS") + with open(path) as f: + for line in f: + yield line.split()[1].strip() + def get_package_settings(self, var, tree = None): if not tree: mytree = self._settings.vartree |