~rcj/simplestreams/lxd

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
TENV := ./tools/tenv

PUBKEY := examples/keys/example.pub
PUBKEYS := $(PUBKEY)
SECKEY := examples/keys/example.sec

example_sstream_files := $(wildcard examples/*/streams/v1/*.json)

EXDATA_SIGN ?= 1
ifeq ($(EXDATA_SIGN),1)
    EXDATA_SIGN_ARG := --sign
endif

build:
	@echo nothing to do for $@

test: test2 test3

test3: examples-sign
	$(TENV) nosetests3 -v tests/
test2: examples-sign
	$(TENV) nosetests -v tests/

lint: pyflakes

pyflakes: pyflakes2 pyflakes3

pyflakes2:
	$(TENV) env ./tools/run-pyflakes

pyflakes3:
	$(TENV) env ./tools/run-pyflakes3

pep8:
	./tools/run-pep8

check: lint pep8 test

exdata: exdata/fake exdata/data

exdata/data: exdata-query gnupg
	$(TENV) env REAL_DATA=1 ./tools/make-test-data $(EXDATA_SIGN_ARG) exdata-query/ exdata/data

exdata/fake: exdata-query gnupg
	$(TENV) ./tools/make-test-data $(EXDATA_SIGN_ARG) exdata-query/ exdata/fake

exdata-query:
	rsync -avz --delete --exclude "FILE_DATA_CACHE" --exclude ".bzr/*" cloud-images.ubuntu.com::uec-images/query/ exdata-query

$(PUBKEY) $(SECKEY):
	@mkdir -p $$(dirname "$(PUBKEY)") $$(dirname "$(SECKEY)")
	$(TENV) gen-example-key $(PUBKEY) $(SECKEY)

gnupg: gnupg/README

gnupg/README: $(PUBKEYS) $(SECKEY)
	rm -Rf gnupg
	@umask 077 && mkdir -p gnupg
	$(TENV) gpg --import $(SECKEY) >/dev/null 2>&1
	for pubkey in $(PUBKEYS); do \
	  $(TENV) gpg-trust-pubkey $$pubkey; done
	@echo "this is used by $(TENV) as the gpg directory" > gnupg/README

# this is less than ideal, but Make and ':' in targets do not work together
# so instead of proper rules, we have this phoney rule that makes the
# targets.  This would probably cause issue with -j.
examples-sign: gnupg
	@for f in $(example_sstream_files); do \
		[ "$$f.gpg" -nt "$$f" -a "$${f%.json}.sjson" -nt "$$f" ] || \
		{ echo "$(TENV) js2signed $$f" 1>&2; $(TENV) js2signed $$f; } || exit; \
	done


.PHONY: check exdata/fake exdata/data exdata-query examples-sign test test2 test3 lint lint2 lint3