From 86ff1d59e7fb8cfc58cfae8fd24d80c56f3c5110 Mon Sep 17 00:00:00 2001 From: Michael Jinks Date: Wed, 24 Jan 2007 17:26:39 +0000 Subject: Removed call to 'emerge --sync' before package installs Fixed mishandling of output from 'equery check' which caused packages to reinstall on each run if their config files had been changed Removed files from __important__ which matter more for building than installing/maintaining packages git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2717 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Tools/Portage.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/lib/Client/Tools/Portage.py b/src/lib/Client/Tools/Portage.py index 3116578b0..6a5b8b451 100644 --- a/src/lib/Client/Tools/Portage.py +++ b/src/lib/Client/Tools/Portage.py @@ -1,5 +1,4 @@ -'''This is the bcfg2 support for the Gentoo Portage system, largely cribbed from the -APT one''' +'''This is the bcfg2 tool for the Gentoo Portage system.''' __revision__ = '$Revision: $' import re @@ -10,8 +9,7 @@ class Portage(Bcfg2.Client.Tools.PkgTool): the rest from Toolset.Toolset''' __name__ = 'Portage' __execs__ = ['/usr/bin/emerge', '/usr/bin/equery'] - __important__ = ["/etc/make.conf", "/etc/make.globals", \ - "/etc/make.profile/make.defaults", "/etc/make.profile/packages" ] + __important__ = ['/etc/make.conf'] __handles__ = [('Package', 'ebuild')] __req__ = {'Package': ['name', 'version']} pkgtype = 'ebuild' @@ -21,8 +19,6 @@ class Portage(Bcfg2.Client.Tools.PkgTool): def __init__(self, logger, cfg, setup, states): Bcfg2.Client.Tools.PkgTool.__init__(self, logger, cfg, setup, states) self.cfg = cfg - if not self.setup['dryrun']: - self.cmd.run("emerge -q --sync") self.installed = {} self.RefreshPackages() @@ -45,11 +41,13 @@ class Portage(Bcfg2.Client.Tools.PkgTool): return False if self.installed.has_key(entry.attrib['name']): if self.installed[entry.attrib['name']] == entry.attrib['version']: - if not self.setup['quick'] and entry.get('verify', 'true') == 'true': - # mrj - there's probably a "python way" to avoid the grep...? - output = self.cmd.run("/usr/bin/equery check =%s | grep '!!!'" \ - % entry.get('name'))[1] - if [filename for filename in output if filename not in modlist]: + if not self.setup['quick'] and \ + entry.get('verify', 'true') == 'true': + output = self.cmd.run \ + ("/usr/bin/equery check =%s 2>&1 |grep '!!!' \ + | awk '{print $2}'" % entry.get('name'))[1] + if [filename for filename in output \ + if filename not in modlist]: return False return True else: -- cgit v1.2.3-1-g7c22