Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up zopen build env processing #592

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions bin/zopen-build
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ loadBuildEnv()
printError "Build environment file '${buildEnvFile}' does not exist or is not readable"
fi

# Indicates to .env script that we're in zopen build
# Indicates to .appenv script that we're in zopen build
export ZOPEN_IN_ZOPEN_BUILD="$LOGNAME.$$.$RANDOM"

. ${buildEnvFile}
Expand Down Expand Up @@ -621,22 +621,28 @@ setDepsEnv()
requestedVersion="${requestedMajor}.${requestedMinor}.${requestedPatch}.${requestedSubrelease}"
foundDep=false
for path in $(echo ${depsPath} | tr '|' '\n'); do
if [ -r "${path}/${dep}/${dep}/.env" ]; then
if [ -r "${path}/${dep}/${dep}/.appenv" ]; then
depdir="${path}/${dep}/${dep}"
versionPath="${depdir}/.version"
if [ -r "${versionPath}" ]; then
version=$(cat "${versionPath}")
fi
# Avoid double sourcing the .env if we're forcing an upgrade on it
# Avoid double sourcing the .appenv if we're forcing an upgrade on it
if ! ${forceUpgradeDeps}; then
if ! validateVersion "${version}" "${operator}" "${requestedVersion}" "${depdir}"; then
continue
fi

printVerbose "Setting up ${depdir} dependency environment"
cd "${depdir}" && . ./.env
# Set expected environment variables
#TODO: migrate _HOME variables from .env to .appenv
depUpper=$(echo "${dep}" | awk '{print toupper($0)}')
export ${depUpper}_HOME="${depdir}"
export PATH="${depdir}/bin:$PATH"
export LIBPATH="${depdir}/lib:$LIBPATH"
cd "${depdir}" && . ./.appenv
if [ $? -gt 0 ]; then
printError "Failed to source ${depdir} .env"
printError "Failed to source ${depdir} .appenv"
fi
fi
foundDep=true
Expand Down
2 changes: 1 addition & 1 deletion bin/zopen-generate
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ while ! ${valid}; do
categories=$(getInput)
categories=$(printf "%s" "${categories}" | tr '[:upper:]' '[:lower:]')
error=false
if [ -z ${categories} ]; then
if [ -z "${categories}" ]; then
printError "No category specified"
exit 8
fi
Expand Down
Loading