produce index file
authorAnas Nashif <nashif@linux.intel.com>
Wed, 16 Mar 2011 03:23:07 +0000 (03:23 +0000)
committerAnas Nashif <nashif@linux.intel.com>
Wed, 16 Mar 2011 03:23:07 +0000 (03:23 +0000)
configurations.yaml
tools/kickstarter

index 1feb1ff..9642e6c 100644 (file)
@@ -218,7 +218,11 @@ Configurations:
         Architecture: ia32
         Desktop: DUI
         Session: "/usr/bin/mcompositor"
+        Daily: True
     -   Name: MeeGo Handset MTF
+        Daily: False
+        Schedule:
+            - Tuesday
         Active: True
         Baseline: "1.1.80"
         Platform: MFLD
index 6cd4baf..113b032 100644 (file)
@@ -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)