summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAnas Nashif <nashif@linux.intel.com>2011-03-16 03:23:07 +0000
committerAnas Nashif <nashif@linux.intel.com>2011-03-16 03:23:07 +0000
commit6f44c61f3369842687fdf6b46075df5aa0373089 (patch)
tree50b9b74ba91a1e00bb56eab9d6197958ff5c6a3a /tools
parent3c691429260c8e461e227331ff232dedb78a7fb7 (diff)
downloadkickstarter-6f44c61f3369842687fdf6b46075df5aa0373089.tar.gz
kickstarter-6f44c61f3369842687fdf6b46075df5aa0373089.tar.bz2
kickstarter-6f44c61f3369842687fdf6b46075df5aa0373089.zip
produce index file
Diffstat (limited to 'tools')
-rw-r--r--tools/kickstarter54
1 files changed, 54 insertions, 0 deletions
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:
+ """
+<?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 = "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)