~landscape/landscape-client/production

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Simon Poirier
  • Date: 2017-12-07 19:47:27 UTC
  • mfrom: (2.2.245 staging)
  • Revision ID: simon.poirier@canonical.com-20171207194727-5uc2lnn3oza1q7zh
Merge of lp:landscape-client/staging r247 for production rollout of release-79.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
PYDOCTOR ?= pydoctor
2
 
TXT2MAN ?= txt2man
3
 
PYTHON ?= python
4
 
PYTHON3 ?= python3
5
 
TRIAL_ARGS ?=
6
 
TEST_COMMAND_PY2 = trial --unclean-warnings $(TRIAL_ARGS) landscape
7
 
TEST_COMMAND_PY3 = trial3 --unclean-warnings $(TRIAL_ARGS) landscape
8
 
READY_FILE := py3_ready_tests
9
 
PY3_READY := `cat $(READY_FILE)`
10
 
TEST_COMMAND_PY3_READY = TRIAL_ARGS= trial3 --unclean-warnings $(PY3_READY)
11
 
UBUNTU_RELEASE := $(shell lsb_release -cs)
12
 
# version in the code is authoritative
13
 
# Use := here, not =, it's really important, otherwise UPSTREAM_VERSION
14
 
# will be updated behind your back with the current result of that
15
 
# command everytime it is mentioned/used.
16
 
UPSTREAM_VERSION := $(shell python -c "from landscape import UPSTREAM_VERSION; print UPSTREAM_VERSION")
17
 
CHANGELOG_VERSION := $(shell dpkg-parsechangelog | grep ^Version | cut -f 2 -d " " | cut -f 1 -d '-')
18
 
BZR_REVNO := $(shell bzr revno)
19
 
ifeq (+bzr,$(findstring +bzr,$(UPSTREAM_VERSION)))
20
 
TARBALL_VERSION := $(UPSTREAM_VERSION)
21
 
else
22
 
TARBALL_VERSION := $(UPSTREAM_VERSION)+bzr$(BZR_REVNO)
23
 
endif
24
 
 
25
 
.PHONY: help
26
 
help:  ## Print help about available targets
27
 
        @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
28
 
 
29
 
.PHONY: depends
30
 
depends: depends2 depends3  ## Install py2 and py3 dependencies.
31
 
 
32
 
.PHONY: depends2
33
 
depends2:
34
 
        sudo apt -y install python-twisted-core python-distutils-extra python-mock python-configobj python-passlib
35
 
 
36
 
.PHONY: depends3
37
 
depends3:
38
 
        sudo apt -y install python3-twisted python3-distutils-extra python3-mock python3-configobj python3-passlib
39
 
 
40
 
all: build
41
 
 
42
 
.PHONY: build
43
 
build: build2 build3   ## Build.
44
 
 
45
 
.PHONY: build2
46
 
build2:
47
 
        $(PYTHON) setup.py build_ext -i
48
 
 
49
 
.PHONY: build3
50
 
build3:
51
 
        $(PYTHON3) setup.py build_ext -i
52
 
 
53
 
.PHONY: check5
54
 
check5:
55
 
        -trial --unclean-warnings --reporter=summary landscape > _last_py2_res
56
 
        -trial3 --unclean-warnings landscape
57
 
        ./display_py2_testresults
58
 
 
59
 
.PHONY: check
60
 
check: check2 check3-ready  ## Run all the tests.
61
 
 
62
 
.PHONY: check2
63
 
check2: build
64
 
        LC_ALL=C $(TEST_COMMAND_PY2)
65
 
 
66
 
.PHONY: check3
67
 
check3: build3
68
 
        LC_ALL=C $(TEST_COMMAND_PY3)
69
 
 
70
 
.PHONY: check3-ready
71
 
check3-ready:  ## Run py3 tests for ported modules (listed in py3_ready_tests).
72
 
        LC_ALL=C $(TEST_COMMAND_PY3_READY)
73
 
 
74
 
.PHONY: ci-check
75
 
ci-check: depends build check  ## Install dependencies and run all the tests.
76
 
 
77
 
.PHONY: lint
78
 
lint:
79
 
        bzr ls-lint
80
 
 
81
 
.PHONY: pyflakes
82
 
pyflakes:
83
 
        -pyflakes `find landscape -name \*py`
84
 
 
85
 
clean:
86
 
        -find landscape -name \*.pyc -exec rm -f {} \;
87
 
        -rm tags
88
 
        -rm _trial_temp -rf
89
 
        -rm docs/api -rf;
90
 
        -rm man/\*.1 -rf
91
 
        -rm sdist -rf
92
 
 
93
 
doc: docs/api/twisted/pickle
94
 
        mkdir -p docs/api
95
 
        ${PYDOCTOR} --make-html --html-output docs/api --add-package landscape --extra-system=docs/api/twisted/pickle:twisted/
96
 
 
97
 
docs/api/twisted/pickle:
98
 
        mkdir -p docs/api/twisted
99
 
        -${PYDOCTOR} --make-html --html-output docs/api/twisted --add-package /usr/share/pyshared/twisted -o docs/api/twisted/pickle
100
 
 
101
 
manpages:
102
 
        LC_ALL=C ${TXT2MAN} -P Landscape -s 1 -t landscape-client < man/landscape-client.txt > man/landscape-client.1
103
 
        LC_ALL=C ${TXT2MAN} -P Landscape -s 1 -t landscape-config < man/landscape-config.txt > man/landscape-config.1
104
 
        LC_ALL=C ${TXT2MAN} -P Landscape -s 1 -t landscape-sysinfo < man/landscape-sysinfo.txt > man/landscape-sysinfo.1
105
 
 
106
 
origtarball: sdist
107
 
        cp -f sdist/landscape-client-$(TARBALL_VERSION).tar.gz \
108
 
                ../landscape-client_$(TARBALL_VERSION).orig.tar.gz
109
 
 
110
 
prepchangelog:
111
 
# add a temporary entry for a local build if needed
112
 
ifeq (,$(findstring +bzr,$(CHANGELOG_VERSION)))
113
 
        dch -v $(TARBALL_VERSION)-0ubuntu0 "New local test build" --distribution $(UBUNTU_RELEASE)
114
 
else
115
 
# just update the timestamp
116
 
        dch --distribution $(UBUNTU_RELEASE) --release $(UBUNTU_RELEASE)
117
 
endif
118
 
 
119
 
updateversion:
120
 
        sed -i -e "s/^UPSTREAM_VERSION.*/UPSTREAM_VERSION = \"$(TARBALL_VERSION)\"/g" \
121
 
                landscape/__init__.py
122
 
 
123
 
package: clean prepchangelog updateversion
124
 
        debuild -b $(DEBUILD_OPTS)
125
 
 
126
 
sourcepackage: clean origtarball prepchangelog updateversion
127
 
        # need to remove sdist here because it doesn't exist in the
128
 
        # orig tarball
129
 
        rm -rf sdist
130
 
        debuild -S $(DEBUILD_OPTS)
131
 
 
132
 
MESSAGE_DIR = `pwd`/runclient-messages
133
 
LOG_FILE = `pwd`/runclient.log
134
 
 
135
 
freshdata:
136
 
        -sudo rm -rf $(MESSAGE_DIR)
137
 
        -sudo mkdir $(MESSAGE_DIR)
138
 
 
139
 
run:
140
 
        -sudo ./landscape-client \
141
 
                -a onward -t "John's PC" \
142
 
                -u http://localhost:8080/message-system \
143
 
                -d $(MESSAGE_DIR) \
144
 
                --urgent-exchange-interval=5 \
145
 
                --log-level=debug \
146
 
                --ping-url=http://localhost:8081/ping \
147
 
 
148
 
freshrun: freshdata run
149
 
 
150
 
tags:
151
 
        -ctags --languages=python -R .
152
 
 
153
 
etags:
154
 
        -etags --languages=python -R .
155
 
 
156
 
releasetarball:
157
 
        make sdist TARBALL_VERSION=$(UPSTREAM_VERSION)
158
 
 
159
 
sdist: clean
160
 
        mkdir -p sdist
161
 
        # --uncommitted because we want any changes the developer might have made
162
 
        # locally to be included in the package without having to commit
163
 
        bzr export --uncommitted sdist/landscape-client-$(TARBALL_VERSION)
164
 
        rm -rf sdist/landscape-client-$(TARBALL_VERSION)/debian
165
 
        sed -i -e "s/^UPSTREAM_VERSION.*/UPSTREAM_VERSION = \"$(TARBALL_VERSION)\"/g" \
166
 
                sdist/landscape-client-$(TARBALL_VERSION)/landscape/__init__.py
167
 
        cd sdist && tar cfz landscape-client-$(TARBALL_VERSION).tar.gz landscape-client-$(TARBALL_VERSION)
168
 
        cd sdist && md5sum landscape-client-$(TARBALL_VERSION).tar.gz > landscape-client-$(TARBALL_VERSION).tar.gz.md5
169
 
        rm -rf sdist/landscape-client-$(TARBALL_VERSION)
170
 
 
171
 
.PHONY: tags etags freshdata run freshrun package sourcepackage updateversion origtarball prepchangelog lint releasetarball
172
 
.DEFAULT_GOAL := help