2016-11-18 06:21:20 +08:00
|
|
|
# Makefile for constructing RPMs.
|
|
|
|
# Try "make" (for SRPMS) or "make rpm"
|
|
|
|
|
|
|
|
NAME = ceph-ansible
|
2016-12-13 05:20:47 +08:00
|
|
|
VERSION := $(shell git describe --tags --abbrev=0 --match 'v*' | sed 's/^v//')
|
2016-11-18 06:21:20 +08:00
|
|
|
COMMIT := $(shell git rev-parse HEAD)
|
|
|
|
SHORTCOMMIT := $(shell echo $(COMMIT) | cut -c1-7)
|
|
|
|
RELEASE := $(shell git describe --tags --match 'v*' \
|
|
|
|
| sed 's/^v//' \
|
|
|
|
| sed 's/^[^-]*-//' \
|
|
|
|
| sed 's/-/./')
|
|
|
|
ifeq ($(VERSION),$(RELEASE))
|
2017-03-08 02:11:53 +08:00
|
|
|
RELEASE = 1
|
2016-11-18 06:21:20 +08:00
|
|
|
endif
|
|
|
|
NVR := $(NAME)-$(VERSION)-$(RELEASE).el7
|
|
|
|
|
|
|
|
all: srpm
|
|
|
|
|
|
|
|
# Testing only
|
|
|
|
echo:
|
|
|
|
echo COMMIT $(COMMIT)
|
|
|
|
echo VERSION $(VERSION)
|
|
|
|
echo RELEASE $(RELEASE)
|
|
|
|
echo NVR $(NVR)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf dist/
|
|
|
|
rm -rf ceph-ansible-$(VERSION)-$(SHORTCOMMIT).tar.gz
|
|
|
|
rm -rf $(NVR).src.rpm
|
|
|
|
|
|
|
|
dist:
|
|
|
|
git archive --format=tar.gz --prefix=ceph-ansible-$(VERSION)/ HEAD > ceph-ansible-$(VERSION)-$(SHORTCOMMIT).tar.gz
|
|
|
|
|
|
|
|
spec:
|
|
|
|
sed ceph-ansible.spec.in \
|
|
|
|
-e 's/@COMMIT@/$(COMMIT)/' \
|
|
|
|
-e 's/@VERSION@/$(VERSION)/' \
|
|
|
|
-e 's/@RELEASE@/$(RELEASE)/' \
|
|
|
|
> ceph-ansible.spec
|
|
|
|
|
|
|
|
srpm: dist spec
|
|
|
|
fedpkg --dist epel7 srpm
|
|
|
|
|
|
|
|
rpm: dist srpm
|
|
|
|
mock -r epel-7-x86_64 rebuild $(NVR).src.rpm \
|
|
|
|
--resultdir=. \
|
|
|
|
--define "dist .el7"
|
|
|
|
|
|
|
|
.PHONY: dist rpm srpm
|