diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-01-27 01:30:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-01-27 01:30:53 +0300 |
commit | b823c0636d902c71e71515fcc160443741d92bcc (patch) | |
tree | b16e352f41e3ff917e506297d3c3c23624ad488a /scripts/include/common.sh | |
parent | bcc8cdc27946b0c4833ab70312d58a76f042c73d (diff) | |
download | spm-b823c0636d902c71e71515fcc160443741d92bcc.tar.gz spm-b823c0636d902c71e71515fcc160443741d92bcc.tar.bz2 spm-b823c0636d902c71e71515fcc160443741d92bcc.tar.xz spm-b823c0636d902c71e71515fcc160443741d92bcc.zip |
Add package varible SRCTYPE. It set src storage type. For now git or hg.
By default it set to git.
Diffstat (limited to 'scripts/include/common.sh')
-rw-r--r-- | scripts/include/common.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/include/common.sh b/scripts/include/common.sh index c00a638..76cf8cc 100644 --- a/scripts/include/common.sh +++ b/scripts/include/common.sh @@ -55,6 +55,7 @@ function common_package_init { fi export packagefile="${package}.sh" + export SRCTYPE="git" if [ ! -f "../packages/${packagefile}" ]; then echo "Error: Package '${package}' not exists." @@ -170,6 +171,17 @@ function run_hg_clone { check_error $? } +function run_clone { + if [[ "${SRCTYPE}" == "git" ]]; then + run_git_clone $1 + elif [[ "${SRCTYPE}" == "hg" ]]; then + run_hg_clone $1 + else + echo "Error: unknown SRCTYPE: ${SRCTYPE}" + exit 1 + fi +} + function run_git_switch_branch { cd "${srcdir}" check_error $? @@ -193,6 +205,17 @@ function run_hg_switch_branch { check_error $? } +function run_switch_branch { + if [[ "${SRCTYPE}" == "git" ]]; then + run_git_switch_branch $1 + elif [[ "${SRCTYPE}" == "hg" ]]; then + run_hg_switch_branch $1 + else + echo "Error: unknown SRCTYPE: ${SRCTYPE}" + exit 1 + fi +} + function package_use { env_path "bin" env_lib_library_path "lib" |