-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathMakefile
47 lines (40 loc) · 1.24 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
TOPDIR=$(shell bash -c "pwd -P")
RPMTOP=$(TOPDIR)/dist
PKGNAME=redhat-access-insights
SRPM=$(RPMTOP)/SRPMS/$(PKGNAME)-*.src.rpm
TARBALL=$(RPMTOP)/$(PKGNAME)-*.tar.gz
TAR_PORTABLE=$(TOPDIR)/$(PKGNAME)-*.tar.gz
RPM=$(RPMTOP)/RPMS/noarch/$(PKGNAME)*.rpm
CONSTANTS=$(TOPDIR)/redhat_access_insights/constants.py
PY_SDIST=python setup.py sdist
CONF_ORIG=default_conf_dir = '\/etc\/' + app_name + '\/'
CONF_PORT=default_conf_dir = package_path + '\/etc\/'
all: rpm
.PHONY: tarball
tarball: $(TARBALL)
$(TARBALL): Makefile $(TAR_PORTABLE)
$(PY_SDIST)
.PHONY: tar_portable
tar_portable: $(TAR_PORTABLE)
$(TAR_PORTABLE): Makefile
sed -i "s/$(CONF_ORIG)/$(CONF_PORT)/" $(CONSTANTS)
$(PY_SDIST)
sed -i "s/$(CONF_PORT)/$(CONF_ORIG)/" $(CONSTANTS)
mv $(TARBALL) $(RPMTOP)/..
.PHONY: srpm rpm
srpm: $(SRPM)
$(SRPM): $(TARBALL) $(SPEC_FILE_IN)
mkdir -p $(RPMTOP)/{RPMS,SPECS,SRPMS,SOURCES,BUILD,BUILDROOT}
rpmbuild -ts --define="_topdir $(RPMTOP)" --define="_sourcedir dist" $(TARBALL)
.PHONY: rpm
rpm: $(RPM)
$(RPM): $(SRPM)
rpmbuild --buildroot $(RPMTOP)/BUILDROOT --define="_topdir $(RPMTOP)" --rebuild $<
install: $(RPM)
sudo yum install -y $(RPM)
clean:
rm -rf dist
rm -f MANIFEST
rm -rf *.egg*
rm -f $(TAR_PORTABLE)
find . -type f -name '*.pyc' -delete