1 # Copyright (C) 2008 Red Hat, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; version 2 of the License.
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
12 # You should have received a copy of the GNU General Public License
13 # along with this program; if not, write to the Free Software
14 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
15 # MA 02110-1301, USA. A copy of the GNU General Public License is
16 # also available at http://www.gnu.org/copyleft/gpl.html.
18 OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache
22 ovirt-node-image.spec \
23 ovirt-node-image.spec.in \
34 # For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT-
35 # annotated rpm version strings.
37 $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \
38 $(srcdir)/*.spec.in && echo 1 || :)
40 git_head = $$(git log -1 --pretty=format:%h)
41 GIT_RELEASE = $$(date --utc +%Y%m%d%H%M%S)git$(git_head)
42 RPMDIR = $$(rpm --eval '%{_rpmdir}')
43 RPM_FLAGS = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)"
44 RPM_FLAGS += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)")
45 # FEDORA_URL env var can be set to the root of a fedora mirror
46 RPM_FLAGS += $(if $(FEDORA_URL),--define "fedora_url $(FEDORA_URL)")
47 # OVIRT_URL env var can be set to the root of an ovirt.org mirror
48 RPM_FLAGS += $(if $(OVIRT_URL),--define "ovirt_url $(OVIRT_URL)")
51 rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz
54 mkdir -p $(OVIRT_CACHE_DIR)
55 rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/
56 rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src
57 createrepo $(OVIRT_CACHE_DIR)/ovirt