We all know about the duplication in x86_64 vs i386 .ks files in
wui-appliance/ and don't like having to make identical changes twice
(one of the nominally-sync'd files had even diverged, albeit
just by a single blank line), so this change removes the duplicated
files and generates them from the ones that are left behind, among
other things. These changes depend on GNU make.
wui-appliance/Makefile: generate some files
Generate each wui-*-i386.ks file from the corresponding x86_64.ks one.
Ensure that generated files are read-only.
Generate and use dependencies.
* wui-appliance/wui-app-i386.ks: Remove file. Now generated.
* wui-appliance/wui-devel-i386.ks: Likewise.
* wui-appliance/.gitignore: New file.
---
wui-appliance/.gitignore | 7 +++++
wui-appliance/Makefile | 47 ++++++++++++++++++++++++++++++++++-----
wui-appliance/wui-app-i386.ks | 22 ------------------
wui-appliance/wui-devel-i386.ks | 30 ------------------------
4 files changed, 48 insertions(+), 58 deletions(-)
create mode 100644 wui-appliance/.gitignore
delete mode 100644 wui-appliance/wui-app-i386.ks
delete mode 100644 wui-appliance/wui-devel-i386.ks
diff --git a/wui-appliance/.gitignore b/wui-appliance/.gitignore
new file mode 100644
index 0000000..ef1c605
--- /dev/null
+++ b/wui-appliance/.gitignore
@@ -0,0 +1,7 @@
+.deps
+wui-app-i386.ks
+wui-devel-i386.ks
+wui-rel-app-i386.ks
+wui-rel-app-x86_64.ks
+wui-rel-devel-i386.ks
+wui-rel-devel-x86_64.ks
diff --git a/wui-appliance/Makefile b/wui-appliance/Makefile
index 1999457..439185c 100644
--- a/wui-appliance/Makefile
+++ b/wui-appliance/Makefile
@@ -1,10 +1,45 @@
all: ks
-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
+primary_src = \
+ wui-app-x86_64.ks \
+ wui-devel-x86_64.ks
+
+rel_ks = \
+ wui-rel-app-i386.ks \
+ wui-rel-app-x86_64.ks \
+ wui-rel-devel-i386.ks \
+ wui-rel-devel-x86_64.ks
+
+ks: $(rel_ks)
+
+define ks-flatten
+ rm -f $@ $@-t
+ ksflatten $< > $@-t
+ chmod a=r $@-t
+ mv $@-t $@
+endef
+
+wui-rel-app-%.ks: wui-app-%.ks
+ $(ks-flatten)
+
+wui-rel-devel-%.ks: wui-devel-%.ks
+ $(ks-flatten)
+
+# Generate each wui-*-i386.ks file from the corresponding x86_64.ks one.
+wui-%-i386.ks: wui-%-x86_64.ks
+ rm -f $@ $@-t
+ sed 's/x86_64/i386/' $< > $@-t
+ chmod a=r $@-t
+ mv $@-t $@
+
+# Generate dependencies.
+include .deps
+.deps: $(primary_src)
+ rm -f .deps
+ for i in $^; do \
+ sed -n '/^%include \(.*\.ks\)$$/s//'"$$i: "'\1/p'
$$i >> $@-t; \
+ done
+ mv $@-t $@
clean:
- rm -f *-rel-*
+ rm -f wui-devel-i386.ks wui-app-i386.ks $(rel_ks) .deps
diff --git a/wui-appliance/wui-app-i386.ks b/wui-appliance/wui-app-i386.ks
deleted file mode 100644
index 38f80d4..0000000
--- a/wui-appliance/wui-app-i386.ks
+++ /dev/null
@@ -1,22 +0,0 @@
-# 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
-
-repo --name=f8
--mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-8&arch=i386
-repo --name=f8-updates
--mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f8&arch=i386
-repo --name=ovirt-management
--baseurl=http://ovirt.et.redhat.com/repos/ovirt-management-repo/i386/
-
-%packages
-%include common-pkgs.ks
-
-%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
deleted file mode 100644
index 519c18c..0000000
--- a/wui-appliance/wui-devel-i386.ks
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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
-
-%include devel-install.ks
-
-repo --name=f8
--mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-8&arch=i386
-repo --name=f8-updates
--mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f8&arch=i386
-repo --name=ovirt-management
--baseurl=http://ovirt.et.redhat.com/repos/ovirt-management-repo/i386/
-
-%packages
-%include common-pkgs.ks
-
-%post
-
-%include common-post.ks
-
-%include devel-post.ks
-
-# get the PXE boot image; this can take a while
-PXE_URL=http://ovirt.org/download
-IMAGE=ovirt-pxe-host-image-i386-0.4.tar.bz2
-wget ${PXE_URL}/$IMAGE -O /tmp/$IMAGE
-tar -C / -jxvf /tmp/$IMAGE
-rm -f /tmp/$IMAGE
-
-%end
--
1.5.5.50.gab781
Chris Lalancette
2008-Apr-14 19:48 UTC
[Ovirt-devel] wui-appliance: avoid some duplication
Jim Meyering wrote:> We all know about the duplication in x86_64 vs i386 .ks files in > wui-appliance/ and don't like having to make identical changes twice > (one of the nominally-sync'd files had even diverged, albeit > just by a single blank line), so this change removes the duplicated > files and generates them from the ones that are left behind, among > other things. These changes depend on GNU make. > > wui-appliance/Makefile: generate some files > > Generate each wui-*-i386.ks file from the corresponding x86_64.ks one. > Ensure that generated files are read-only. > Generate and use dependencies. > * wui-appliance/wui-app-i386.ks: Remove file. Now generated. > * wui-appliance/wui-devel-i386.ks: Likewise. > * wui-appliance/.gitignore: New file.This will make life much easier from a maintenance POV. This will mess up a little bit of what I'm doing currently, but it's well worth it for the long term. We should probably also consider doing something like this in ovirt-host-creator, although it is trickier there because of the package differences. In any case... ACK Chris Lalancette