-
Notifications
You must be signed in to change notification settings - Fork 343
/
Makefile.pkg
66 lines (55 loc) · 2.74 KB
/
Makefile.pkg
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
# This Makefile contains RPM related targets
include Makefile.include
COMMIT=$(shell git log --pretty=format:'%H' -n 1)
COMMIT_DATE=$(shell git log --pretty='format:%cd' --date='format:%Y%m%d' -n 1)
SHORT_COMMIT=$(shell git rev-parse --short=9 HEAD)
MOCK_CONFIG=default
ARCHIVE_BASE_NAME=avocado
PYTHON_MODULE_NAME=avocado-framework
RPM_BASE_NAME=python-avocado
all:
@echo
@echo "RPM related targets:"
@echo "source: Create single source package with commit info, suitable for RPMs"
@echo "srpm: Generate a source RPM package (.srpm)"
@echo "rpm: Generate binary RPMs"
@echo
@echo "Release related targets:"
@echo "source-release: Create source package for the latest tagged release"
@echo "srpm-release: Generate a source RPM package (.srpm) for the latest tagged release"
@echo "rpm-release: Generate binary RPMs for the latest tagged release"
@echo
@echo "variables: Show the value of variables as defined in this Makefile or"
@echo " given as input to make"
@echo "clean: Clean previous build directories"
@echo
clean:
rm -rf SOURCES BUILD
source: clean
if test ! -d SOURCES; then mkdir SOURCES; fi
git archive --prefix="$(ARCHIVE_BASE_NAME)-$(COMMIT)/" -o "SOURCES/$(ARCHIVE_BASE_NAME)-$(SHORT_COMMIT).tar.gz" HEAD
source-release: clean
if test ! -d SOURCES; then mkdir SOURCES; fi
git archive --prefix="$(ARCHIVE_BASE_NAME)-$(VERSION)/" -o "SOURCES/$(ARCHIVE_BASE_NAME)-$(VERSION).tar.gz" $(VERSION)
srpm: source
if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi
mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --buildsrpm --spec $(RPM_BASE_NAME).spec --sources SOURCES
rpm: srpm
if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi
mock -r $(MOCK_CONFIG) --no-clean --resultdir BUILD/RPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --rebuild BUILD/SRPM/$(RPM_BASE_NAME)-$(VERSION)-*.src.rpm
srpm-release: source-release
if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi
mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "rel_build 1" --buildsrpm --spec $(RPM_BASE_NAME).spec --sources SOURCES
rpm-release: srpm-release
if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi
mock -r $(MOCK_CONFIG) --no-clean --resultdir BUILD/RPM -D "rel_build 1" --rebuild BUILD/SRPM/$(RPM_BASE_NAME)-$(VERSION)-*.src.rpm
variables:
@echo "VERSION: $(VERSION)"
@echo "COMMIT: $(COMMIT)"
@echo "COMMIT_DATE: $(COMMIT_DATE)"
@echo "SHORT_COMMIT: $(SHORT_COMMIT)"
@echo "MOCK_CONFIG: $(MOCK_CONFIG)"
@echo "ARCHIVE_BASE_NAME: $(ARCHIVE_BASE_NAME)"
@echo "PYTHON_MODULE_NAME: $(PYTHON_MODULE_NAME)"
@echo "RPM_BASE_NAME: $(RPM_BASE_NAME)"
.PHONY: clean source source-release sprm rpm srpm-release rpm-release variables