diff --git a/Makefile b/Makefile index a4ed1a5..53e01eb 100644 --- a/Makefile +++ b/Makefile @@ -7,10 +7,12 @@ DIST ?= el8 BASE := "https://github.com/ceph/ceph" BRANCH := $(shell git rev-parse --abbrev-ref HEAD | cut -d'-' -f5) LAST_VERSION ?= $(shell cat SPECS/cephadm.spec.in | awk '/Version/ { print $$2}') +LAST_RELEASE ?= $(shell cat SPECS/cephadm.spec.in | awk '/Release/ {print $$2}' | cut -d'%' -f1) LOCALHASH := $(shell cat SPECS/cephadm.spec.in | awk '/Source0/ { print $$2}' | cut -d'/' -f7) -RELEASE ?= $(shell cat SPECS/cephadm.spec.in | awk '/Release/ {print $$2}' | cut -d'%' -f1) SPECTOOL :=$(shell which spectool) RPMBUILD :=$(shell which rpmbuild) +RELEASE := $(if $(RELEASE),$(RELEASE),$(LAST_RELEASE)) +VERSION := $(if $(VERSION),$(VERSION),$(LAST_VERSION)) NVR := $(NAME)-$(VERSION)-$(RELEASE).$(DIST) @@ -18,7 +20,6 @@ all: spec src srpm pre: ## Get the last remote hash for the specified branch $(eval REMOTEHASH := $(shell git ls-remote $(BASE) $(BRANCH) | awk '{print $$1}')) - $(eval LAST_RELEASE ?= $(shell cat SPECS/cephadm.spec.in | awk '/Release/ {print $$2}' | cut -d'%' -f1)) $(eval RELEASE=$(shell echo $$(($(RELEASE)+1)))) echo: pre ## Print the passed (or computed) parameters @@ -26,9 +27,9 @@ echo: pre ## Print the passed (or computed) parameters @echo BASE $(BASE) @echo BRANCH $(BRANCH) @echo CURRENT VERSION $(LAST_VERSION) + @echo NEXT VERSION $(VERSION) @echo REMOTE HASH $(REMOTEHASH) @echo LOCAL HASH $(LOCALHASH) - $(eval RELEASE=$(shell echo $$(($(RELEASE)+1)))) @echo RELEASE $(RELEASE) spec: pre ## Patch and build the cephadm spec file @@ -49,7 +50,7 @@ srpm: ## Build the srpm --define "dist .$(DIST)" clean: ## Clean the workdir - rm -f $(NVR).src.rpm + rm -f *.src.rpm rm -f SPECS/cephadm.spec help: ## Print the Help