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
19 OVIRT_LOCAL_REPO ?= file://$(OVIRT_CACHE_DIR)/ovirt
20 OVIRT_URL ?= http://ovirt.org/repos/ovirt
23 AUTH_KEYS ?= ~/.ssh/authorized_keys
25 FEDORA_MIRROR = http://mirrors.fedoraproject.org/mirrorlist
28 FEDORA = $(shell rpm --eval '%{fedora}')
29 ARCH = $(shell rpm --eval '%{_arch}')
31 NVR = $(PACKAGE)-$(VERSION)-$(ARCH)
46 create-ovirt-iso-nodes \
50 DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \
51 $(PACKAGE).$(PKG_FMT) \
53 $(NVR).$(PKG_FMT).$(SUM) \
54 repos.ks ovirt-authorized_keys
56 # For Release: 0..., set _ovirt_dev=1 so that we get extra_release.GIT-
57 # annotated rpm version strings.
59 $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \
60 $(srcdir)/*.spec.in && echo 1 || :)
62 git_head = $$(git log -1 --pretty=format:%h)
63 GIT_RELEASE = $(shell date --utc +%Y%m%d%H%M%S)git$(git_head)
64 RPMDIR = $$(rpm --eval '%{_rpmdir}')
65 RPM_FLAGS = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)"
66 RPM_FLAGS += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)")
70 if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \
71 FEDORA_REPO=rawhide ;\
72 FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide&arch=$(ARCH))" ;\
73 OVIRT_DISTRO=development ;\
75 FEDORA_REPO=f$(FEDORA) ;\
76 FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/${ARCH}/os,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=$(ARCH))" ;\
77 OVIRT_DISTRO=$(FEDORA) ;\
78 UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates $(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/updates/$(FEDORA)/${ARCH},--mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA)&arch=$(ARCH))" ;\
80 echo "repo --name=$${FEDORA_REPO} $${FEDORA_REPO_LOC}" > $@ ;\
81 echo "repo --name=ovirt-org --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/$(ARCH)" >> $@ ;\
82 echo "$${UPDATE_REPO_LINE}" >> $@ ;\
83 echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \
87 if [ "$(_ovirt_dev)" = 1 -a -f $(AUTH_KEYS) ]; then \
88 cp -va $(AUTH_KEYS) ovirt-authorized_keys ;\
91 SELINUX_ENFORCING=$(shell /usr/sbin/getenforce)
92 $(NVR).$(PKG_FMT): repos.ks keys
93 mkdir -p $(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp
94 mkdir -p $(OVIRT_CACHE_DIR)/yum
96 case $(SELINUX_ENFORCING) in \
97 Enforcing) sudo /usr/sbin/setenforce Permissive ;; \
99 *) if ksflatten $(PACKAGE).ks 2>/dev/null \
100 | grep -q '^selinux --disabled'; then \
101 echo WARNING: SELinux disabled in kickstart ;\
103 echo ERROR: SELinux enabled in kickstart, \
104 but disabled on the build machine ;\
109 sudo livecd-creator --skip-minimize -c $(PACKAGE).ks \
111 --tmpdir='$(OVIRT_CACHE_DIR)/$(PACKAGE)-tmp' \
112 --cache='$(OVIRT_CACHE_DIR)/yum'
113 sudo chown $${USER} $(PACKAGE).$(PKG_FMT)
115 if [ $(SELINUX_ENFORCING) = Enforcing ]; then \
116 sudo /usr/sbin/setenforce Enforcing || exit 1 ;\
120 ln -nf $(PACKAGE).$(PKG_FMT) $(NVR).$(PKG_FMT)
122 $(NVR).$(PKG_FMT).$(SUM): $(NVR).$(PKG_FMT)
123 $(SUM) $(NVR).$(PKG_FMT) > $(NVR).$(PKG_FMT).$(SUM)
125 $(PACKAGE).$(PKG_FMT) node: $(NVR).$(PKG_FMT).$(SUM)
128 rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz
129 rpmbuild $(RPM_FLAGS) --define "source_iso 1" -tb $(distdir).tar.gz
132 mkdir -p $(OVIRT_CACHE_DIR)
133 rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/
134 rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src
135 createrepo $(OVIRT_CACHE_DIR)/ovirt
137 .PHONY: rpms publish $(NVR).$(PKG_FMT).$(SUM) $(NVR).$(PKG_FMT) \
138 $(PACKAGE).$(PKG_FMT) keys repos.ks