[Ovirt-devel] [PATCH] replace ks_fold_include.py with ksflatten

Alan Pevec apevec at redhat.com
Thu Mar 27 14:58:27 UTC 2008


commit 6a9675dff3f0b63d3e2a3a2f1acf24883560258f
Author: Alan Pevec <apevec at redhat.com>
Date:   Thu Mar 27 14:46:25 2008 +0100

    replace ks_fold_include.py with ksflatten from pykickstart
    ksflatten parses and validates kickstart files
    NB: two %include in a row end up w/o line-feed between them, hence change in .ks files:
     %include ...
    +
     %include ...
    
    requires pykickstart >= 1.14

diff --git a/wui-appliance/Makefile b/wui-appliance/Makefile
index ca9ef00..1999457 100644
--- a/wui-appliance/Makefile
+++ b/wui-appliance/Makefile
@@ -1,10 +1,10 @@
 all: ks
 
 ks:
-	./ks_fold_include.py wui-app-i386.ks > wui-rel-app-i386.ks
-	./ks_fold_include.py wui-app-x86_64.ks > wui-rel-app-x86_64.ks
-	./ks_fold_include.py wui-devel-i386.ks > wui-rel-devel-i386.ks
-	./ks_fold_include.py wui-devel-x86_64.ks > wui-rel-devel-x86_64.ks
+	ksflatten wui-app-i386.ks > wui-rel-app-i386.ks
+	ksflatten wui-app-x86_64.ks > wui-rel-app-x86_64.ks
+	ksflatten wui-devel-i386.ks > wui-rel-devel-i386.ks
+	ksflatten wui-devel-x86_64.ks > wui-rel-devel-x86_64.ks
 
 clean:
 	rm -f *-rel-*
diff --git a/wui-appliance/ks_fold_include.py b/wui-appliance/ks_fold_include.py
deleted file mode 100755
index ec4262d..0000000
--- a/wui-appliance/ks_fold_include.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import re
-import os
-
-include_regex = re.compile("^%include\s+(.*)")
-
-def usage():
-    print "Usage: ks_fold_include.py <kickstart>"
-    sys.exit(1)
-
-def replace_lines(filename):
-    try:
-        file = open(filename)
-        for line in file.readlines():
-            matched = include_regex.match(line)
-            if matched:
-                replace_lines(matched.group(1))
-                sys.stdout.write("\n")
-            else:
-                sys.stdout.write(line)
-
-        file.close()
-    except IOError, detail:
-        print detail
-        sys.exit(2)
-
-if len(sys.argv) != 2:
-    usage()
-
-dirname = os.path.dirname(sys.argv[1])
-basename = os.path.basename(sys.argv[1])
-
-# if the user passes an argument like 'ks_fold_include.py foo.ks', then
-# dirname returns a blank string; assume we are already in the right directory
-# and do nothing
-if dirname != '':
-	os.chdir(dirname)
-
-replace_lines(basename)
diff --git a/wui-appliance/wui-app-i386.ks b/wui-appliance/wui-app-i386.ks
index b05e229..4d53c0b 100644
--- a/wui-appliance/wui-app-i386.ks
+++ b/wui-appliance/wui-app-i386.ks
@@ -1,6 +1,7 @@
 # Kickstart file automatically generated by anaconda.
 
 install
+
 url --url http://download.fedora.redhat.com/pub/fedora/linux/releases/8/Fedora/i386/os/
 
 %include common-install.ks
@@ -16,6 +17,7 @@ repo --name=ovirt-management --baseurl=http://ovirt.et.redhat.com/repos/ovirt-ma
 %post
 
 %include common-post.ks
+
 %include production-post.ks
 
 %end
diff --git a/wui-appliance/wui-app-x86_64.ks b/wui-appliance/wui-app-x86_64.ks
index 53fdd9f..6d192b3 100644
--- a/wui-appliance/wui-app-x86_64.ks
+++ b/wui-appliance/wui-app-x86_64.ks
@@ -16,6 +16,7 @@ repo --name=ovirt-management --baseurl=http://ovirt.et.redhat.com/repos/ovirt-ma
 %post
 
 %include common-post.ks
+
 %include production-post.ks
 
 %end
diff --git a/wui-appliance/wui-devel-i386.ks b/wui-appliance/wui-devel-i386.ks
index 9701a89..fb72e7b 100644
--- a/wui-appliance/wui-devel-i386.ks
+++ b/wui-appliance/wui-devel-i386.ks
@@ -16,6 +16,7 @@ repo --name=ovirt-management --baseurl=http://ovirt.et.redhat.com/repos/ovirt-ma
 %post
 
 %include common-post.ks
+
 %include devel-post.ks
 
 # get the PXE boot image; this can take a while
diff --git a/wui-appliance/wui-devel-x86_64.ks b/wui-appliance/wui-devel-x86_64.ks
index dae0f44..f2bd308 100644
--- a/wui-appliance/wui-devel-x86_64.ks
+++ b/wui-appliance/wui-devel-x86_64.ks
@@ -16,6 +16,7 @@ repo --name=ovirt-management --baseurl=http://ovirt.et.redhat.com/repos/ovirt-ma
 %post
 
 %include common-post.ks
+
 %include devel-post.ks
 
 # get the PXE boot image; this can take a while




More information about the ovirt-devel mailing list