summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2004-10-07 20:08:39 +0000
committerNarayan Desai <desai@mcs.anl.gov>2004-10-07 20:08:39 +0000
commiteee5cefeed6269c8e110c31673cff6788188a650 (patch)
tree3ec7fee6cf67c80b0019245465d1b73742ad3279 /src
parentde50bdb76ce13e6dcc4736398a9a55b5d616635a (diff)
downloadbcfg2-eee5cefeed6269c8e110c31673cff6788188a650.tar.gz
bcfg2-eee5cefeed6269c8e110c31673cff6788188a650.tar.bz2
bcfg2-eee5cefeed6269c8e110c31673cff6788188a650.zip
implement bulk/async package installs
(Logical change 1.83) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@398 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Client/Debian.py38
1 files changed, 31 insertions, 7 deletions
diff --git a/src/lib/Client/Debian.py b/src/lib/Client/Debian.py
index 348df3e89..e8f269fd8 100644
--- a/src/lib/Client/Debian.py
+++ b/src/lib/Client/Debian.py
@@ -98,12 +98,37 @@ class Debian(Toolset):
if self.setup['dryrun']:
return False
else:
- # implement package installation here
- rc = system("apt-get --reinstall -q=2 -y install %s=%s"%(entry.attrib['name'],entry.attrib['version']))
- if rc == 0:
- return True
- else:
- return False
+ # queue package for bulk installation
+ self.pkgtodo.append(entry)
+ return False
+
+ def Commit(self, entrystate):
+ cmd = "apt-get --reinstall -q=2 -y install %s"
+ # try single large install
+ rc = system(join(map(lambda x:"%s-%s"%(x.attrib['name'], x.attrib['version']), self.pkgtodo)))
+ if rc == 0:
+ # set installed to true for pkgtodo
+ for pkg in self.pkgtodo:
+ entrystate[x]=True
+ self.pkgtodo = []
+ else:
+ # do single pass installs
+ system("dpkg --configure --pending")
+ self.Refresh()
+ for pkg in self.pkgtodo:
+ if self.VerifyPackage(pkg):
+ entrystate[pkg] = True
+ self.pkgtodo.remove(pkg)
+ oldlen = len(self.pkgtodo) + 1
+ while (len(self.pkgtodo) < oldlen):
+ oldlen = len(self.pkgtodo)
+ for pkg in self.pkgtodo:
+ rc = system(cmd%(pkg.attrib['name'], pkg.attrib['user']))
+ if rc == 0:
+ entrystate[pkg] = True
+ self.pkgtodo.remove(pkg)
+ else:
+ print "Failed to install package %s"%(pkg.attrib['name'])
def GetInstalledConfigs(self):
# returns a list of installed config files
@@ -118,4 +143,3 @@ class Debian(Toolset):
e.append(Element('Package', name=pkg, version=vers))
# need to add config file two way later
return e
-