Skip to content

Commit

Permalink
Fix common_startup.sh for galaxy tarballs
Browse files Browse the repository at this point in the history
Do not assume git is installed and the `.git` directory is present.

Fix #5466
  • Loading branch information
nsoranzo committed Feb 8, 2018
1 parent 977bbf1 commit eba3fb4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"build-production": "NODE_ENV=production gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack-production\" \"yarn run gulp clean && yarn run gulp-production\" && yarn run save-build-hash",
"build-production-maps": "NODE_ENV=production gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack-production-maps\" \"yarn run gulp clean && yarn run gulp-production-maps\" && yarn run save-build-hash",
"webpack": "webpack -d",
"save-build-hash": "git rev-parse HEAD > ../static/client_build_hash.txt",
"save-build-hash": "(git rev-parse HEAD 2>/dev/null || echo '') >../static/client_build_hash.txt",
"webpack-watch": "webpack -d --watch",
"webpack-production": "webpack -p",
"webpack-production-maps": "GXY_BUILD_SOURCEMAPS=1 webpack -p",
Expand Down
26 changes: 16 additions & 10 deletions scripts/common_startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ for rmfile in $RMFILES; do
done

# Determine branch (if using git)
if command -v git >/dev/null; then
if command -v git >/dev/null && [ -d .git ]; then
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
case $GIT_BRANCH in
release_*|master)
Expand All @@ -93,7 +93,7 @@ if command -v git >/dev/null; then
esac
else
GIT_BRANCH=0
SKIP_CLIENT_BUILD=1
DEV_WHEELS=1
fi

: ${GALAXY_CONFIG_FILE:=config/galaxy.yml}
Expand All @@ -120,7 +120,7 @@ if [ $SET_VENV -eq 1 -a $CREATE_VENV -eq 1 ]; then
# Ensure Python is a supported version before creating .venv
python ./scripts/check_python.py || exit 1
if command -v virtualenv >/dev/null; then
virtualenv -p python2.7 "$GALAXY_VIRTUAL_ENV"
virtualenv -p "$(command -v python)" "$GALAXY_VIRTUAL_ENV"
else
vvers=13.1.2
vurl="https://pypi.python.org/packages/source/v/virtualenv/virtualenv-${vvers}.tar.gz"
Expand Down Expand Up @@ -192,13 +192,19 @@ fi
# Check client build state.
if [ $SKIP_CLIENT_BUILD -eq 0 ]; then
if [ -f static/client_build_hash.txt ]; then
# Compare hash.
githash=$(git rev-parse HEAD)
statichash=$(cat static/client_build_hash.txt)
if [ "$githash" = "$statichash" ]; then
# If git is not used and static/client_build_hash.txt is present, next
# client rebuilds must be done manually by the admin
if [ "$GIT_BRANCH" = "0" ]; then
SKIP_CLIENT_BUILD=1
else
echo "The Galaxy client is out of date and will be built now."
# Compare hash.
githash=$(git rev-parse HEAD)
statichash=$(cat static/client_build_hash.txt)
if [ "$githash" = "$statichash" ]; then
SKIP_CLIENT_BUILD=1
else
echo "The Galaxy client is out of date and will be built now."
fi
fi
else
echo "The Galaxy client has not yet been built and will be built now."
Expand All @@ -209,11 +215,11 @@ fi
if [ $SKIP_CLIENT_BUILD -eq 0 ]; then
# Ensure dependencies are installed
if [ -n "$VIRTUAL_ENV" ]; then
if ! in_venv `command -v node`; then
if ! in_venv "$(command -v node)"; then
echo "Installing node into $VIRTUAL_ENV with nodeenv."
nodeenv -p
fi
if ! in_venv `command -v yarn`; then
if ! in_venv "$(command -v yarn)"; then
echo "Installing yarn into $VIRTUAL_ENV with npm."
npm install --global yarn
fi
Expand Down

0 comments on commit eba3fb4

Please sign in to comment.