From 6f44c61f3369842687fdf6b46075df5aa0373089 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 16 Mar 2011 03:23:07 +0000 Subject: produce index file --- tools/kickstarter | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'tools') diff --git a/tools/kickstarter b/tools/kickstarter index 6cd4baf..113b032 100644 --- a/tools/kickstarter +++ b/tools/kickstarter @@ -10,6 +10,8 @@ import time import optparse from time import gmtime, strftime import errno +#import elementtree.ElementTree as etree +from lxml import etree def mkdir_p(path): try: @@ -118,9 +120,13 @@ if __name__ == '__main__': help="outdir") parser.add_option("-r", "--repos", type="string", dest="repofile", help="repo meta file") + parser.add_option("-i", "--index", type="string", dest="indexfile", + help="generate index file") (options, args) = parser.parse_args() + + if options.configsfile is None or options.repofile is None: print "you need to provide meta files with --configs and --repos" sys.exit(1) @@ -134,7 +140,55 @@ if __name__ == '__main__': ks = KSWriter(options.configsfile, options.repofile, outdir) repo_meta = yaml.load(ks.repo_stream) image_meta = yaml.load(ks.image_stream) + r = repo_meta['Repositories'] for img in image_meta['Configurations']: conf = ks.parse(img) ks.process_files(conf, r) + if options.indexfile: + """ + + + + developer.ks + image-config/developer.ks + Default Developer Moblin Configuration for netbooks, nettops and generic hardware + e8184823bce48f72679743c2c47136dd + + + default.ks + image-config/default.ks + Default Moblin Configuration for netbooks, nettops and generic hardware + 3526567cb67748f46464d295eb660931 + + + """ + 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 = "configurations/%s.ks" %img['FileName'] + s.append(cc) + cc = etree.Element('description') + cc.text = "%s" %img['Name'] + s.append(cc) + + cc = etree.Element('md5') + cc.text = "" + s.append(cc) + + cc = etree.Element('daily') + if img.has_key('Daily') and img['Daily']: + cc.text = 'yes' + else: + cc.text = 'no' + 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) -- cgit v1.2.3