-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.epel
97 lines (81 loc) · 2.6 KB
/
Makefile.epel
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
#
# Build mock and local RPM versions of python modules
#
# Assure that sorting is case sensitive
LANG=C
# Ignore ownership and group,
RSYNCOPTS=-a --no-owner --no-group
# Skip existing files to avoid binary churn in yum repos
#RSYNCOPTS+=--ignore-existing
# "mock" configurations to build with, activate only as needed
# Some RHEL dependencies are supplied locally in awsclirepo
MOCKS+=centos+epel-7-x86_64
MOCKS+=centos-stream+epel-8-x86_64
MOCKS+=centos-stream+epel-9-x86_64
# Local yum compatible RPM repository
REPOBASEDIR="`/bin/pwd | xargs dirname`/awsclirepo"
# Deduce local package names and .spec files, for universe Makefile use
SPEC := `ls *.spec | head -1`
# Needed for yum repo updates
all:: /usr/bin/createrepo_c
all:: $(MOCKS)
# Get any tarballs as describe by .spec
getsrc:
spectool -g $(SPEC)
srpm:: src.rpm
#.PHONY:: src.rpm
src.rpm:: Makefile
@rm -rf rpmbuild
@rm -f $@
@echo "Building SRPM with $(SPEC)"
rpmbuild --define '_topdir $(PWD)/rpmbuild' \
--define '_sourcedir $(PWD)' \
-bs $(SPEC) --nodeps
mv rpmbuild/SRPMS/*.src.rpm src.rpm
.PHONY: build
build:: src.rpm
rpmbuild --define '_topdir $(PWD)/rpmbuild' \
--rebuild $?
.PHONY: $(MOCKS)
$(MOCKS)::
@if [ -e $@ -a -n "`find $@ -name '*.rpm' ! -name '*.src.rpm' 2>/dev/null`" ]; then \
echo " Skipping RPM populated $@"; \
else \
echo "Actally building $? in $@"; \
rm -rf $@; \
mock -q -r $(PWD)/../$@.cfg \
--sources $(PWD) --spec $(SPEC) \
--resultdir=$(PWD)/$@; \
fi
mock:: $(MOCKS)
mock:: $(MOCKS)
install:: $(MOCKS)
@for repo in $(MOCKS); do \
echo Installing $$repo; \
case $$repo in \
*-7-x86_64) yumrelease=el/7; yumarch=x86_64; ;; \
*-8-x86_64) yumrelease=el/8; yumarch=x86_64; ;; \
*-9-x86_64) yumrelease=el/9; yumarch=x86_64; ;; \
*-37-x86_64) yumrelease=fedora/37; yumarch=x86_64; ;; \
*-f37-x86_64) yumrelease=fedora/37; yumarch=x86_64; ;; \
*-39-x86_64) yumrelease=fedora/39; yumarch=x86_64; ;; \
*-f39-x86_64) yumrelease=fedora/39; yumarch=x86_64; ;; \
*) echo "Unrecognized release for $$repo, exiting" >&2; exit 1; ;; \
esac; \
rpmdir=$(REPOBASEDIR)/$$yumrelease/$$yumarch; \
srpmdir=$(REPOBASEDIR)/$$yumrelease/SRPMS; \
echo " Pusning SRPMS to $$srpmdir"; \
rsync $(RSYNCOPTS) $$repo/*.src.rpm $$srpmdir/. || exit 1; \
createrepo_c -q $$srpmdir/.; \
echo " Pushing RPMS to $$rpmdir"; \
rsync $(RSYNCOPTS) --exclude=*.src.rpm --exclude=*debuginfo*.rpm $$repo/*.rpm $$rpmdir/. || exit 1; \
createrepo_c -q $$rpmdir/.; \
done
clean::
rm -rf $(MOCKS)
rm -rf rpmbuild
rm -rf */
rm -f *.rpm
rm -f *~
rm -f *.out
realclean distclean:: clean