-
-
Notifications
You must be signed in to change notification settings - Fork 56
/
Makefile
80 lines (63 loc) · 2.05 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
PYTHON_VERSION=3.9
SYSTEM_PYTHON=python$(PYTHON_VERSION)
VENV_DIR=./venv
PIP=$(VENV_DIR)/bin/pip
# make stop-server kills all processes named "python"
PKILL_NAME="python"
BUILDBOT=$(VENV_DIR)/bin/buildbot
VENV_CHECK=$(VENV_DIR)/lib/python$(PYTHON_VERSION)/site-packages/buildbot/master.py
USER=buildbot
LOGLINES=50
# Setup targets
.PHONY: venv regen-requirements
venv: $(VENV_CHECK)
clean:
rm -rf venv
$(VENV_CHECK): requirements.txt
$(SYSTEM_PYTHON) -m venv --clear venv
$(PIP) install -U pip
$(PIP) install -r requirements.txt
regen-requirements:
$(SYSTEM_PYTHON) -m venv --clear venv
$(PIP) install -U pip
$(PIP) install -U -r requirements.in
$(PIP) freeze > requirements.txt
# Test targets
.PHONY: check
check: $(VENV_CHECK)
$(BUILDBOT) checkconfig master
# Management targets
.PHONY: update-master start-master restart-master stop-master
update-master: stop-master
@if [ `git rev-parse --symbolic-full-name HEAD` = "refs/heads/main" ]; \
then \
git pull; \
else \
echo "Not on main, not pulling updates"; \
fi
$(MAKE) run-target TARGET=upgrade-master LOGLINES=0
$(MAKE) check
$(MAKE) start-master
start-master: TARGET=start
start-master: run-target
restart-master: TARGET=restart
restart-master: run-target
stop-master: TARGET=stop
stop-master: run-target
# issue #384: sometimes when "buildbot stop master" sends SIGINT to
# Twisted, the server goes in a broken state: it's being "shut down",
# but it never completes. The server stays forever in this state: it is
# still "running" but no longer schedules new jobs. Kill the process
# to make sure that it goes bad to a known state (don't run anymore).
echo "Buildbot processes (look for process name: $(PKILL_NAME))"
pgrep -u $(USER) $(PKILL_NAME) ||:
echo "Send SIGKILL to remaining buildbot processes (if any)"
pkill -KILL -u $(USER) $(PKILL_NAME) ||:
run-target: $(VENV_CHECK)
$(BUILDBOT) $(TARGET) master; tail -n$(LOGLINES) master/twistd.log
git-update-requirements:
git switch main
git pull
git switch -c reqs main
make regen-requirements
git ci -a -m "run make regen-requirements"