summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-01-27 02:38:42 +0300
committerAndrei Karas <akaras@inbox.ru>2017-01-27 02:38:42 +0300
commita1807d94008cc932533dd7fff0f78bc8a27fdc66 (patch)
treef13fed8d79d984010cabce5d4f323d99ec3da0e4 /scripts
parentecbc19b90ea893e3934cad6d6542ebc7e5e1a777 (diff)
downloadspm-a1807d94008cc932533dd7fff0f78bc8a27fdc66.tar.gz
spm-a1807d94008cc932533dd7fff0f78bc8a27fdc66.tar.bz2
spm-a1807d94008cc932533dd7fff0f78bc8a27fdc66.tar.xz
spm-a1807d94008cc932533dd7fff0f78bc8a27fdc66.zip
Replace in packages package_use function to ENV_* variables.
Impliment default package_use function for use ENV_* variables.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/include/common.sh53
1 files changed, 35 insertions, 18 deletions
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 {