-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
51 lines (38 loc) · 1.34 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
PACKAGE_BUCKET_NAME ?= packages.example.com
PROJECT_NAME ?= s3yum-updater
SPEC ?= $(PROJECT_NAME).spec
SOURCES := ./*.{py,init,md} ./LICENSE
RPMDIR ?= $(CURDIR)/dist
BUILDDIR ?= $(CURDIR)/build
DEFINES = \
--define '_topdir $(CURDIR)' \
--define '_rpmtopdir $(CURDIR)' \
--define '_specdir $(CURDIR)' \
--define '_rpmdir $(RPMDIR)' \
--define '_srcrpmdir $(RPMDIR)' \
--define '_sourcedir $(RPMDIR)' \
--define '_builddir $(CURDIR)' \
--define '_buildrootdir $(BUILDDIR)'
RPM_BUILDNAME := $(shell rpm --eval '%{_build_name_fmt}')
RPM ?= $(RPMDIR)/$(shell rpm --specfile $(SPEC) -q --qf '$(RPM_BUILDNAME)\n' $(DEFINES))
SOURCE0_URL ?= $(word 2, $(shell spectool -l -s 0 $(DEFINES) $(SPEC)))
SOURCE0 ?= $(RPMDIR)/$(shell basename $(SOURCE0_URL))
.PHONY: rpm test install clean aws-resources
rpm: $(RPM)
test: $(RPM)
@python test.py
install: $(RPM)
sudo yum localinstall $<
clean:
$(RM) -r $(SOURCE0) $(RPM) $(RPMDIR) $(BUILDDIR)
$(RPM): $(SPEC) $(SOURCE0)
rpmbuild $(DEFINES) --clean -bb $<
$(SOURCE0): $(RPMDIR)
tar -c --transform 's,^\.,$(PROJECT_NAME)-master,' -f $@ $(SOURCES)
$(RPMDIR):
@mkdir $@
aws-resources: docs/cloudformation.json
aws cloudformation create-stack --stack-name packages \
--template-body "`cat $<`" \
--capabilities CAPABILITY_IAM \
--parameters "ParameterKey=PackageBucketName,ParameterValue=$(PACKAGE_BUCKET_NAME)"