~terceiro/+junk/lava-dev

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
LANG = C
BZR_REPOS = $(shell awk '{ if ($$2 == "bzr") { print($$1) } }' repos.txt | while read dir; do test -d $$dir && echo $$dir; done)

all: .mrconfig
	@echo Useful commands:
	@echo
	@echo "  mr checkout        checks out all repositories missing locally"
	@echo "  mr update          updates all upstream repositories"
	@echo "  mr diff            checks local changes in all repositories"
	@echo "  mr status          checks working tree status in all repositories"

.mrconfig: repos.txt create-mrconfig.awk
	(awk -f create-mrconfig.awk repos.txt > $@) || ($(RM) $@; false)

VIRTUALENV = $(CURDIR)/.virtualenv/lava
PYTHON = $(VIRTUALENV)/bin/python
PIP = $(VIRTUALENV)/bin/pip

minimal-checkout:
	for repo in lava-tool lava-utils-interface lava-dispatcher; do \
		mkdir -p $$repo; \
		test -d $$repo/trunk || bzr branch lp:$$repo $$repo/trunk; \
	done

CLIENT_TOOLS = \
	lava-tool \
	lava-utils-interface \
	lava-dispatcher

setup-virtualenv:
	mkdir -p $(shell dirname $(VIRTUALENV))
	virtualenv $(VIRTUALENV)
	$(PIP) install versiontools
	for component in $(CLIENT_TOOLS); do \
		(cd $$component/trunk && $(PYTHON) setup.py develop); \
		done
	test -h $(VIRTUALENV)/etc || ln -s $(CURDIR)/etc $(VIRTUALENV)/etc
	ln -sf $(CURDIR)/bin/* $(VIRTUALENV)/bin/

pending-branches:
	@find $(BZR_REPOS) -mindepth 1 -maxdepth 1  -type d -and -not -name trunk

DEPLOYED = $(shell sed '1,/\[revisions\]/ d' lava-manifest/trunk/buildout-production.cfg | awk '{print($$1)}' | sed -e 's/linaro-dashboard-bundle/linaro-python-dashboard-bundle/')

trunk-show:
	@for repo in $(DEPLOYED); do \
		if test -d $$repo/trunk; then \
			printf "$$repo = " | sed -e 's/linaro-python-dashboard-bundle/linaro-dashboard-bundle/'; \
			(cd $$repo/trunk && bzr log -l 1 | awk '{if ($$1 == "revno:") print($$2) }'); \
		fi \
		done

pending-deploy:
	$(MAKE) -s trunk-show > /tmp/trunk
	sed '1,/\[revisions\]/ d' lava-manifest/trunk/buildout-production.cfg > /tmp/manifest
	git diff --no-index --color-words /tmp/manifest /tmp/trunk || true

lava-cache.tar: lava-deployment-tool/trunk
	vagrant up
	vagrant provision
	vagrant ssh -c "cd / && sudo tar caf /vagrant/lava-cache.tar var/cache/apt/archives srv/lava/.cache"
	vagrant halt

lava-deployment-tool/trunk:
	mkdir -p lava-deployment-tool
	cd lava-deployment-tool && bzr branch lp:lava-deployment-tool trunk