[node-patches] Change in ovirt-node-iso[ovirt-3.5]: Adding the makefile build to ovirt-3.5 branch

tlitovsk at redhat.com tlitovsk at redhat.com
Wed Apr 1 16:42:40 UTC 2015


Anatoly Litovsky has uploaded a new change for review.

Change subject: Adding the makefile build to ovirt-3.5 branch
......................................................................

Adding the makefile build to ovirt-3.5 branch

Change-Id: I9e0062df9ab05e06f9f6cbe13e23eddf3934cfef
Signed-off-by: Tolik Litovsky <tlitovsk at redhat.com>
---
A Makefile.am
A autogen.sh
A configure.ac
D ovirt-node-iso.spec
A ovirt-node-iso.spec.in
A recepie-downloader.sh.in
6 files changed, 414 insertions(+), 140 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node-iso refs/changes/57/39457/1

diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..8f33417
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,153 @@
+# Copyright (C) 2010, 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.
+
+PACKAGE           = @PACKAGE_NAME@
+NAME0             = @MAIN_KS@
+RECIPE            = $(PACKAGE).ks
+PRODUCT           = @PRODUCT_NAME@
+EXTRA_RECIPE      = @EXTRA_RECIPE@
+PRODUCT_SHORT     ?= $(PRODUCT)
+PKG_FMT           = iso
+FEDORA            = @FEDORA@
+RHEL              = @RHEL@
+DISTRO            = @DISTRO@
+BUILD_TYPE        ?= STABLE
+CENTOS            = @CENTOS@
+ARCH              = $(shell rpm --eval '%{_arch}')
+RELEASE           := $(shell rpm -q --qf "%{RELEASE}\n" --define "BUILD_NUMBER $(BUILD_NUMBER)" --specfile ./ovirt-node-iso.spec | head -n1)
+RECIPE_DIR        = @RECIPES@
+OVIRT_VERSION     = @PACKAGE_VERSION@
+REPO_SUFFIX       = @REPO_SUFFIX@
+
+OVIRT_CACHE_DIR ?= $(HOME)/ovirt-caches
+
+EXTRA_DIST = \
+    ovirt-node-iso.spec.in       \
+    ovirt-node-iso.spec          \
+    $(PACKAGE)-$(VERSION)-$(RELEASE).iso
+
+DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \
+                 repos.ks \
+                 Makefile.in \
+                 aclocal.m4 \
+                 autom4te.cache \
+                 configure \
+                 install-sh \
+                 missing \
+                 *.ks
+
+# Need to find node-creator script
+# Default to RECIPE_DIR/node-creator
+# then check local dir
+# then check PATH
+NODE_CREATOR      = $(shell ( test -e $(RECIPE_DIR)/node-creator && echo "$(RECIPE_DIR)/node-creator" ) || ( test -e node-creator && echo "./node-creator" ) || which node-creator 2>/dev/null)
+FEDORA_MIRROR     = http://mirrors.fedoraproject.org/mirrorlist
+OVIRT_BASE_URL    = http://resources.ovirt.org/pub/ovirt-$(REPO_SUFFIX)/rpm
+CENTOS_MIRROR     = http://mirrorlist.centos.org/
+
+# 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-9\.]*999' \
+ $(top_srcdir)/*.spec && echo 1 || :)
+
+rpms: dist
+	rpmbuild --define "BUILD_NUMBER $(BUILD_NUMBER)" $(RPM_FLAGS) -ta $(distdir).tar.gz
+
+srpms: dist
+	rpmbuild --define "BUILD_NUMBER $(BUILD_NUMBER)" $(RPM_FLAGS) -ts $(distdir).tar.gz
+
+publish: rpms
+	mkdir -p $(OVIRT_CACHE_DIR)
+	rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/
+	rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src
+	rsync -aq $(PACKAGE_NAME)-$(VERSION)-$(RELEASE).iso $(OVIRT_CACHE_DIR)/ovirt/binary/
+	createrepo $(OVIRT_CACHE_DIR)/ovirt
+
+
+$(PACKAGE).ks: version.ks
+
+clean_ks:
+	rm -f *.ks
+
+kickstarts: clean_ks node-creator
+	cp $(RECIPE_DIR)/*.ks .
+	rm -f version.ks
+	@test -e "${NAME0}" || ( echo "Error main kickstart file missing - ${NAME0}" && exit 1 )
+
+repos.ks: kickstarts
+	( \
+      if [ -n "$(CENTOS)" ]; then \
+         CENTOS_REPO_LINE="repo --name=centos --mirrorlist=$(CENTOS_MIRROR)?release=$(CENTOS)&arch=${ARCH}&repo=os \n" ;\
+        UPDATES_REPO_LINE="repo --name=centos-updates --mirrorlist=$(CENTOS_MIRROR)?release=$(CENTOS)&arch=${ARCH}&repo=updates \n" ;\
+        EPEL_REPO_LINE="repo --name=epel --baseurl=http://dl.fedoraproject.org/pub/epel/$(CENTOS)/${ARCH} \n" ;\
+        OVIRT_REPO_LINE="repo --name=ovirt-repo --baseurl=$(OVIRT_BASE_URL)/el$(CENTOS)\n" ;\
+        GLUSTER_REPO_LINE="repo --name=ovirt-$(OVIRT_VERSION)-glusterfs-${ARCH}-epel --baseurl=http://download.gluster.org/pub/gluster/glusterfs/nightly/glusterfs/epel-$(CENTOS)-${ARCH}\n" ;\
+        printf "$${CENTOS_REPO_LINE}" > repos.ks ;\
+        printf "$${UPDATES_REPO_LINE}" >> repos.ks ;\
+        printf "$${EPEL_REPO_LINE}" >> repos.ks ;\
+        printf "$${OVIRT_REPO_LINE}" >> repos.ks ;\
+        printf "$${GLUSTER_REPO_LINE}" >> repos.ks ;\
+      elif [ -n "$(FEDORA)" ]; then \
+        OVIRT_REPO_LINE="repo --name=ovirt-stable-repo --baseurl=$(OVIRT_BASE_URL)/fc$(FEDORA)\n" ;\
+        FEDORA_REPO_LOC="repo --name=$${FEDORA_REPO} --mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=$(ARCH)\n" ;\
+        UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates --mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA)&arch=$(ARCH)\n" ;\
+        VIRT_PREVIEW_REPO_LINE="repo --name=$${FEDORA_REPO}-virt-preview --baseurl=https://fedorapeople.org/groups/virt/virt-preview/fedora-$(FEDORA)/$(ARCH)/\n" ;\
+        GLUSTER_REPO_LINE="repo --name=ovirt-$(OVIRT_VERSION)-glusterfs-${ARCH}-epel --baseurl=http://download.gluster.org/pub/gluster/glusterfs/nightly/glusterfs/fedora-$(FEDORA)-${ARCH}\n" ;\
+        printf "$${OVIRT_REPO_LINE}" > repos.ks ;\
+        printf "$${FEDORA_REPO_LOC}" >> repos.ks ;\
+        printf "$${UPDATE_REPO_LINE}" >> repos.ks ;\
+        printf "$${GLUSTER_REPO_LINE}" >> repos.ks ;\
+        fi ;\
+        echo "# OVIRT_REPO_URL=$(OVIRT_REPO_URL)" >> $@ ;\
+        for repo in $(OVIRT_REPO_URL); do \
+          echo "repo --name=repo$${i} --baseurl=$${repo}" >> $@ ;\
+          i=$${i}_ ;\
+        done ;\
+    )
+
+version.ks: repos.ks $(EXTRA_RECEPIE)
+	( \
+        echo "PRODUCT='"$(PRODUCT)"'" ;\
+        echo "PRODUCT_SHORT='"$(PRODUCT_SHORT)"'" ;\
+        echo "PACKAGE=$(PACKAGE)" ;\
+        echo "VERSION=$(VERSION)" ;\
+        echo "RELEASE=$(RELEASE)" ;\
+    ) > $@
+	cat $(NAME0) > tmp-recepie.ks
+if USE_EXTRA_RECIPE
+	echo -e "\n%include $(EXTRA_RECIPE)" >> tmp-recepie.ks
+endif
+	ksflatten -c tmp-recepie.ks -o $(PACKAGE).ks
+	rm -rf tmp-recepie.ks
+
+$(PACKAGE).$(PKG_FMT) iso: kickstarts version.ks repos.ks
+	@test ! -e "$(PACKAGE_NAME)-$(VERSION)-$(RELEASE).iso" || ( echo "ERROR: $(PACKAGE_NAME)-$(VERSION)-$(RELEASE).iso already exists." && exit 1 )
+	$(NODE_CREATOR) $(RECIPE)
+	@test -e "$(PACKAGE_NAME).iso" || ( echo "ERROR: ISO build failed." && exit 1 )
+	mv $(PACKAGE_NAME).iso $(PACKAGE_NAME)-$(VERSION)-$(RELEASE).iso
+
+verrel:
+	@echo ${PACKAGE_NAME}-${VERSION}-${RELEASE}
+
+node-creator:
+	@test -n "${NODE_CREATOR}" || ( echo "No node-creator script found" && exit 1 )
+	@echo "Node Creator script is:  ${NODE_CREATOR}"
+
+all: $(PACKAGE).ks
+
+.PHONY: $(PACKAGE).ks kickstarts
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..cdb1435
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+# Run this to generate configure and Makefile
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+THEDIR=`pwd`
+(
+  cd $srcdir
+  die=0
+
+  (autoconf --version) < /dev/null > /dev/null 2>&1 || {
+	  echo
+	  echo "You must have autoconf installed."
+	  echo "Download the appropriate package for your distribution,"
+	  echo "or see http://www.gnu.org/software/autoconf"
+	  die=1
+  }
+
+  # Require libtool only if one of of LT_INIT,
+  # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac.
+  grep -E '^[[:blank:]]*(LT_INIT|A[CM]_PROG_LIBTOOL)' configure.ac >/dev/null \
+      && {
+    (libtool --version) < /dev/null > /dev/null 2>&1 || {
+	  echo
+	  echo "You must have libtool installed."
+	  echo "Download the appropriate package for your distribution,"
+	  echo "or see http://www.gnu.org/software/libtool"
+	  die=1
+    }
+  }
+
+  (automake --version) < /dev/null > /dev/null 2>&1 || {
+	  echo
+	  die=1
+	  echo "You must have automake installed."
+	  echo "Download the appropriate package for your distribution,"
+	  echo "or see http://www.gnu.org/software/automake"
+  }
+
+  test $die = 1 && exit 1
+
+  test -f ovirt-node-iso.spec.in || {
+	  echo "You must run this script in the top-level directory"
+	  exit 1
+  }
+
+  if test -z "$*"; then
+	  echo "I am going to run ./configure with no arguments - if you wish "
+	  echo "to pass any to it, please specify them on the $0 command line."
+  fi
+
+  aclocal
+
+  # Run autoheader only if needed
+  grep '^[[:blank:]]*AC_CONFIG_HEADERS' configure.ac >/dev/null && autoheader
+
+  automake --add-missing
+  autoconf
+  ./configure "$@"
+)
+
+if test "x$OBJ_DIR" != x; then
+    mkdir -p "$OBJ_DIR"
+    cd "$OBJ_DIR"
+fi
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..579e2f0
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,64 @@
+AC_INIT([ovirt-node], [3.5], [node-devel at ovirt.org])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability tar-pax])
+
+AC_SUBST([FEDORA],[[`rpm --eval '%{fedora}'|sed 's/[^0-9]//g'`]])
+AC_SUBST([RHEL], [[`rpm --eval '%{rhel}'|sed 's/[^0-9]//g'`]])
+AC_SUBST([CENTOS], [[`rpm --eval '%{centos}'|sed 's/[^0-9]//g'`]])
+AC_SUBST([DISTRO])
+AC_SUBST([DISTRO_SHORT])
+AC_SUBST([PACKAGE_NAME])
+AC_SUBST([PRODUCT_NAME])
+AC_SUBST([REPO_SUFFIX])
+REPO_SUFFIX="3.5"
+
+
+if test "$FEDORA"; then
+    DISTRO=ovirt$FEDORA
+    DISTRO_SHORT=fc$FEDORA
+fi
+if test "$RHEL"; then
+    DISTRO=rhevh$RHEL
+    DISTRO_SHORT=el$RHEL
+fi
+if test "$CENTOS"; then
+    DISTRO=centos$CENTOS
+    DISTRO_SHORT=el$CENTOS
+fi
+
+
+
+AC_ARG_WITH([recipe], [AC_HELP_STRING([--with-recipe],
+            [Specify a recipe directory.  Defaults to /usr/share/ovirt-node-recipe])],
+            [RECIPES="$withval"],
+            [RECIPES=/usr/share/ovirt-node-recipe])
+AC_SUBST([RECIPES])
+
+
+AC_ARG_WITH([kickstart], [AC_HELP_STRING([--with-kickstart],
+            [Specify a kickstart file to use.  Defaults to vdsm-plugin-iso.ks])],
+            [MAIN_KS="$withval"],
+            [MAIN_KS=vdsm-plugin-iso.ks])
+AC_SUBST([MAIN_KS])
+
+AC_ARG_WITH([build_number], [AC_HELP_STRING([--with-build-number],
+            [Specify a build number.])],
+            [BUILD_NUMBER="$withval"],
+            [BUILD_NUMBER=$(date +%Y%m%d%H%M)])
+AC_SUBST([BUILD_NUMBER])
+
+AC_ARG_WITH([extra_recipe], [AC_HELP_STRING([--with-extra-recipe],
+            [Specify extra recipe to be used .  Defaults to none])],
+            [EXTRA_RECIPE="$withval"
+            use_extra_recipe=true],
+            [EXTRA_RECIPE="false"])
+AC_SUBST([EXTRA_RECIPE])
+AM_CONDITIONAL([USE_EXTRA_RECIPE],[test x$use_extra_recipe = xtrue])
+
+
+PACKAGE_NAME=ovirt-node-iso
+PRODUCT_NAME=oVirt\ Node\ Hypervisor
+
+AC_CONFIG_FILES([Makefile
+                ovirt-node-iso.spec
+                recepie-downloader.sh])
+AC_OUTPUT
diff --git a/ovirt-node-iso.spec b/ovirt-node-iso.spec
deleted file mode 100644
index b965e39..0000000
--- a/ovirt-node-iso.spec
+++ /dev/null
@@ -1,140 +0,0 @@
-%global product oVirt Node ISO
-%global product_short oVirt Node ISO
-
-%global vdsm_compat 3.5,3.4,3.3,3.2,3.1
-
-%define base_iso http://plain.resources.ovirt.org/pub/ovirt-node-base-3.0/iso/el6/ovirt-node-base-iso-3.0.5-20140522.0.el6.iso
-%define build_release 20140610.0
-
-Name:           ovirt-node-iso
-URL:            http://www.ovirt.org/Node
-Version:        3.5.0
-Release:        %{?build_release}%{?dist}
-Summary:        %{product} ISO Image
-BuildArch:      noarch
-Source1:        %{?base_iso}
-Source2:        generate-repos.sh
-Source3:        verify-meta-file.sh
-
-Group:        Applications/System
-License:      License: AFL and BSD and (BSD or GPLv2+) and BSD with advertising and Boost and GFDL and GPL and GPL+ and (GPL+ or Artistic) and GPLv1+ and GPLv2 and (GPLv2 or BSD) and (GPLv2 or GPLv3) and GPLv2 with exceptions and GPLv2+ and (GPLv2+ or AFL) and GPLv2+ with exceptions and GPLv3 and GPLv3+ and GPLv3+ with exceptions and IJG and ISC and LGPLv2 and LGPLv2+ and (LGPLv2+ or BSD) and (LGPLv2+ or MIT) and LGPLv2+ with exceptions and LGPLv2/GPLv2 and LGPLv3 and LGPLv3+ and MIT and (MIT or LGPLv2+ or BSD) and (MPLv1.1 or GPLv2+ or LGPLv2+) and Open Publication and OpenLDAP and OpenSSL and Public Domain and Python and (Python or ZPLv2.0) and Rdisc and Redistributable, no modification permitted and SISSL and Vim and zlib
-
-BuildRequires:  ovirt-node-tools
-BuildRequires:  libguestfs-tools
-Requires:       rpmdevtools
-
-%define _isoname %name-%version-%{?build_release}
-%define app_root %{_datadir}/%{name}
-
-
-%description
-The iso boot image for %{product}.
-This rpm contains only the iso image.
-
-
-%prep
-export OVER=$(echo %{version} | egrep -o ".{3}" | tr -d .)
-export DIST=$(echo %{dist} | egrep -o "[fe].*")
-bash %SOURCE2 $OVER $DIST > repos-for-edit-node-iso.repo
-
-
-%build
-#
-# Build the Node for Engine ISO by leveraging edit-node
-#
-export INSTALL=ovirt-node-plugin-vdsm,gettext,pm-utils,make
-export UPDATE=glusterfs-libs,glusterfs-api,openssl
-
-edit-node -d -v \
-    --repo repos-for-edit-node-iso.repo \
-    --install $INSTALL,$UPDATE %{source1} \
-    --name %{_isoname}.iso \
-    --output %{buildroot}
-
-
-%install
-%{__install} -d -m0755 %{buildroot}%{app_root}
-%{__install} -p -m0644 %{SOURCE1} %{buildroot}%{app_root}/%{name}-%{version}-%{release}.iso
-echo %{version},%{release} > %{buildroot}%{app_root}/version-%{version}-%{release}.txt
-echo %{vdsm_compat} > %{buildroot}%{app_root}/vdsm-compatibility-%{version}-%{release}.txt
-
-
-%post
-nvr=0
-for ver in %{app_root}/version-*txt; do
-    ver=$(basename $(echo $ver |  sed 's/\.txt//'))
-    if [ "$nvr" = "0" ]; then
-        nvr=$ver
-    else
-        rpmdev-vercmp $nvr $ver >/dev/null 2>&1
-        rc=$?
-        if [ $rc = 12 ]; then
-            nvr=$ver
-        fi
-    fi
-done
-ln -snf %{app_root}/${nvr}.txt  %{app_root}/version.txt
-ln -snf %{app_root}/ovirt-node-iso-${nvr#*-}.iso %{app_root}/%{name}.iso
-if [ -f %{app_root}/vdsm-compatibility-${nvr#*-}.txt ]; then
-    ln -snf %{app_root}/vdsm-compatibility-${nvr#*-}.txt %{app_root}/vdsm-compatibility.txt
-fi
-
-# Extract the metadata file
-virt-cat --add %{_isoname}.iso \
-    /isolinux/version > %{buildroot}/%{app_root}/%{_isoname}.iso.meta
-
-
-%preun
-#first remove all symlinks
-rm %{app_root}/version.txt
-rm %{app_root}/%{name}.iso
-rm -f %{app_root}/vdsm-compatibility.txt
-
-nvr=0
-for ver in %{app_root}/version-*txt; do
-    ver=$(basename $(echo $ver |  sed 's/\.txt//'))
-    if [ "$ver" = "version-%{version}-%{release}" ]; then
-        continue
-    fi
-    if [ "$nvr" = "0" ]; then
-        nvr=$ver
-    else
-        rpmdev-vercmp $nvr $ver >/dev/null 2>&1
-        rc=$?
-        if [ $rc = 12 ]; then
-            nvr=$ver
-        fi
-    fi
-done
-if [ ! "$nvr" = "0" ]; then
-    ln -snf %{app_root}/${nvr}.txt  %{app_root}/version.txt
-    ln -snf %{app_root}/rhevh-${nvr#*-}.iso %{app_root}/%{name}.iso
-    if [ -f %{app_root}/vdsm-compatibility-${nvr#*-}.txt ]; then
-        ln -snf %{app_root}/vdsm-compatibility-${nvr#*-}.txt %{app_root}/vdsm-compatibility.txt
-    fi
-fi
-
-
-%check
-%SOURCE3 %{buildroot}/%{app_root}/%{_isoname}.iso.meta
-
-
-%files
-%defattr(0644,root,root,0755)
-%{app_root}
-%{app_root}/%{_isoname}.iso
-%{app_root}/%{_isoname}.iso.meta
-%{app_root}/version-%{version}-%{release}.txt
-%{app_root}/vdsm-compatibility-%{version}-%{release}.txt
-
-
-%changelog
-* Mon May 12 2014 Fabian Deutsch <fabiand at redhat.com> - 3.4.1-1.0
-- Major upgrade
-- Use edit-node and base images
-
-* Mon Oct 15 2012 Mike Burns <mburns at redhat.com> 2.5.999
-- add vdsm-compatibility version text file to rpm.
-
-* Wed Feb 08 2012 Mike Burns <mburns at redhat.com> 2.2.2-2.2
-- Initial version
diff --git a/ovirt-node-iso.spec.in b/ovirt-node-iso.spec.in
new file mode 100644
index 0000000..bb6fda0
--- /dev/null
+++ b/ovirt-node-iso.spec.in
@@ -0,0 +1,106 @@
+%define product oVirt Node ISO
+%define product_short oVirt Node ISO
+%define product_code ovirt-node-iso
+%define build_counter %(test -n "%{?BUILD_NUMBER}" && echo "%{?BUILD_NUMBER}" || echo @BUILD_NUMBER@ )
+%define vdsm_compat 3.2,3.1
+
+Name:		ovirt-node-iso
+Version:	@VERSION@
+Release:	0.999.%{?build_counter}%{?dist}
+Summary:	%{product} ISO Image
+BuildArch:  noarch
+Source1:    %{product_code}-%{version}-%{release}.iso
+Group:		Applications/System
+License:	License: AFL and BSD and (BSD or GPLv2+) and BSD with advertising and Boost and GFDL and GPL and GPL+ and (GPL+ or Artistic) and GPLv1+ and GPLv2 and (GPLv2 or BSD) and (GPLv2 or GPLv3) and GPLv2 with exceptions and GPLv2+ and (GPLv2+ or AFL) and GPLv2+ with exceptions and GPLv3 and GPLv3+ and GPLv3+ with exceptions and IJG and ISC and LGPLv2 and LGPLv2+ and (LGPLv2+ or BSD) and (LGPLv2+ or MIT) and LGPLv2+ with exceptions and LGPLv2/GPLv2 and LGPLv3 and LGPLv3+ and MIT and (MIT or LGPLv2+ or BSD) and (MPLv1.1 or GPLv2+ or LGPLv2+) and Open Publication and OpenLDAP and OpenSSL and Public Domain and Python and (Python or ZPLv2.0) and Rdisc and Redistributable, no modification permitted and SISSL and Vim and zlib
+URL:		http://ovirt.org/
+BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+
+Requires:	rpmdevtools
+%define app_root %{_datadir}/%{name}
+
+%description
+The iso boot image for %{product}.
+This rpm contains only the iso image.
+
+%prep
+
+%build
+
+%install
+%{__rm} -rf %{buildroot}
+mkdir %{buildroot}
+
+%{__install} -d -m0755 %{buildroot}%{app_root}
+%{__install} -p -m0644 %{SOURCE1} %{buildroot}%{app_root}/%{product_code}-%{version}-%{release}.iso
+echo %{version},%{release} > %{buildroot}%{app_root}/version-%{version}-%{release}.txt
+echo %{vdsm_compat} > %{buildroot}%{app_root}/vdsm-compatibility-%{version}-%{release}.txt
+
+%post
+nvr=0
+for ver in %{app_root}/version-*txt; do
+    ver=$(basename $(echo $ver |  sed 's/\.txt//'))
+    if [ "$nvr" = "0" ]; then
+        nvr=$ver
+    else
+        rpmdev-vercmp $nvr $ver >/dev/null 2>&1
+        rc=$?
+        if [ $rc = 12 ]; then
+            nvr=$ver
+        fi
+    fi
+done
+ln -snf %{app_root}/${nvr}.txt  %{app_root}/version.txt
+ln -snf %{app_root}/ovirt-node-iso-${nvr#*-}.iso %{app_root}/%{name}.iso
+if [ -f %{app_root}/vdsm-compatibility-${nvr#*-}.txt ]; then
+    ln -snf %{app_root}/vdsm-compatibility-${nvr#*-}.txt %{app_root}/vdsm-compatibility.txt
+fi
+
+%preun
+#first remove all symlinks
+rm %{app_root}/version.txt
+rm %{app_root}/%{name}.iso
+rm -f %{app_root}/vdsm-compatibility.txt
+
+nvr=0
+for ver in %{app_root}/version-*txt; do
+    ver=$(basename $(echo $ver |  sed 's/\.txt//'))
+    if [ "$ver" = "version-%{version}-%{release}" ]; then
+        continue
+    fi
+    if [ "$nvr" = "0" ]; then
+        nvr=$ver
+    else
+        rpmdev-vercmp $nvr $ver >/dev/null 2>&1
+        rc=$?
+        if [ $rc = 12 ]; then
+            nvr=$ver
+        fi
+    fi
+done
+if [ ! "$nvr" = "0" ]; then
+    ln -snf %{app_root}/${nvr}.txt  %{app_root}/version.txt
+    ln -snf %{app_root}/rhevh-${nvr#*-}.iso %{app_root}/%{name}.iso
+    if [ -f %{app_root}/vdsm-compatibility-${nvr#*-}.txt ]; then
+        ln -snf %{app_root}/vdsm-compatibility-${nvr#*-}.txt %{app_root}/vdsm-compatibility.txt
+    fi
+fi
+
+%clean
+%{__rm} -rf %{buildroot}
+
+
+%files
+%defattr(0644,root,root,0755)
+%{app_root}
+%{app_root}/%{product_code}-%{version}-%{release}.iso
+%{app_root}/version-%{version}-%{release}.txt
+%{app_root}/vdsm-compatibility-%{version}-%{release}.txt
+
+
+
+%changelog
+* Mon Oct 15 2012 Mike Burns <mburns at redhat.com> 2.5.999
+- add vdsm-compatibility version text file to rpm.
+
+* Wed Feb 08 2012 Mike Burns <mburns at redhat.com> 2.2.2-2.2
+- Initial version
diff --git a/recepie-downloader.sh.in b/recepie-downloader.sh.in
new file mode 100644
index 0000000..ceb4ed3
--- /dev/null
+++ b/recepie-downloader.sh.in
@@ -0,0 +1,25 @@
+#!/bin/bash -xe
+
+DISTRO_SHORT=@DISTRO_SHORT@
+OVIRT_REPO_SUFFIX=@REPO_SUFFIX@
+
+case $1 in
+	"install")
+		sudo yum-config-manager --add-repo "http://resources.ovirt.org/pub/ovirt-$OVIRT_REPO_SUFFIX/rpm/$DISTRO_SHORT"
+		sudo yum install ovirt-node-recipe -y --nogpgcheck
+		sudo yum install ovirt-node-plugin-vdsm-recipe -y --nogpgcheck
+		;;
+	"remove")
+		sudo yum erase ovirt-node-recipe -y
+		sudo yum erase ovirt-node-plugin-vdsm-recipe -y
+		;;
+	"remove-repo")
+		sudo rm -rf /etc/yum.repos.d/resources.ovirt.org*.repo
+		;;
+	*)
+		echo "Usage is :"
+		echo "      install - will create the repo and install recepies"
+		echo "      remove - will remove the recepies"
+		echo "      remove-repo - will remove the ovirt repos from /etc/yum.repos.d"
+		;;
+esac


-- 
To view, visit https://gerrit.ovirt.org/39457
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9e0062df9ab05e06f9f6cbe13e23eddf3934cfef
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node-iso
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Anatoly Litovsky <tlitovsk at redhat.com>



More information about the node-patches mailing list