Merge lp:~powersj/simplestreams/enable-tox into lp:simplestreams

Proposed by Joshua Powers on 2016-07-27
Status: Merged
Merged at revision: 440
Proposed branch: lp:~powersj/simplestreams/enable-tox
Merge into: lp:simplestreams
Diff against target: 139 lines (+80/-28)
4 files modified
Makefile (+4/-28)
tools/example-sign (+21/-0)
tools/gnupg (+31/-0)
tox.ini (+24/-0)
To merge this branch: bzr merge lp:~powersj/simplestreams/enable-tox
Reviewer Review Type Date Requested Status
Scott Moser 2016-07-27 Pending
Review via email: mp+301307@code.launchpad.net
To post a comment you must log in.
Joshua Powers (powersj) wrote :

Here is full output on fresh yakkety container:
http://paste.ubuntu.com/21166479/

Scott Moser (smoser) wrote :

lets change the Makefile to use tools/sign-examples.

http://paste.ubuntu.com/21325350/ will install all dependencies as read from build-depends.

i'd like to maintain a difference between what is required to run 'tox' (which really shouldnt be more than python-tox) and what is required to build.

distro-info is obnoxious in that python-distro-info the pip package is not really useful without having the data (which is installed by distro-info-data).
I guess we only use that in the tools/ directory though.

lp:~powersj/simplestreams/enable-tox updated on 2016-07-29
441. By Joshua Powers on 2016-07-29

Broke out gnupg code as it its called in various places in the Makefile.

Removed the requirements file as it does not belong.

Scott Moser (smoser) wrote :

this looks good.
one small comment.

Scott Moser (smoser) wrote :

also, looks like you might need python-dev and / or python3-dev to pip install python-glanceclient. at least in my test i did, as i got a failure like

...
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNETIFACES_VERSION=0.10.4 -DHAVE_GETIFADDRS=1 -DHAVE_GETNAMEINFO=1 -DHAVE_NETASH_ASH_H=1 -DHAVE_NETATALK_AT_H=1 -DHAVE_NETAX25_AX25_H=1 -DHAVE_NETECONET_EC_H=1 -DHAVE_NETIPX_IPX_H=1 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_LINUX_IRDA_H=1 -DHAVE_LINUX_ATM_H=1 -DHAVE_LINUX_LLC_H=1 -DHAVE_LINUX_TIPC_H=1 -DHAVE_LINUX_DN_H=1 -DHAVE_SOCKADDR_AT=1 -DHAVE_SOCKADDR_AX25=1 -DHAVE_SOCKADDR_IN=1 -DHAVE_SOCKADDR_IN6=1 -DHAVE_SOCKADDR_IPX=1 -DHAVE_SOCKADDR_UN=1 -DHAVE_SOCKADDR_ASH=1 -DHAVE_SOCKADDR_EC=1 -DHAVE_SOCKADDR_LL=1 -DHAVE_SOCKADDR_ATMPVC=1 -DHAVE_SOCKADDR_ATMSVC=1 -DHAVE_SOCKADDR_DN=1 -DHAVE_SOCKADDR_IRDA=1 -DHAVE_SOCKADDR_LLC=1 -DHAVE_PF_NETLINK=1 -I/usr/include/python2.7 -c netifaces.c -o build/temp.linux-x86_64-2.7/netifaces.o
    netifaces.c:1:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/home/smoser/pub/venvs/smt/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-mKbyFI/netifaces/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-H5gvlb-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/smoser/pub/venvs/smt/include/site/python2.7/netifaces" failed with error code 1 in /tmp/pip-build-mKbyFI/netifaces/

this is definitely where i think pip falls apart. once you need things that aren'tpure python.

lp:~powersj/simplestreams/enable-tox updated on 2016-08-01
442. By Joshua Powers on 2016-08-01

Moved flake8 dependency to be more specifc to the test.

Joshua Powers (powersj) wrote :

What do you want to do about the test dependencies? Document them? This again was the list for the Ubuntu packages that need to be installed to run successfully.

> build-essential
> python-dev
> python-distro-info
> python-tox
> python3-dev

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2014-07-15 21:37:26 +0000
3+++ Makefile 2016-08-01 15:37:21 +0000
4@@ -1,11 +1,5 @@
5 TENV := ./tools/tenv
6
7-PUBKEY := examples/keys/example.pub
8-PUBKEYS := $(PUBKEY)
9-SECKEY := examples/keys/example.sec
10-
11-example_sstream_files := $(wildcard examples/*/streams/v1/*.json)
12-
13 EXDATA_SIGN ?= 1
14 ifeq ($(EXDATA_SIGN),1)
15 EXDATA_SIGN_ARG := --sign
16@@ -47,28 +41,10 @@
17 exdata-query:
18 rsync -avz --delete --exclude "FILE_DATA_CACHE" --exclude ".bzr/*" cloud-images.ubuntu.com::uec-images/query/ exdata-query
19
20-$(PUBKEY) $(SECKEY):
21- @mkdir -p $$(dirname "$(PUBKEY)") $$(dirname "$(SECKEY)")
22- $(TENV) gen-example-key $(PUBKEY) $(SECKEY)
23-
24-gnupg: gnupg/README
25-
26-gnupg/README: $(PUBKEYS) $(SECKEY)
27- rm -Rf gnupg
28- @umask 077 && mkdir -p gnupg
29- $(TENV) gpg --import $(SECKEY) >/dev/null 2>&1
30- for pubkey in $(PUBKEYS); do \
31- $(TENV) gpg-trust-pubkey $$pubkey; done
32- @echo "this is used by $(TENV) as the gpg directory" > gnupg/README
33-
34-# this is less than ideal, but Make and ':' in targets do not work together
35-# so instead of proper rules, we have this phoney rule that makes the
36-# targets. This would probably cause issue with -j.
37+gnupg:
38+ ./tools/gnupg
39+
40 examples-sign: gnupg
41- @for f in $(example_sstream_files); do \
42- [ "$$f.gpg" -nt "$$f" -a "$${f%.json}.sjson" -nt "$$f" ] || \
43- { echo "$(TENV) js2signed $$f" 1>&2; $(TENV) js2signed $$f; } || exit; \
44- done
45-
46+ ./tools/example-sign
47
48 .PHONY: check exdata/fake exdata/data exdata-query examples-sign test test2 test3 lint lint2 lint3
49
50=== added file 'tools/example-sign'
51--- tools/example-sign 1970-01-01 00:00:00 +0000
52+++ tools/example-sign 2016-08-01 15:37:21 +0000
53@@ -0,0 +1,21 @@
54+#!/bin/bash
55+
56+TOP_DIR=$(cd "$(dirname "${0}")"/.. && pwd)
57+TENV=${TOP_DIR}/tools/tenv
58+FILES=( ${TOP_DIR}/examples/*/streams/v1/*.json )
59+
60+if [ ! -f "${TOP_DIR}/gnupg/README" ]
61+then
62+ echo "Cannot sign: gpg key not setup. Run gnupg."
63+ exit 2
64+fi
65+
66+echo -e "\nGenerating signed files..."
67+for f in "${FILES[@]}"
68+do
69+ if [ "$f.gpg" -ot "$f" -o "${f%.json}.sjson" -ot "$f" ]
70+ then
71+ echo "tenv js2signed $f" 1>&2;
72+ $TENV js2signed "$f";
73+ fi
74+done
75
76=== added file 'tools/gnupg'
77--- tools/gnupg 1970-01-01 00:00:00 +0000
78+++ tools/gnupg 2016-08-01 15:37:21 +0000
79@@ -0,0 +1,31 @@
80+#!/bin/bash
81+
82+TOP_DIR=$(cd "$(dirname "${0}")"/.. && pwd)
83+GPG_DIR=${TOP_DIR}/gnupg
84+TENV=${TOP_DIR}/tools/tenv
85+PUBKEY=${TOP_DIR}/examples/keys/example.pub
86+SECKEY=${TOP_DIR}/examples/keys/example.sec
87+
88+if [ -f "$GPG_DIR"/README ]
89+then
90+ echo "Files exist, not regenerating."
91+ exit
92+fi
93+
94+echo -e "\nSetting up GPG keys..."
95+umask 077 && mkdir -p "$GPG_DIR"
96+
97+if [ ! -f "$PUBKEY" -o ! -f "$SECKEY" ]
98+then
99+ mkdir -p "$(dirname "$PUBKEY")"
100+ out=$($TENV "${TOP_DIR}"/tools/gen-example-key "$PUBKEY" "$SECKEY") ||
101+ { echo "Failed to generate keys: $out"; exit 2; }
102+fi
103+
104+out=$($TENV gpg --import "$SECKEY" >/dev/null 2>&1 ) ||
105+ { echo "Failed to import seckey: $out"; exit 2; }
106+out=$("${TOP_DIR}"/tools/gpg-trust-pubkey "$PUBKEY") ||
107+ { echo "Failed to import pubkey: $out"; exit 2; }
108+
109+echo "this is used by $TENV as the gpg directory" > "$GPG_DIR"/README
110+
111
112=== added file 'tox.ini'
113--- tox.ini 1970-01-01 00:00:00 +0000
114+++ tox.ini 2016-08-01 15:37:21 +0000
115@@ -0,0 +1,24 @@
116+[tox]
117+envlist = py27, py3, py3-flake8
118+recreate = True
119+
120+[testenv]
121+commands =
122+ {toxinidir}/tools/gnupg
123+ {toxinidir}/tools/example-sign
124+ {envpython} -m nose {posargs:--with-coverage --cover-erase \
125+ --cover-branches --cover-package=simplestreams --cover-inclusive \
126+ tests}
127+deps =
128+ coverage
129+ mock
130+ nose
131+ python-glanceclient
132+ python-keystoneclient
133+
134+[testenv:py3-flake8]
135+envdir = {toxworkdir}/py3
136+deps = flake8
137+commands = {envpython} -m flake8 {posargs:bin/ simplestreams/ tests/ tools/}
138+ignore=H404,H405,H105,H301,H104,H403,H101
139+exclude = .venv,.tox,dist,doc,*egg,.git,build,tools

Subscribers

People subscribed via source and target branches