remove big /usr/sbin binaries
[ovirt-node-image.git] / release.mk
blobb89bd8678b915f41e99a0d9cd5624d357b480e4a
1 # Release/version-related Makefile variables and rules.
2 # It expects the including Makefile to define the "pkg_name"
3 # variable, as well as a file named "version" in the current directory.
5 ARCH := $(shell uname -i)
6 VERSION := $(shell awk '{ print $$1 }' version)
7 RELEASE := $(shell awk '{ print $$2 }' version)
8 NEWVERSION = $$(awk 'BEGIN { printf "%.2f", $(VERSION) + .01 }')
9 NEWRELEASE = $$(($(RELEASE) + 1))
10 X = $$(awk '{ split($$2,r,"."); \
11 printf("%d.%d\n", r[1], r[2]+1) }' version)
12 git_head = $$(git log -1 --pretty=format:%h)
13 GITRELEASE = $(X).$$(date --utc +%Y%m%d%H%M)git$(git_head)
14 DIST = $$(rpm --eval '%{dist}')
16 SPEC_FILE = $(pkg_name).spec
18 OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache
20 NV = $(pkg_name)-$(VERSION)
21 RPM_FLAGS = \
22 --define "_topdir %(pwd)/rpm-build" \
23 --define "_builddir %{_topdir}" \
24 --define "_rpmdir %{_topdir}" \
25 --define "_srcrpmdir %{_topdir}" \
26 --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
27 --define "_specdir %{_topdir}" \
28 --define "_sourcedir %{_topdir}" \
29 --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)"
31 bumpgit:
32 echo "$(VERSION) $(GITRELEASE)" > version
34 bumprelease:
35 echo "$(VERSION) $(NEWRELEASE)" > version
37 bumpversion:
38 echo "$(NEWVERSION) 1" > version
40 setversion:
41 echo "$(VERSION) $(RELEASE)" > version
43 new-rpms: bumprelease rpms
45 rpms: tar
46 rpmbuild $(RPM_FLAGS) -ba $(SPEC_FILE)
48 publish: rpms
49 rm -f $(OVIRT_CACHE_DIR)/ovirt/$(pkg_name)*
50 mkdir -p $(OVIRT_CACHE_DIR)/ovirt
51 cp -a rpm-build/$(pkg_name)*.rpm $(OVIRT_CACHE_DIR)/ovirt
52 createrepo $(OVIRT_CACHE_DIR)/ovirt
54 .PHONY: rpms new-rpms publish setversion bumprelease bumpversion bumpgit