[Ovirt-devel] [PATCH appliance] Move appliance creation out of spec file to Makefile
Perry Myers
pmyers at redhat.com
Fri Nov 14 22:06:54 UTC 2008
The appliance-creator RPM is now just used to store the
create-ovirt-appliance script and contains dependencies for
installing and running the appliance.
The appliance is also modified to be packaged in tar.bz2 format with
raw disks.
Signed-off-by: Perry Myers <pmyers at redhat.com>
---
Makefile.am | 111 ++++++++++++++++++++++++++++++++++++++++------
ovirt-appliance.spec.in | 71 ++----------------------------
2 files changed, 101 insertions(+), 81 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index b464da0..4b96624 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,16 +16,30 @@
# 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_URL ?= http://ovirt.org/repos/ovirt
+THINCRUST_URL ?= http://thincrust.org/repo
+PKG_FMT = tar
+DISK_FMT ?= qcow2
+SUM ?= sha1sum
+APP_RAM ?= 768
+
+FEDORA = $(shell rpm --eval '%{fedora}')
+ARCH = $(shell rpm --eval '%{_arch}')
+
+NVR = $(PACKAGE)-$(VERSION)-$(ARCH)
EXTRA_DIST = \
.gitignore \
- create-ovirt-appliance \
+ create-$(PACKAGE) \
gettree.sh \
- ovirt-appliance.ks \
- ovirt-appliance.spec \
- ovirt-appliance.spec.in
+ $(PACKAGE).ks \
+ $(PACKAGE).spec \
+ $(PACKAGE).spec.in
-DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz
+DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \
+ $(NVR).$(PKG_FMT) \
+ $(NVR).$(PKG_FMT).$(SUM)
# For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT-
# annotated rpm version strings.
@@ -38,15 +52,82 @@ GIT_RELEASE = $$(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)")
-# FEDORA_URL env var can be set to the root of a fedora mirror
-RPM_FLAGS += $(if $(FEDORA_URL),--define "fedora_url $(FEDORA_URL)")
-# OVIRT_URL env var can be set to the root of an ovirt.org mirror
-RPM_FLAGS += $(if $(OVIRT_URL),--define "ovirt_url $(OVIRT_URL)")
-# THINCRUST_URL env var can be set to the root of an thincrust.net mirror
-# FIXME: This is temporary until thincrust RPMS are in Fedora 9 Updates
-RPM_FLAGS += $(if $(THINCRUST_URL),--define "thincrust_url $(THINCRUST_URL)")
-
-rpms: dist
+
+FEDORA_MIRROR = http://mirrors.fedoraproject.org/mirrorlist
+FEDORA_URL_DEF = http://download.fedoraproject.org/pub/fedora/linux
+CUR_RAWHIDE = 10
+
+repos.ks:
+ ( \
+ if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \
+ FEDORA_REPO=rawhide ;\
+ FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide&arch=$(ARCH))" ;\
+ OVIRT_DISTRO=development ;\
+ else \
+ FEDORA_REPO=f$(FEDORA) ;\
+ FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=$(ARCH))" ;\
+ OVIRT_DISTRO=$(FEDORA) ;\
+ UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates-newkey $(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/updates/$(FEDORA)/$(ARCH).newkey,--mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA).newkey&arch=$(ARCH))" ;\
+ fi ;\
+ echo "repo --name=$${FEDORA_REPO} $${FEDORA_REPO_LOC}" > $@ ;\
+ echo "repo --name=ovirt-org --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/$(ARCH)" >> $@ ;\
+ echo "repo --name=thincrust-org --baseurl=$(THINCRUST_URL)/noarch" >> $@ ;\
+ echo "$${UPDATE_REPO_LINE}" >> $@ ;\
+ echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \
+ )
+
+SELINUX_ENFORCING=$(shell /usr/sbin/getenforce)
+$(NVR).$(PKG_FMT): repos.ks
+ mkdir -p $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree
+ mkdir -p $(OVIRT_CACHE_DIR)/yum
+ ( \
+ case $(SELINUX_ENFORCING) in \
+ Enforcing) sudo /usr/sbin/setenforce Permissive ;; \
+ Permissive) ;; \
+ *) if ksflatten $(PACKAGE).ks 2>/dev/null \
+ | grep -q '^selinux --disabled'; then \
+ echo WARNING: SELinux disabled in kickstart ;\
+ else \
+ echo ERROR: SELinux enabled in kickstart, \
+ but disabled on the build machine ;\
+ exit 1 ;\
+ fi ;; \
+ esac ;\
+ if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \
+ FEDORA_TREE_URL="$(if $(FEDORA_URL),$(FEDORA_URL)/development/$(ARCH)/os,$(FEDORA_URL_DEF)/development/$(ARCH)/os)" ;\
+ else \
+ FEDORA_TREE_URL="$(if $(FEDORA_URL),$(FEDORA_URL)/releases/$(FEDORA)/Fedora/$(ARCH)/os,$(FEDORA_URL_DEF)/releases/$(FEDORA)/Fedora/$(ARCH)/os)" ;\
+ fi ;\
+ ./gettree.sh $${FEDORA_TREE_URL} $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp/tree ;\
+ )
+
+ mkdir -p scripts
+ cp -a create-$(PACKAGE) scripts
+
+ ln -snf $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp tmp
+ sudo su -c "export PATH=$(PATH):/sbin:/usr/sbin && \
+ appliance-creator --config $(PACKAGE).ks \
+ --name $(PACKAGE) -f $(DISK_FMT) -p $(PKG_FMT) -d -v \
+ --tmpdir='$(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp' \
+ --cache='$(OVIRT_CACHE_DIR)/yum' \
+ --vmem=$(APP_RAM) \
+ -i scripts"
+ sudo chown $${USER} $(PACKAGE).$(PKG_FMT)
+ ( \
+ if [ $(SELINUX_ENFORCING) = Enforcing ]; then \
+ sudo /usr/sbin/setenforce Enforcing || exit 1 ;\
+ fi \
+ )
+
+ mv $(PACKAGE).$(PKG_FMT) $(NVR).$(PKG_FMT)
+ rm -Rf scripts
+
+$(NVR).$(PKG_FMT).$(SUM): $(NVR).$(PKG_FMT)
+ $(SUM) $(NVR).$(PKG_FMT) > $(NVR).$(PKG_FMT).$(SUM)
+
+appliance: $(NVR).$(PKG_FMT).$(SUM)
+
+rpms: dist appliance
rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz
publish: rpms
@@ -55,4 +136,4 @@ publish: rpms
rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src/
createrepo $(OVIRT_CACHE_DIR)/ovirt
-.PHONY: rpms publish
+.PHONY: rpms publish $(NVR).$(PKG_FMT).$(SUM) $(NVR).$(PKG_FMT)
diff --git a/ovirt-appliance.spec.in b/ovirt-appliance.spec.in
index f73c764..c35530b 100644
--- a/ovirt-appliance.spec.in
+++ b/ovirt-appliance.spec.in
@@ -1,12 +1,3 @@
-%{!?ovirt_cache_dir: %define ovirt_cache_dir /var/tmp/ovirt-cache}
-%{!?ovirt_local_repo: %define ovirt_local_repo file://%{ovirt_cache_dir}/ovirt}
-%{!?ovirt_url: %define ovirt_url http://ovirt.org/repos/ovirt}
-%{!?thincrust_url: %define thincrust_url http://www.thincrust.net/repo}
-%{?fedora_url: %define fedora_tree_url %{fedora_url}/releases/%{fedora}/Fedora/%{_arch}/os}
-%{!?fedora_tree_url: %define fedora_tree_url http://download.fedoraproject.org/pub/fedora/linux/releases/%{fedora}/Fedora/%{_arch}/os}
-%{!?bad_pkgs: %define bad_pkgs ""}
-%define fedora_mirror http://mirrors.fedoraproject.org/mirrorlist
-
Summary: oVirt Appliance
Name: ovirt-appliance
Version: @VERSION@
@@ -15,13 +6,8 @@ Source0: %{name}-%{version}.tar.gz
License: GPLv2+
Group: Applications/System
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+BuildArch: noarch
URL: http://ovirt.org/
-BuildRequires: appliance-tools >= 003-6
-BuildRequires: appliance-os
-BuildRequires: livecd-tools >= 019
-BuildRequires: syslinux
-BuildRequires: qemu-img
-BuildRequires: wget
# FIXME: libvirt and kvm require ovirt specific patches presently due to
# the fact that migration has not been fixed upstream. Once upstream migration
# is fixed, these Requires should be fixed.
@@ -36,59 +22,12 @@ Requires: augeas
%define debug_package %{nil}
%description
-The oVirt Appliance image and scripts to install on a Fedora Host
+The oVirt Appliance scripts to install on a Fedora Host
%prep
%setup -q
%build
-%if 0%{?fedora} == 010
- # XXX current rawhide
- %if "%{?fedora_url}" == ""
-cat > repos.ks << EOF
-repo --name=rawhide --mirrorlist=%{fedora_mirror}?repo=rawhide&arch=%{_arch}
-EOF
- %else
-cat > repos.ks << EOF
-repo --name=rawhide --baseurl=%{fedora_url}/development/%{_arch}/os
-EOF
- %endif
-cat >> repos.ks << EOF
-repo --name=ovirt-org --baseurl=%{ovirt_url}/development/%{_arch}
-EOF
-%else
- %if "%{?fedora_url}" == ""
-cat > repos.ks << EOF
-repo --name=f%{fedora} --mirrorlist=%{fedora_mirror}?repo=fedora-%{fedora}&arch=%{_arch}
-repo --name=f%{fedora}-updates-newkey --mirrorlist=%{fedora_mirror}?repo=updates-released-f%{fedora}.newkey&arch=%{_arch} --excludepkgs=%{bad_pkgs}
-EOF
- %else
-cat > repos.ks << EOF
-repo --name=f%{fedora} --baseurl=%{fedora_url}/releases/%{fedora}/Everything/%{_arch}/os
-repo --name=f%{fedora}-updates-newkey --baseurl=%{fedora_url}/updates/%{fedora}/%{_arch}.newkey --excludepkgs=%{bad_pkgs}
-EOF
- %endif
-cat >> repos.ks << EOF
-repo --name=ovirt-org --baseurl=%{ovirt_url}/%{fedora}/%{_arch}
-EOF
-%endif
-
-cat >> repos.ks << EOF
-repo --name=ovirt-local --baseurl=%{ovirt_local_repo}
-repo --name=thincrust-org --baseurl=%{thincrust_url}/noarch
-
-EOF
-
-mkdir -p %{ovirt_cache_dir}/appliance-tmp/tree
-mkdir -p %{ovirt_cache_dir}/yum
-./gettree.sh %{fedora_tree_url} %{ovirt_cache_dir}/appliance-tmp/tree
-ln -s %{ovirt_cache_dir}/appliance-tmp tmp
-sudo su - -c "cd $(pwd) && appliance-creator --config ovirt-appliance.ks \
- --name %{name} -f qcow2 -d -v \
- --tmpdir='%{ovirt_cache_dir}/appliance-tmp' \
- --cache='%{ovirt_cache_dir}/yum'"
-sudo su - -c "cd $(pwd) && chown -R $USER ."
-mv %{name}/%{name}-sda.qcow2 %{name}.img
%install
%{__rm} -rf %{buildroot}
@@ -96,8 +35,6 @@ mkdir %{buildroot}
%{__install} -d -m0755 %{buildroot}%{app_root}
%{__install} -p -m0644 COPYING %{buildroot}%{app_root}
-%{__install} -d -m0755 %{buildroot}%{_localstatedir}/lib/libvirt/images
-%{__install} -p -m0644 %{name}.img %{buildroot}%{_localstatedir}/lib/libvirt/images
%{__install} -d -m0755 %{buildroot}%{_sbindir}
%{__install} -p -m0755 create-%{name} %{buildroot}%{_sbindir}
@@ -107,11 +44,13 @@ mkdir %{buildroot}
%files
%defattr(-,root,root,0644)
%{app_root}/COPYING
-%{_localstatedir}/lib/libvirt/images/%{name}.img
%defattr(-,root,root,0755)
%{_sbindir}/create-%{name}
%changelog
+* Wed Nov 05 2008 Perry Myers <pmyers at redhat.com> 0.96
+- Removed appliance building from rpm. RPM now just contains tools to
+ download image and install it
* Sun Sep 14 2008 Perry Myers <pmyers at redhat.com> 0.92-1
- Added Requires on libvirt/kvm
* Fri Sep 05 2008 Perry Myers <pmyers at redhat.com> 0.92-1
--
1.6.0.3
More information about the ovirt-devel
mailing list