[Yum-devel] [PATCH 3/3] - add docstrings to properties - return_running_packages method to YumBase to return list of pkgs which currently have a file opened by a running process
James Antill
james at fedoraproject.org
Tue Dec 8 21:59:11 UTC 2009
On Tue, 2009-12-08 at 16:45 -0500, Seth Vidal wrote:
> ---
> yum/__init__.py | 39 ++++++++++++++++++++++++++++++---------
> 1 files changed, 30 insertions(+), 9 deletions(-)
>
> diff --git a/yum/__init__.py b/yum/__init__.py
> index 2aaa66a..bd16d78 100644
> --- a/yum/__init__.py
> +++ b/yum/__init__.py
> @@ -719,29 +719,39 @@ class YumBase(depsolve.Depsolve):
> # properties so they auto-create themselves with defaults
> repos = property(fget=lambda self: self._getRepos(),
> fset=lambda self, value: setattr(self, "_repos", value),
> - fdel=lambda self: self._delRepos())
> + fdel=lambda self: self._delRepos(),
> + doc="Repo Storage object - object of yum repositories")
Ahh, that's how you do it ... instant ACK to all docs :)
> @@ -4184,3 +4194,14 @@ class YumBase(depsolve.Depsolve):
> return False
>
> return True
> +
> + def return_running_packages(self):
> + """returns a list of yum installed package objects which own a file
> + that are currently running or in use."""
> + pkgs = {}
> + for pid in misc.return_running_pids():
> + for fn in misc.get_open_files(pid):
> + for pkg in self.rpmdb.searchFiles(fn):
> + pkgs[pkg] = 1
> +
> + return sorted(pkgs.keys())
Why not just put this in rpmdb directly?
More information about the Yum-devel
mailing list