forked from ClusterLabs/sbd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.am
52 lines (42 loc) · 1.66 KB
/
Makefile.am
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
52
SUBDIRS = src agent man
# .gz because github doesn't support .xz yet :-(
TAG ?= $(shell git log --pretty="format:%H" -n 1)
distdir = $(PACKAGE)-$(TAG)
TARFILE = $(distdir).tar.gz
DIST_ARCHIVES = $(TARFILE)
RPM_ROOT = $(shell pwd)
RPM_OPTS = --define "_sourcedir $(RPM_ROOT)" \
--define "_specdir $(RPM_ROOT)" \
--define "_srcrpmdir $(RPM_ROOT)"
MOCK_TARGET ?= rhel-7.1-candidate-x86_64
MOCK_OPTIONS ?= --resultdir=$(RPM_ROOT)/mock --no-cleanup-after
BUILD_COUNTER ?= build.counter
LAST_COUNT = $(shell test ! -e $(BUILD_COUNTER) && echo 0; test -e $(BUILD_COUNTER) && cat $(BUILD_COUNTER))
COUNT = $(shell expr 1 + $(LAST_COUNT))
export:
rm -f $(PACKAGE)-HEAD.tar.*
if [ -f $(TARFILE) ]; then \
echo `date`: Using existing tarball: $(TARFILE); \
else \
rm -f $(PACKAGE).tar.*; \
git archive --prefix=$(distdir)/ $(TAG) | gzip > $(TARFILE); \
echo `date`: Rebuilt $(TARFILE); \
fi
srpm: export
rm -f *.src.rpm
sed -i 's/global\ commit.*/global\ commit\ $(TAG)/' $(PACKAGE).spec
if [ -e $(BUILD_COUNTER) ]; then \
sed -i 's/global\ buildnum.*/global\ buildnum\ $(COUNT)/' $(PACKAGE).spec; \
echo $(COUNT) > $(BUILD_COUNTER); \
fi
rpmbuild $(RPM_OPTS) -bs $(PACKAGE).spec
rpm: export
rpmbuild $(RPM_OPTS) -ba $(PACKAGE).spec
mock: srpm
-rm -rf $(RPM_ROOT)/mock
@echo "mock --root=$* --rebuild $(MOCK_OPTIONS) $(RPM_ROOT)/*.src.rpm"
mock --root=$(MOCK_TARGET) --rebuild $(MOCK_OPTIONS) $(RPM_ROOT)/*.src.rpm
beekhof: mock
cluster-helper -- 'rm -f sbd-*.x86_64.rpm'
cluster-helper --copy $(RPM_ROOT)/mock/sbd-*.x86_64.rpm {}:
cluster-helper -- yum install -y sbd-*.x86_64.rpm