-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
88 lines (73 loc) · 2.31 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
#
# Build mock and local RPM versions of tools for Samba
#
# Assure that sorting is case sensitive
LANG=C
MOCKS+=samba4repo-f38-x86_64
MOCKS+=samba4repo-9-x86_64
MOCKS+=samba4repo-8-x86_64
#MOCKS+=samba4repo-amz2-x86_64
MOCKCFGS+=$(MOCKS)
REPOBASEDIR:=`/bin/pwd`/../samba4repo
SPEC := `ls *.spec`
all:: $(MOCKS)
.PHONY: getsrc
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)
install:: $(MOCKS)
@for repo in $(MOCKS); do \
echo Installing $$repo; \
case $$repo in \
amazonlinux-2-x86_64) yumrelease=amazon/2; yumarch=x86_64; ;; \
*-amz2-x86_64) yumrelease=amazon/2; yumarch=x86_64; ;; \
*-8-x86_64) yumrelease=el/8; yumarch=x86_64; ;; \
*-9-x86_64) yumrelease=el/9; yumarch=x86_64; ;; \
*-38-x86_64) yumrelease=fedora/38; yumarch=x86_64; ;; \
*-f38-x86_64) yumrelease=fedora/38; yumarch=x86_64; ;; \
*-rawhide-x86_64) yumrelease=fedora/rawhide; yumarch=x86_64; ;; \
*) echo "Unrecognized release for $$repo, exiting" >&2; exit 1; ;; \
esac; \
rpmdir=$(REPOBASEDIR)/$$yumrelease/$$yumarch; \
srpmdir=$(REPOBASEDIR)/$$yumrelease/SRPMS; \
echo "Pushing SRPMS to $$srpmdir"; \
rsync -av $$repo/*.src.rpm --no-owner --no-group $$repo/*.src.rpm $$srpmdir/. || exit 1; \
createrepo_c -q $$srpmdir/.; \
echo "Pushing RPMS to $$rpmdir"; \
rsync -av $$repo/*.rpm --exclude=*.src.rpm --exclude=*debuginfo*.rpm --no-owner --no-group $$repo/*.rpm $$rpmdir/. || exit 1; \
createrepo_c -q $$rpmdir/.; \
done
@for repo in $(MOCKCFGS); do \
echo "Touching $(PWD)/../$$repo.cfg"; \
/bin/touch --no-dereference $(PWD)/../$$repo.cfg; \
done
clean::
rm -rf */
rm -f *.out
rm -f *.rpm
realclean distclean:: clean