Skip to content
Snippets Groups Projects
Commit f6e13bca authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Version 2011-02-17 13:26

parent c96afbea
No related branches found
No related tags found
No related merge requests found
......@@ -81,6 +81,10 @@ if __name__ == '__main__':
optParser.add_option("--dump",
action="store_true", default=False,
help="when listing, dump XML tree")
optParser.add_option("--exclude-rpm",
action="append", default=[],
metavar="RPM",
help="exclude RPM")
optParser.add_option("--install",
action="append", default=[],
metavar="TARGET",
......@@ -217,7 +221,8 @@ if __name__ == '__main__':
if not options.noyum:
log(NORMAL, "Testing rpms")
installer.test_rpms(options.path)
installer.test_rpms(options.path,
options.exclude_rpm)
log(NORMAL, "Testing files")
installer.test_groups(options.prefix)
......@@ -229,7 +234,8 @@ if __name__ == '__main__':
if not options.noyum:
log(NORMAL, "Installing rpms")
rpm_result = installer.install_rpms(options.path)
rpm_result = installer.install_rpms(options.path,
options.exclude_rpm)
log(NORMAL, "Installing files")
installer.install_groups(options.prefix,
......
......@@ -162,16 +162,19 @@ class Installer:
rpms.sort()
return rpms
def install_rpms(self, path):
def install_rpms(self, path, exclude):
rpm = []
version_db = mio.rpmDB.VersionDB()
for r in self.rpm:
r.old_version = version_db[r.name]
if r.old_version == None:
rpm.append(r.name)
pass
pass
rpm = filter(lambda p: not p in exclude, rpm)
rpm.sort()
print rpm
mio.yum.run(path + self.rpmdir, rpm)
mio.yum.run(path + self.rpmdir, rpm, exclude)
version_db = mio.rpmDB.VersionDB()
for r in self.rpm:
r.new_version = version_db[r.name]
......@@ -186,7 +189,8 @@ class Installer:
for g in self.group:
g.install(prefix, backup)
def test_rpms(self, path):
def test_rpms(self, path, exclude):
log(NORMAL, "Excluding rpms: "+ ",".join(exclude))
pass
def test_groups(self, prefix):
......
......@@ -71,7 +71,7 @@ def conf(path):
return "\n".join(result)
def run(path, rpm):
def run(path, rpm, exclude):
c = conf(path)
f = mio.filecache.createfile()
f.write(c)
......@@ -90,7 +90,9 @@ def run(path, rpm):
# to be done before the install, because outdated packages
# need to be updated before the install, or we might get
# a conflict.
update = "yum -c %s -e %s -d %s -y update" % (f.name, verb, verb)
exclude_arg = map(lambda s: "-x %s" % s, exclude)
update = "yum -c %s -e %s -d %s -y update %s" % (f.name, verb, verb,
" ".join(exclude_arg))
mio.log.log(NORMAL, update)
mio.daemon_cage.system(update)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment