osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41372?usp=email )
Change subject: hlr: testenv: fix running pyhss from debian pkg ......................................................................
hlr: testenv: fix running pyhss from debian pkg
Move the run_in_venv.sh script that is only used by pyhss from the generic location _testenv/data/scripts/run_in_venv.sh to hlr/pyhss/run_in_venv.sh and hardcode the path /opt/venvs/pyhss/bin/activate in there when running from binary packages. This is the path used in the binary package in the Osmocom OBS, the default path from dh_virtualenv. The package doesn't install pyhss_gsup etc. to /usr/bin, as these are usually not meant to be directly started without the systemd services that have the /opt/venvs/pyhss path hardcoded.
Also put 'export PYHSS_CONFIG=config.yaml' in there, now that the script is pyhss specific.
Related: https://dh-virtualenv.readthedocs.io/en/1.2.1/usage.html Change-Id: I0cdf1a9f220ddd2ef0866d0d11d1e3f6056a1cba --- D _testenv/data/scripts/run_in_venv.sh A hlr/pyhss/run_in_venv.sh M hlr/testenv_pyhss.cfg 3 files changed, 15 insertions(+), 9 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/72/41372/1
diff --git a/_testenv/data/scripts/run_in_venv.sh b/_testenv/data/scripts/run_in_venv.sh deleted file mode 100755 index b953a36..0000000 --- a/_testenv/data/scripts/run_in_venv.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -e -if [ -n "$TESTENV_INSTALL_DIR" ]; then - . "$TESTENV_INSTALL_DIR"/venv/bin/activate -fi - -"$@" diff --git a/hlr/pyhss/run_in_venv.sh b/hlr/pyhss/run_in_venv.sh new file mode 100755 index 0000000..a145a7d --- /dev/null +++ b/hlr/pyhss/run_in_venv.sh @@ -0,0 +1,12 @@ +#!/bin/sh -e +export PYHSS_CONFIG=config.yaml + +if [ "$TESTENV_INSTALL_DIR" = "/" ]; then + # Installed via debian package + . /opt/venvs/pyhss/bin/activate +else + # Built with osmo-dev + . "$TESTENV_INSTALL_DIR"/venv/bin/activate +fi + +"$@" diff --git a/hlr/testenv_pyhss.cfg b/hlr/testenv_pyhss.cfg index 4666d2d..9e9d430 100644 --- a/hlr/testenv_pyhss.cfg +++ b/hlr/testenv_pyhss.cfg @@ -5,14 +5,14 @@ copy=pyhss/HLR_Tests.cfg
[pyhss_gsup] -program=PYHSS_CONFIG=config.yaml run_in_venv.sh pyhss_gsup +program=./run_in_venv.sh pyhss_gsup setup=wait_for_port.py -p 4222 make=pyhss package=pyhss -copy=pyhss/config.yaml +copy=pyhss/config.yaml pyhss/run_in_venv.sh
[pyhss_api] -program=cd ../pyhss_gsup && PYHSS_CONFIG=config.yaml run_in_venv.sh pyhss_api +program=cd ../pyhss_gsup && ./run_in_venv.sh pyhss_api setup=./setup_db.sh make=pyhss package=pyhss