-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
41 lines (33 loc) · 1.23 KB
/
Makefile.common
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
.PHONY: rpm srpm
.SILENT:
#specfile MUST be defined upstream
#coprproject MUST be defined upstream
mockresultdir := mockresult
srpmfile := $(addsuffix .src.rpm,$(shell rpmspec --srpm --query --qf '%{nevr}' $(specfile)))
# This requires rpmspec >= 4.14.2.1
rpmfiles := $(addsuffix .rpm,$(shell rpmspec --builtrpms --query $(specfile)))
mockrpmfiles := $(addprefix $(mockresultdir)/,$(rpmfiles))
# TODO report (or better fix) spectool's inability to list sources and patches separately
#sourcefiles := $(shell spectool --sources $(specfile) | cut -d ' ' -f 2)
#patchfiles := $(shell spectool --patches $(specfile) | cut -d ' ' -f 2)
srcurls != spectool --all $(specfile) | cut -d ' ' -f 2
srcfiles := $(notdir $(srcurls))
# TODO utilize ~/rpmbuild/* (how?)
rpmbuildopts := -D '_sourcedir .' -D '_srcrpmdir .'
rpm: $(rpmfiles)
srpm: $(srpmfile)
# TODO query somehow whether the successful build exist
copr: rpm
copr build $(coprproject) $(srpmfile)
touch copr
# TODO it's awfully rude
$(srcfiles):
spectool -g $(specfile)
$(srpmfile): $(specfile) $(srcfiles)
rpmlint $<
rpmbuild $(rpmbuildopts) -bs $<
$(rpmfiles): $(mockrpmfiles)
install -D -m 0644 -p $^ .
$(mockrpmfiles)&: $(srpmfile)
rpmlint $<
mock --resultdir $(mockresultdir) $(mockopts) $<