diff options
author | Anas Nashif <nashif@linux.intel.com> | 2011-03-31 23:28:50 +0100 |
---|---|---|
committer | Anas Nashif <nashif@linux.intel.com> | 2011-03-31 23:28:50 +0100 |
commit | 6038ad65c48ded455800cd082f511dd733a7bdc0 (patch) | |
tree | b565677b5c0ff82209ca553336cdbbc21c950318 | |
parent | 955cf8b5aef2d8cc24845f5caf0c1b44d16b2c71 (diff) | |
download | kickstarter-6038ad65c48ded455800cd082f511dd733a7bdc0.tar.gz kickstarter-6038ad65c48ded455800cd082f511dd733a7bdc0.tar.bz2 kickstarter-6038ad65c48ded455800cd082f511dd733a7bdc0.zip |
support index file again
-rwxr-xr-x | tools/kickstarter | 96 |
1 files changed, 47 insertions, 49 deletions
diff --git a/tools/kickstarter b/tools/kickstarter index 225eb61..cd66e0e 100755 --- a/tools/kickstarter +++ b/tools/kickstarter @@ -111,6 +111,49 @@ class KSWriter(): f.write(a) f.close() + +def image_xml(root, img): + s = etree.Element("config") + c = etree.Element('name') + c.text = "%s.ks" %img['FileName'] + s.append(c) + cc = etree.Element('path') + cc.text = "image-configs/%s.ks" %img['FileName'] + s.append(cc) + cc = etree.Element('description') + cc.text = "%s" %img['Name'] + s.append(cc) + + if img.has_key('Architecture'): + cc = etree.Element('arch') + cc.text = "%s" %img['Architecture'] + s.append(cc) + + cc = etree.Element('md5') + cc.text = "" + s.append(cc) + + cc = etree.Element('schedule') + if img.has_key('Schedule'): + cc.text = img['Schedule'] + s.append(cc) + root.append(s) + +def create_xml(image_meta): + root = etree.Element("image-configs") + for img in image_meta['Configurations']: + image_xml(root,img) + for path in image_meta['ExternalConfigs']: + for f in os.listdir(path): + if '.yaml' in f: + fp = file('%s/%s' %(path, f), 'r') + local = yaml.load(fp) + conf = ks.parse(local) + image_xml(root,conf) + + str = etree.tostring(root, pretty_print=True) + return str + if __name__ == '__main__': parser = optparse.OptionParser() @@ -154,52 +197,7 @@ if __name__ == '__main__': ks.process_files(conf, r) if options.indexfile: - """ -<?xml version="1.0"?> -<image-configs> - <config> - <name>developer.ks</name> - <path>image-config/developer.ks</path> - <description>Default Developer Moblin Configuration for netbooks, nettops and generic hardware</description> - <md5>e8184823bce48f72679743c2c47136dd</md5> - </config> - <config> - <name>default.ks</name> - <path>image-config/default.ks</path> - <description>Default Moblin Configuration for netbooks, nettops and generic hardware</description> - <md5>3526567cb67748f46464d295eb660931</md5> - </config> -</image-configs> - """ - root = etree.Element("image-configs") - for img in image_meta['Configurations']: - s = etree.Element("config") - c = etree.Element('name') - c.text = "%s.ks" %img['FileName'] - s.append(c) - cc = etree.Element('path') - cc.text = "image-configs/%s.ks" %img['FileName'] - s.append(cc) - cc = etree.Element('description') - cc.text = "%s" %img['Name'] - s.append(cc) - - if img.has_key('Architecture'): - cc = etree.Element('arch') - cc.text = "%s" %img['Architecture'] - s.append(cc) - - cc = etree.Element('md5') - cc.text = "" - s.append(cc) - - cc = etree.Element('schedule') - if img.has_key('Schedule'): - cc.text = img['Schedule'] - s.append(cc) - root.append(s) - str = etree.tostring(root, pretty_print=True) - f = open(options.indexfile, 'w') - f.write(str) - f.close() - sys.exit(0) + str = create_xml(image_meta) + f = open(options.indexfile, 'w') + f.write(str) + f.close() |