From 488f8513d315d15ecc79b70a9eda0b89bdc359ec Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 23 Aug 2024 17:26:28 +0200 Subject: [PATCH] spcd_git_clone --- readme.md | 1 - spcd.sh | 28 ++++++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/readme.md b/readme.md index 96562cb..7d6e3c9 100644 --- a/readme.md +++ b/readme.md @@ -219,7 +219,6 @@ Handle project workflows in a unified way: * opensuse * codecs repository * disable & enable https -* write function to clone git repositories * write unit tests ### Shell → Python diff --git a/spcd.sh b/spcd.sh index ac1e6f4..331dea6 100644 --- a/spcd.sh +++ b/spcd.sh @@ -715,17 +715,10 @@ spcd_install_python_modules() { spcd_step "Install Python modules" spcd_ipm__target="${SPCD_PYTHON_VENV_PACKAGES}" for spcd_ipm__repository in "${SPCD_GIT_MAIN}" "${SPCD_GIT_ROOT}"; do - spcd_ipm__url="$(spcd_git_url "${spcd_ipm__repository}")" - spcd_ipm__name="$(basename "${spcd_ipm__url}")" spcd_split - echo "\ -${spcd_ipm__url} -↓" - git clone \ - "${spcd_ipm__url}" \ - "${SPCD_DL}/${spcd_ipm__name}" || - exit - spcd_ipm__path="${SPCD_DL}/${spcd_ipm__name}/${spcd_ipm__name}" + spcd_ipm__path="$(spcd_git_clone "${spcd_ipm__repository}")" + spcd_ipm__name="$(basename "${spcd_ipm__path}")" + spcd_ipm__path="${spcd_ipm__path}/${spcd_ipm__name}" echo "\ ${spcd_ipm__path} ↓ @@ -880,6 +873,21 @@ spcd_error_os() { exit "${SPCD_ERROR_OS}" } +spcd_git_clone() { + if [ -n "${1}" ]; then + spcd_gc__name="$(basename "${1}")" + spcd_gc__path="${SPCD_DL}/${spcd_gc__name}" + spcd_gc__url="$(spcd_git_url "${1}")" + echo "\ +${spcd_gc__url} +↓" + git clone \ + "${spcd_gc__url}" \ + "${spcd_gc__path}" + echo "${spcd_gc__path}" + fi +} + spcd_git_url() { if [ -n "${1}" ]; then case "${1}" in