diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-03-21 14:37:27 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-03-21 14:37:27 -0400 |
commit | c9ba92ef62376bbf01da1eac96cd5a2b5eb65a66 (patch) | |
tree | 19a61840175d2fb16ea51dedf49abd45d2417774 /src/lib/Bcfg2/Client/Tools/Portage.py | |
parent | f36c89f5e78a3a2fcd9ad4b38b8670895883bd38 (diff) | |
parent | e88c029c6fdbedb038443c8cbe52206d9ca9c1a2 (diff) | |
download | bcfg2-c9ba92ef62376bbf01da1eac96cd5a2b5eb65a66.tar.gz bcfg2-c9ba92ef62376bbf01da1eac96cd5a2b5eb65a66.tar.bz2 bcfg2-c9ba92ef62376bbf01da1eac96cd5a2b5eb65a66.zip |
Merge branch 'maint'
Diffstat (limited to 'src/lib/Bcfg2/Client/Tools/Portage.py')
-rw-r--r-- | src/lib/Bcfg2/Client/Tools/Portage.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/Bcfg2/Client/Tools/Portage.py b/src/lib/Bcfg2/Client/Tools/Portage.py index 9381f44e9..6cbcff2e0 100644 --- a/src/lib/Bcfg2/Client/Tools/Portage.py +++ b/src/lib/Bcfg2/Client/Tools/Portage.py @@ -3,6 +3,7 @@ import re import Bcfg2.Client.Tools + class Portage(Bcfg2.Client.Tools.PkgTool): """The Gentoo toolset implements package and service operations and inherits the rest from Toolset.Toolset.""" @@ -35,9 +36,8 @@ class Portage(Bcfg2.Client.Tools.PkgTool): if not self._initialised: return self.logger.info('Getting list of installed packages') - cache = self.cmd.run("equery -q list '*'")[1] self.installed = {} - for pkg in cache: + for pkg in self.cmd.run("equery -q list '*'").stdout.splitlines(): if self._pkg_pattern.match(pkg): name = self._pkg_pattern.match(pkg).group(1) version = self._pkg_pattern.match(pkg).group(2) @@ -73,12 +73,12 @@ class Portage(Bcfg2.Client.Tools.PkgTool): self.logger.debug('Running equery check on %s' % entry.get('name')) - output = self.cmd.run("/usr/bin/equery -N check '=%s-%s' " - "2>&1 | grep '!!!' | awk '{print $2}'" - % ((entry.get('name'), version)))[1] - if [filename for filename in output \ - if filename not in modlist]: - return False + for line in self.cmd.run(["/usr/bin/equery", "-N", "check", + '=%s-%s' % + (entry.get('name'), + version)]).stdout.splitlines(): + if '!!!' in line and line.split()[1] not in modlist: + return False # By now the package must be in one of the following states: # - Not require checking |