summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2004-09-02 20:54:41 +0000
committerNarayan Desai <desai@mcs.anl.gov>2004-09-02 20:54:41 +0000
commit578d4f38916329ec5d56490eb4f16bc22420d09c (patch)
tree4f97f887cf2545b3be45d5ab83a62f817e0fdbd8
parentbcc9f2496eb8440de21c1444cc6907b3f7f8582a (diff)
downloadbcfg2-578d4f38916329ec5d56490eb4f16bc22420d09c.tar.gz
bcfg2-578d4f38916329ec5d56490eb4f16bc22420d09c.tar.bz2
bcfg2-578d4f38916329ec5d56490eb4f16bc22420d09c.zip
(Logical change 1.56)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@312 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--tools/bundlecvt.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/bundlecvt.py b/tools/bundlecvt.py
index e69de29bb..cae4e2d23 100644
--- a/tools/bundlecvt.py
+++ b/tools/bundlecvt.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# $Id: $
+
+from os import listdir
+from sys import argv
+from elementtree.ElementTree import XML, Element, tostring
+
+if __name__ == '__main__':
+ bundles = argv[1]
+ translations = argv[2]
+ tdata = {}
+
+ for t in listdir(translations):
+ data = XML(open("%s/%s"%(translations,t)).read())
+ tdata[data.attrib['system']] = {'VConfig':{}, 'VPackage':{}, 'VService':{}, 'VFS':{}}
+ for entry in data.getchildren():
+ if entry.tag == 'Image':
+ continue
+ tdata[data.attrib['system']][entry.tag][entry.attrib['name']] = entry.getchildren()
+ bundle = XML(open('/home/desai/data/bold/b/ssh.xml').read())
+
+ new = Element('Bundle', version='2.0', name=bundle.attrib['name'])
+
+ for system in tdata.keys():
+ b = Element("System", name=system)
+ for entry in bundle.getchildren():
+ map(b.append, tdata[system][entry.tag][entry.attrib['name']])
+ new.append(b)
+
+ print tostring(new)
+