Permalink
2 comments
on commit
mbruzek
replied
Please sign in to comment.
Browse files
Supporting offline resource files
These bits add a make target for `fetch_resources` - Parse the resources.dist file in $CHARM_ROOT - Fetch and sha1sum the resources parsed out of resources.dist - Print feedback about sum verification, all files isolated in `$CHARM_ROOT/resources`
- Loading branch information...
Showing
with
53 additions
and 0 deletions.
- +28 −0 Makefile
- +1 −0 resources.dist
- +24 −0 scripts/download_resources.sh
| @@ -0,0 +1,28 @@ | ||
| +#!/usr/bin/make | ||
| + | ||
| +all: lint unit_test | ||
| + | ||
| + | ||
| +.PHONY: clean | ||
chuckbutler
Owner
|
||
| +clean: | ||
| + @rm -rf .tox | ||
| + | ||
| +.PHONY: apt_prereqs | ||
| +apt_prereqs: | ||
| + @# Need tox, but don't install the apt version unless we have to (don't want to conflict with pip) | ||
| + @which tox >/dev/null || (sudo apt-get install -y python-pip && sudo pip install tox) | ||
| + | ||
| +.PHONY: lint | ||
| +lint: apt_prereqs | ||
| + @tox --notest | ||
| + @PATH=.tox/py34/bin:.tox/py35/bin flake8 $(wildcard hooks reactive lib unit_tests tests) | ||
| + @charm proof | ||
| + | ||
| +.PHONY: unit_test | ||
| +unit_test: apt_prereqs | ||
| + @echo Starting tests... | ||
| + tox | ||
| + | ||
| +.PHONY: fetch_resources | ||
| +fetch_resources: | ||
| + scripts/download_resources.sh | ||
| @@ -0,0 +1 @@ | ||
| +etcd|2.2.3|etcd-v2.2.3-linux-amd64.tar.gz|https://github.com/coreos/etcd/releases/download/v2.2.3/etcd-v2.2.3-linux-amd64.tar.gz|208d5f05f1ef2715198904f46c7fde3f9b7bdec6 |
| @@ -0,0 +1,24 @@ | ||
| +#!/bin/bash | ||
| + | ||
| +set -e | ||
| + | ||
| +#!/bin/bash | ||
| +mkdir -p $(pwd)/resources | ||
| + | ||
| +while IFS="|" read app version file url checksum | ||
|
|
||
| +do | ||
| + echo "Downloading $app Version: $version" | ||
| + echo $url | ||
|
|
||
| + echo $file | ||
| + curl -L -v $url -o resources/$file 2>> logfile.txt | ||
| + # make here a special case, if the file is not present | ||
| + calculated_sum=$(sha1sum "resources/$file" | /usr/bin/cut -f 1 -d " ") | ||
| + # compare checksum | ||
| + case "$calculated_sum" in | ||
| + "$checksum") | ||
| + echo -e " \033[m\033[42m OK \033[0m crypto signature compared and correct."; | ||
|
|
||
| + ;; | ||
| + *) | ||
| + echo -e " \033[m\033[41m ERROR \033[0m cryptographic verification failed!"; | ||
| + esac | ||
| +done < "resources.dist" | ||
2 comments
on commit 1b8648d
mbruzek
replied
May 9, 2016
|
Did this code already land? I don't see the normal merge option here? |
|
Its not landed. Its in flight :) i have a lot more to do in here to support this change. |
I don't understand why you are using .PHONY so often in this Makefile. I read up on the feature in Makefiles: https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html it seems only useful when you would have a file with the make target name, or are doing recursive make calls.