forked from siwinski/drupal8-rpms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
99 lines (86 loc) · 3.17 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
PWD = $(shell pwd)
RPMBUILD_OPTIONS = --define "_topdir $(PWD)/rpmbuild"
SPECTOOL_OPTIONS = --get-files --directory '$(PWD)/rpmbuild/SOURCES'
RPM_DIST = $(shell rpm --eval '%{dist}')
REPO_RELEASE = $(shell \
if [ ".fc18" == "$(RPM_DIST)" ]; then \
echo "fedora-18"; \
elif [ ".el6" == "$(RPM_DIST)" ]; then \
echo "epel-6"; \
fi)
REPO_PATH = fedorapeople.org:/srv/repos/siwinski/drupal8/$(REPO_RELEASE)
# TARGET: help Print this information
.PHONY: help
help:
# Usage:
# make <target>
#
# Targets:
@egrep "^# TARGET:" [Mm]akefile | sed 's/^# TARGET:\s*/# /'
# TARGET: setup Setup rpmbuild directories
.PHONY: setup
setup:
@mkdir -p -m 755 ./rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SRPMS}
@mkdir -p -m 755 ./rpmbuild/RPMS/noarch
# TARGET: core Make core RPMs
.PHONY: core
core: CORE_SOURCE=$(shell spectool --list-files core/drupal8.spec | grep '^Source0:' | sed 's/Source0:\s*//' | xargs basename)
core: setup
@[ -e rpmbuild/SOURCES/$(CORE_SOURCE) ] || spectool $(SPECTOOL_OPTIONS) core/drupal8.spec
@[ -e core/$(CORE_SOURCE) ] || ln -s ../rpmbuild/SOURCES/$(CORE_SOURCE) core/$(CORE_SOURCE)
rpmbuild $(RPMBUILD_OPTIONS) --define '_sourcedir $(PWD)/core' -ba core/drupal8.spec
# TARGET: modules Make all module RPMs
.PHONY: modules
modules: setup
# TARGET: themes Make all theme RPMs
.PHONY: themes
themes: setup
# TARGET: profiles Make all profile RPMs
.PHONY: profiles
profiles: setup
# TARGET: all Make all core, module, theme, and profile RPMs
.PHONY: all
all: core modules themes profiles
# TARGET: rpmlint Run rpmlint on all spec files
.PHONY: rpmlint
rpmlint:
@echo ""
@for SPEC in */*.spec; do \
echo "-------------------- $$SPEC --------------------"; \
rpmlint ./$$SPEC; \
echo ""; \
done
# TARGET: repos-pull Pull repos from fedorapeople.org
.PHONY: repos-pull
repos-pull: setup
@[ "" != "$(REPO_RELEASE)" ] || \
(echo "ERROR: Invalid distribution" 1>&2; exit 1)
@echo "-------------------- Pull SRPMS repo --------------------"
rsync -rlptv $(REPO_PATH)/SRPMS/ rpmbuild/SRPMS/
@echo "-------------------- Pull RPMS repo --------------------"
rsync -rlptv $(REPO_PATH)/noarch/ rpmbuild/RPMS/noarch/
# TARGET: repos-create Create RPM and SRPM repos
.PHONY: repos
repos-create: repos-pull
@echo "-------------------- Create SRPMS repo --------------------"
createrepo --update -v rpmbuild/SRPMS/
@echo ""
@echo "-------------------- Create RPMS repo --------------------"
createrepo --update -v rpmbuild/RPMS/noarch/
# TARGET: repos-push Push repos to fedorapeople.org
.PHONY: repos-push
repos-push: repos-create
@[ "" != "$(REPO_RELEASE)" ] || \
(echo "ERROR: Invalid distribution" 1>&2; exit 1)
@echo "-------------------- Push SRPMS repo --------------------"
rsync -avz rpmbuild/SRPMS/ $(REPO_PATH)/SRPMS/
@echo "-------------------- Push RPMS repo --------------------"
rsync -avz rpmbuild/RPMS/noarch/ $(REPO_PATH)/noarch/
# TARGET: clean Delete any temporary or generated files
.PHONY: clean
clean:
rm -rf ./rpmbuild
find . -name '*~' -delete
find . -name '*.gz' -delete
find . -name '*.tgz' -delete
find . -name '*.rpm' -delete