Browse Source

Add makefile, run tests during package build

tags/0.4
Filip Pytloun 8 years ago
parent
commit
a09370fc23
2 changed files with 10 additions and 11 deletions
  1. +0
    -3
      debian/install
  2. +10
    -8
      tests/run_tests.sh

+ 0
- 3
debian/install View File

salt/* /usr/share/salt-formulas/env/salt/
metadata/service/* /usr/share/salt-formulas/reclass/service/salt/
_modules/* /usr/share/salt-formulas/env/_modules/

+ 10
- 8
tests/run_tests.sh View File

base: base:
- ${SALT_FILE_DIR} - ${SALT_FILE_DIR}
- ${CURDIR}/.. - ${CURDIR}/..
- /usr/share/salt-formulas/env


pillar_roots: pillar_roots:
base: base:
} }


fetch_dependency() { fetch_dependency() {
dep_root="${DEPSDIR}/$(basename $1 .git)"
dep_name="$(echo $1|cut -d : -f 1)"
dep_source="$(echo $1|cut -d : -f 2)"
dep_root="${DEPSDIR}/$(basename $dep_source .git)"
dep_metadata="${dep_root}/metadata.yml" dep_metadata="${dep_root}/metadata.yml"


[ -d $dep_root ] && log_info "Dependency $1 already fetched" && return 0
[ -d /usr/share/salt-formulas/env/${dep_name} ] && log_info "Dependency $dep_name already present in system-wide salt env" && return 0
[ -d $dep_root ] && log_info "Dependency $dep_name already fetched" && return 0


log_info "Fetching dependency $1"
log_info "Fetching dependency $dep_name"
[ ! -d ${DEPSDIR} ] && mkdir -p ${DEPSDIR} [ ! -d ${DEPSDIR} ] && mkdir -p ${DEPSDIR}
git clone $1 ${DEPSDIR}/$(basename $1 .git) git clone $1 ${DEPSDIR}/$(basename $1 .git)

dep_name=$(cat $dep_metadata | python -c "import sys,yaml; print yaml.load(sys.stdin)['name']")
ln -s ${dep_root}/${dep_name} ${SALT_FILE_DIR}/${dep_name} ln -s ${dep_root}/${dep_name} ${SALT_FILE_DIR}/${dep_name}


METADATA="${dep_metadata}" install_dependencies METADATA="${dep_metadata}" install_dependencies
(python - | while read dep; do fetch_dependency "$dep"; done) << EOF (python - | while read dep; do fetch_dependency "$dep"; done) << EOF
import sys,yaml import sys,yaml
for dep in yaml.load(open('${METADATA}', 'ro'))['dependencies']: for dep in yaml.load(open('${METADATA}', 'ro'))['dependencies']:
print dep["source"]
print '%s:%s' % (dep["name"], dep["source"])
EOF EOF
} }


} }


salt_run() { salt_run() {
source ${VENV_DIR}/bin/activate
[ -e ${VEN_DIR}/bin/activate ] && source ${VENV_DIR}/bin/activate
salt-call ${SALT_OPTS} $* salt-call ${SALT_OPTS} $*
} }


prepare() { prepare() {
[ -d ${BUILDDIR} ] && mkdir -p ${BUILDDIR} [ -d ${BUILDDIR} ] && mkdir -p ${BUILDDIR}


setup_virtualenv
which salt-call || setup_virtualenv
setup_pillar setup_pillar
setup_salt setup_salt
install_dependencies install_dependencies

Loading…
Cancel
Save