spcd_git_clone

This commit is contained in:
Marc Beninca 2024-08-23 17:26:28 +02:00
parent 582900d46b
commit 488f8513d3
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 18 additions and 11 deletions

View file

@ -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

28
spcd.sh
View file

@ -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