|
|
84c41e |
# Makefile for constructing RPMs.
|
|
|
84c41e |
|
|
|
84c41e |
SHELL := bash
|
|
|
84c41e |
.SHELLFLAGS := -eu -o pipefail -c
|
|
|
84c41e |
NAME = cephadm
|
|
|
84c41e |
DIST ?= el8
|
|
|
84c41e |
BASE := "https://github.com/ceph/ceph"
|
|
|
84c41e |
BRANCH := "octopus"
|
|
|
84c41e |
VERSION ?= $(shell cat SPECS/cephadm.spec.in | awk '/Version/ { print $$2}')
|
|
|
84c41e |
LOCALHASH := $(shell cat SPECS/cephadm.spec.in | awk '/Source0/ { print $$2}' | cut -d'/' -f7)
|
|
|
84c41e |
RELEASE ?= $(shell cat SPECS/cephadm.spec.in | awk '/Release/ {print $$2}' | cut -d'%' -f1)
|
|
|
84c41e |
# TODO: Make remote hash parametric
|
|
|
84c41e |
REMOTEHASH := $(shell git ls-remote "https://github.com/ceph/ceph" "octopus" | awk '{print $$1}')
|
|
|
84c41e |
SPECTOOL :=$(shell which spectool)
|
|
|
84c41e |
RPMBUILD :=$(shell which rpmbuild)
|
|
|
84c41e |
|
|
|
84c41e |
NVR := $(NAME)-$(VERSION)-$(RELEASE).$(DIST)
|
|
|
84c41e |
|
|
|
84c41e |
all: spec src srpm
|
|
|
84c41e |
|
|
|
84c41e |
pre:
|
|
|
84c41e |
|
|
|
84c41e |
echo: ## Print the passed (or computed) parameters
|
|
|
84c41e |
echo PWD $(PWD)/SOURCES
|
|
|
84c41e |
echo BASE $(BASE)
|
|
|
84c41e |
echo BRANCH $(BRANCH)
|
|
|
84c41e |
echo CURRENT VERSION $(VERSION)
|
|
|
84c41e |
echo REMOTE HASH $(REMOTEHASH)
|
|
|
84c41e |
echo LOCAL HASH $(LOCALHASH)
|
|
|
84c41e |
$(eval RELEASE=$(shell echo $$(($(RELEASE)+1))))
|
|
|
84c41e |
echo RELEASE $(RELEASE)
|
|
|
84c41e |
|
|
|
84c41e |
spec: ## Patch and build the cephadm spec file
|
|
|
84c41e |
sed SPECS/cephadm.spec.in \
|
|
|
84c41e |
-e "s/$(LOCALHASH)/$(REMOTEHASH)/" \
|
|
|
84c41e |
-e 's/@VERSION@/$(VERSION)/' \
|
|
|
84c41e |
-e 's/@RELEASE@/$(RELEASE)/' \
|
|
|
84c41e |
> SPECS/cephadm.spec
|
|
|
84c41e |
cp SPECS/cephadm.spec SPECS/cephadm.spec.in
|
|
|
84c41e |
|
|
|
84c41e |
src: ## Download the cephadm sources according to the last hash
|
|
|
84c41e |
$(SPECTOOL) -g SPECS/cephadm.spec -C SOURCES -f
|
|
|
84c41e |
|
|
|
84c41e |
srpm: ## Build the srpm
|
|
|
84c41e |
rpmbuild -bs $(PWD)/SPECS/cephadm.spec \
|
|
|
84c41e |
--define "_sourcedir $(PWD)/SOURCES" \
|
|
|
84c41e |
--define "_srcrpmdir $(PWD)" \
|
|
|
84c41e |
--define "dist .$(DIST)"
|
|
|
84c41e |
|
|
|
84c41e |
clean: ## Clean the workdir
|
|
|
84c41e |
rm -f $(NVR).src.rpm
|
|
|
84c41e |
rm -f SPECS/cephadm.spec
|
|
|
84c41e |
|
|
|
84c41e |
help: ## Print the Help
|
|
|
84c41e |
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
|
84c41e |
|
|
|
84c41e |
.PHONY: all
|