[Ovirt-devel] [PATCH] Moves building ovirt-node-image.iso into the ovirt-node repo.

Darryl L. Pierce dpierce at redhat.com
Fri Mar 26 19:28:14 UTC 2010


Added a new subdirectory called "isobuilder" to the project. Created a new
Makefile that only allows for creating the livecd version of the oVirt
node. Adjusted the build environment to work with the kickstart files
that are found in the repo and not ones installed via any previous RPM.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 configure.ac           |    1 +
 isobuilder/Makefile.am |  103 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+), 0 deletions(-)
 create mode 100644 isobuilder/Makefile.am

diff --git a/configure.ac b/configure.ac
index b6e0973..6957a03 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,6 +9,7 @@ test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \
 
 AC_CONFIG_FILES([Makefile
   images/Makefile
+  isobuilder/Makefile
   kinit/Makefile
   nodeadmin/Makefile
   scripts/Makefile
diff --git a/isobuilder/Makefile.am b/isobuilder/Makefile.am
new file mode 100644
index 0000000..ec4aab3
--- /dev/null
+++ b/isobuilder/Makefile.am
@@ -0,0 +1,103 @@
+# Copyright (C) 2008 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.  A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+OVIRT_CACHE_DIR   ?= $(HOME)/ovirt-cache
+OVIRT_LOCAL_REPO  ?= file://$(OVIRT_CACHE_DIR)/ovirt
+OVIRT_NODE_RECIPE ?= ../recipe/ovirt-node-recipe.ks
+SUM               ?= sha1sum
+PKG_FMT            = iso
+SRC_FMT           ?= tar
+AUTH_KEYS         ?= ~/.ssh/authorized_keys
+PACKAGE            = ovirt-node-image
+
+ARCH              = $(shell rpm --eval '%{_arch}')
+
+NVR               = $(PACKAGE)-$(VERSION)-$(ARCH)
+
+# For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT-
+# annotated rpm version strings.
+_ovirt_dev = \
+ $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \
+   $(srcdir)/*.spec.in && echo 1 || :)
+
+git_head    = $$(git log -1 --pretty=format:%h)
+GIT_RELEASE = $(shell date --utc +%Y%m%d%H%M%S)git$(git_head)
+RPMDIR      = $$(rpm --eval '%{_rpmdir}')
+RPM_FLAGS   = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)"
+RPM_FLAGS  += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)")
+NODE_TMP    = $(OVIRT_CACHE_DIR)/$(PACKAGE)-$(ARCH)-tmp
+SRC_KS      = $(NODE_TMP)/src.ks
+NODE_KS     = $(NODE_TMP)/node.ks
+
+all: $(PACKAGE).$(PKG_FMT)
+
+keys:
+	if [ "$(_ovirt_dev)" = 1 -a -f $(AUTH_KEYS) ]; then \
+	    cp -va $(AUTH_KEYS) ovirt-authorized_keys ;\
+	fi
+
+no_nscd:
+	if pgrep -xl nscd; then \
+	    echo "Please stop nscd" ;\
+	    exit 1 ;\
+	fi
+
+SELINUX_ENFORCING=$(shell /usr/sbin/getenforce)
+$(NVR).$(PKG_FMT): no_nscd keys
+	mkdir -p $(NODE_TMP)
+	mkdir -p $(OVIRT_CACHE_DIR)/yum-$(ARCH)
+	( \
+	    case $(SELINUX_ENFORCING) in \
+		Enforcing) sudo /usr/sbin/setenforce Permissive ;; \
+		Permissive) ;; \
+		*) if grep -q '^selinux --disabled' $(OVIRT_NODE_RECIPE); \
+		   then \
+		       echo WARNING: SELinux disabled in kickstart ;\
+		   else \
+		       echo ERROR: SELinux enabled in kickstart, \
+		       but disabled on the build machine ;\
+		       exit 1 ;\
+		   fi ;; \
+	    esac ;\
+	)
+	rm -f $(NODE_KS)
+	if [ "$(_ovirt_dev)" = 1 ]; then \
+	    echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" > $(NODE_KS) ;\
+	fi
+	cat $(OVIRT_NODE_RECIPE) >> $(NODE_KS)
+	sudo livecd-creator --skip-minimize -c  $(NODE_KS)\
+	    -f $(PACKAGE) \
+	    --tmpdir='$(NODE_TMP)' \
+	    --cache='$(OVIRT_CACHE_DIR)/yum-$(ARCH)'
+	sudo chown $${USER} $(PACKAGE).$(PKG_FMT)
+	( \
+	    if [ $(SELINUX_ENFORCING) = Enforcing ]; then \
+		sudo /usr/sbin/setenforce Enforcing || exit 1 ;\
+	    fi \
+	)
+
+	ln -nf $(PACKAGE).$(PKG_FMT) $(NVR).$(PKG_FMT)
+
+$(NVR).$(PKG_FMT).$(SUM): $(NVR).$(PKG_FMT)
+	$(SUM) $(NVR).$(PKG_FMT) > $(NVR).$(PKG_FMT).$(SUM)
+
+$(PACKAGE).$(PKG_FMT) node: $(NVR).$(PKG_FMT).$(SUM)
+
+PUNGI = $(NODE_TMP)/tree/pungi
+
+.PHONY: $(NVR).$(PKG_FMT).$(SUM) $(NVR).$(PKG_FMT) \
+  $(PACKAGE).$(PKG_FMT) keys src.ks no_nscd
-- 
1.6.6.1




More information about the ovirt-devel mailing list