From a1807d94008cc932533dd7fff0f78bc8a27fdc66 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 27 Jan 2017 02:38:42 +0300 Subject: Replace in packages package_use function to ENV_* variables. Impliment default package_use function for use ENV_* variables. --- scripts/include/common.sh | 53 +++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 18 deletions(-) (limited to 'scripts/include/common.sh') diff --git a/scripts/include/common.sh b/scripts/include/common.sh index 78f046b..2afe31c 100644 --- a/scripts/include/common.sh +++ b/scripts/include/common.sh @@ -71,22 +71,6 @@ function common_run_package { check_error $? } -function common_use_package { - cd "${scriptsdir}" - check_error $? - export envfile="../env/run${envname}.sh" - echo "#!/bin/bash" >"${envfile}" - check_error $? - echo "" >>"${envfile}" - echo "package_use" - package_use - check_error $? - echo "\$*" >>"${envfile}" - check_error $? - chmod 0755 "${envfile}" - check_error $? -} - function env_path { echo "export PATH=${bindir}/$1:\$PATH" >>"${envfile}" check_error $? @@ -216,9 +200,42 @@ function run_switch_branch { fi } +function repack_paths { + if [[ "$1" == "" ]]; then + return + fi + IFS=":" + packedpaths="" + for var in $1 + do + packedpaths="${packedpaths}${bindir}/$var:" + done + unset IFS + echo "export $2=${packedpaths}\$$2" >>"${envfile}" + check_error $? +} + function package_use { - env_path "bin" - env_lib_library_path "lib" + repack_paths "$ENV_PATH" "PATH" + repack_paths "$ENV_LD_LIBRARY_PATH" "LD_LIBRARY_PATH" + repack_paths "$ENV_PKG_CONFIG_PATH" "PKG_CONFIG_PATH" + repack_paths "$ENV_MANPATH" "MANPATH" +} + +function common_use_package { + cd "${scriptsdir}" + check_error $? + export envfile="../env/run${envname}.sh" + echo "#!/bin/bash" >"${envfile}" + check_error $? + echo "" >>"${envfile}" + echo "package_use" + package_use + check_error $? + echo "\$*" >>"${envfile}" + check_error $? + chmod 0755 "${envfile}" + check_error $? } function package_get_source { -- cgit v1.2.3-70-g09d2