~powersj/simplestreams/verbose_tox

« back to all changes in this revision

Viewing changes to tools/create-gpgdir

  • Committer: Scott Moser
  • Date: 2016-08-03 16:02:50 UTC
  • mfrom: (439.1.23 enable-tox)
  • Revision ID: smoser@ubuntu.com-20160803160250-9hjl6tgu0u0bgjjx
add running of tox.

This primarily moves a lot of things around to enable tox.
Some things here:
 * add ./tools/install-deps
   this allows easily installing dependencies to build or run tox
   (the openstack libraries require some c python extentions so
   you end up needing python-dev and such in order to run tox).

 * add tools/create-gpgdir and tools/sign-examples
   this just moves that logic out of Makefile to these places.

 * make tools/js2signed only re-create .sjson and .json.gpg
   files if the .json is newer. It supports '--force' to disable
   this logic.

 * move to using flake8 instead of pyflakes and pep8
   (flake8 uses pyflakes and pep8)

 * debian/control drop python-glanceclient and python3-keystoneclient
   these aren't available in trusty and thus can't build if they
   are there.  Also adjusted tests to skip these if not present.

 * split signjson_file out of toolutil as toolutil required
   distroinfo which is only needed by make testdata.

 * add a trusty-flake8 tox environment for testing versions
   of flake8, pep8, and pyflakes that are on trusty.  This allows
   us to catch what would be trusty specific build failures in tox.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
set -e
 
4
TOP_DIR=$(cd "$(dirname "${0}")"/.. && pwd)
 
5
GPG_DIR=${GPG_DIR:-${TOP_DIR}/gnupg}
 
6
PUBKEY=${PUBKEY:-${TOP_DIR}/examples/keys/example.pub}
 
7
SECKEY=${SECKEY:-${TOP_DIR}/examples/keys/example.sec}
 
8
 
 
9
if [ "$1" = "-h" -o "$1" = "--help" ]; then
 
10
    cat <<EOF
 
11
Usage: ${0##*/}
 
12
   create gnupghome dir $GPG_DIR.
 
13
   Populate with public keys.
 
14
EOF
 
15
fi
 
16
 
 
17
if [ -f "$GPG_DIR"/README ]; then
 
18
    exit
 
19
fi
 
20
 
 
21
export GNUPGHOME="$GPG_DIR"
 
22
if [ ! -d "$GPG_DIR" ]; then
 
23
    ( umask 077 ; mkdir -p "$GPG_DIR" )
 
24
fi
 
25
 
 
26
if [ $# -eq 0 ]; then
 
27
   set -- "$PUBKEY"
 
28
fi
 
29
 
 
30
{
 
31
echo "creating GNUPGHOME dir in $GPG_DIR."
 
32
echo "  pubkey '$PUBKEY'"
 
33
echo "  secret '$SECKEY'"
 
34
echo "  pubkeys: $*"
 
35
} 1>&2
 
36
 
 
37
if [ ! -f "$PUBKEY" -o ! -f "$SECKEY" ]; then
 
38
    mkdir -p "$(dirname "$PUBKEY")"
 
39
    out=$("${TOP_DIR}"/tools/gen-example-key "$PUBKEY" "$SECKEY") ||
 
40
        { echo "Failed to generate keys: $out"; exit 2; }
 
41
    echo "created pubkey $pubkey and secret key $seckey" 1>&2
 
42
fi
 
43
 
 
44
out=$(gpg --import "$SECKEY" 2>&1) ||
 
45
    { echo "Failed to import seckey: $out"; exit 2; }
 
46
echo "imported secret key $SECKEY" 1>&2
 
47
 
 
48
for k in "$@"; do
 
49
    out=$("${TOP_DIR}"/tools/gpg-trust-pubkey "$k") ||
 
50
        { echo "Failed to import pubkey '$k': $out"; exit 2; }
 
51
    echo "imported pubkey $k" 1>&2
 
52
done
 
53
 
 
54
echo "this is used by \$TENV as the gpg directory" > "$GPG_DIR"/README
 
55