Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "NVIDIA RAPIDS devcontainer build utilities",
"id": "rapids-build-utils",
"version": "26.8.4",
"version": "26.8.5",
"description": "A feature to install the RAPIDS devcontainer build utilities",
"containerEnv": {
"BASH_ENV": "/etc/bash.bash_env"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
# shellcheck disable=SC1091
. rapids-generate-docstring;

repo_exists() {
local repo_path="${1:-}";
git -C "${repo_path}" rev-parse --is-inside-work-tree >/dev/null 2>&1;
}

# Function to convert ucx branch names
convert-ucx-branch() {
repo=$1
Expand Down Expand Up @@ -61,7 +66,7 @@ checkout_same_branch() {
local repo="repos_${i}";
local repo_name="${repo}_name";
local repo_path="${repo}_path";
if [[ ! -d ~/"${!repo_path:-}/.git" ]]; then
if ! repo_exists ~/"${!repo_path:-}"; then
continue;
fi
local name="${!repo_name}";
Expand Down Expand Up @@ -146,7 +151,7 @@ checkout_same_branch() {
local repo_name="${repo}_name";
local repo_path="${repo}_path";

if [[ ! -d ~/"${!repo_path:-}/.git" ]]; then
if ! repo_exists ~/"${!repo_path:-}"; then
continue;
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ generate_all_script() {
fi
}

repo_exists() {
local repo_path="${1:-}";
git -C "${repo_path}" rev-parse --is-inside-work-tree >/dev/null 2>&1;
}

generate_clone_script() {
if test -f "${TEMPLATES}/repo.clone.tmpl.sh"; then (
# shellcheck disable=SC2002
Expand Down Expand Up @@ -269,7 +274,7 @@ generate_scripts() {
repo_name="${!repo_name,,}";
repo_names+=("${repo_name}");

if [[ -d ~/"${!repo_path:-}/.git" ]]; then
if repo_exists ~/"${!repo_path:-}"; then
cloned_repos+=("${repo_name}");
fi

Expand Down Expand Up @@ -318,7 +323,7 @@ generate_scripts() {

cpp_name_to_deps["${cpp_name}"]="${cpp_deps[*]}";

if [[ -d ~/"${!repo_path:-}/.git" ]]; then
if repo_exists ~/"${!repo_path:-}"; then
NAME="${repo_name:-}" \
SRC_PATH=~/"${!repo_path:-}" \
BIN_DIR="${bin_dir}" \
Expand Down Expand Up @@ -377,7 +382,7 @@ generate_scripts() {
py_name="${!py_name:-}";
py_libs+=("${py_name}");

if [[ -d ~/"${!repo_path:-}/.git" ]]; then
if repo_exists ~/"${!repo_path:-}"; then
NAME="${repo_name:-}" \
BIN_DIR="${bin_dir}" \
SRC_PATH=~/"${!repo_path:-}" \
Expand All @@ -399,7 +404,7 @@ generate_scripts() {

py_names+=("${py_libs[@]}");

if [[ -d ~/"${!repo_path:-}/.git" ]]; then
if repo_exists ~/"${!repo_path:-}"; then
NAME="${repo_name:-}" \
PY_LIB="${py_libs[*]@Q}" \
CPP_LIB="${cpp_libs[*]@Q}" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ get_repos() {
}

with_git_dirs() {
cat - | xargs -r -d'\n' -I% bash -c 'if [ -d ~/%/.git ]; then echo %; fi;';
cat - | xargs -r -d'\n' -I% bash -c 'if git -C ~/% rev-parse --is-inside-work-tree >/dev/null 2>&1; then echo %; fi;';
}

lib_entries() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# shellcheck disable=SC1091
. rapids-generate-docstring;

repo_exists() {
local repo_path="${1:-}";
git -C "${repo_path}" rev-parse --is-inside-work-tree >/dev/null 2>&1;
}

_list_repo_paths() {
for ((i=0; i < ${repos_length:-0}; i+=1)); do

Expand All @@ -22,7 +27,7 @@ _list_repo_paths() {
local cpp_length="${repo}_cpp_length";
local py_length="${repo}_python_length";

if test -d ~/"${!repo_path:-}/.git"; then
if repo_exists ~/"${!repo_path:-}"; then

for ((j=0; j < ${!cpp_length:-0}; j+=1)); do
local cpp_sub_dir="${repo}_cpp_${j}_sub_dir";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
# shellcheck disable=SC1091
. rapids-generate-docstring;

repo_exists() {
local repo_path="${1:-}";
git -C "${repo_path}" rev-parse --is-inside-work-tree >/dev/null 2>&1;
}

pull_repositories() {
local -;
set -euo pipefail;
Expand All @@ -38,7 +43,7 @@ pull_repositories() {
local repo_name="${repo}_name";
local repo_path="${repo}_path";

if [[ ! -d ~/"${!repo_path:-}/.git" ]]; then
if ! repo_exists ~/"${!repo_path:-}"; then
continue;
fi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# shellcheck disable=SC1091
. rapids-generate-docstring;

repo_exists() {
local repo_path="${1:-}";
git -C "${repo_path}" rev-parse --is-inside-work-tree >/dev/null 2>&1;
}

push_repositories() {
local -;
set -euo pipefail;
Expand All @@ -31,7 +36,7 @@ push_repositories() {
local repo_name="${repo}_name";
local repo_path="${repo}_path";

if [[ ! -d ~/"${!repo_path:-}/.git" ]]; then
if ! repo_exists ~/"${!repo_path:-}"; then
continue;
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
# shellcheck disable=SC1091
. rapids-generate-docstring;

repo_exists() {
local repo_path="${1:-}";
git -C "${repo_path}" rev-parse --is-inside-work-tree >/dev/null 2>&1;
}

_python_conda_pkg_names() {
local -;
set -euo pipefail;
Expand All @@ -35,7 +40,7 @@ _python_conda_pkg_names() {
local repo="repos_${i}";
local repo_path="${repo}_path";

if test -d ~/"${!repo_path:-}/.git"; then
if repo_exists ~/"${!repo_path:-}"; then
# the regex will continue until morale improves
find ~/"${!repo_path}/" \
-type f \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# shellcheck disable=SC1091
. rapids-generate-docstring;

repo_exists() {
local repo_path="${1:-}";
git -C "${repo_path}" rev-parse --is-inside-work-tree >/dev/null 2>&1;
}

python_pkg_names() {
local -;
set -euo pipefail;
Expand All @@ -34,7 +39,7 @@ python_pkg_names() {
local repo_path="${repo}_path";
local py_length="${repo}_python_length";

if test -d ~/"${!repo_path:-}/.git"; then
if repo_exists ~/"${!repo_path:-}"; then
for ((j=0; j < ${!py_length:-0}; j+=1)); do
local py_name="${repo}_python_${j}_name";
echo "${!py_name}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# shellcheck disable=SC1091
. rapids-generate-docstring;

repo_exists() {
local repo_path="${1:-}";
git -C "${repo_path}" rev-parse --is-inside-work-tree >/dev/null 2>&1;
}

python_pkg_roots() {
local -;
set -euo pipefail;
Expand All @@ -34,7 +39,7 @@ python_pkg_roots() {
local repo_path="${repo}_path";
local py_length="${repo}_python_length";

if test -d ~/"${!repo_path:-}/.git"; then
if repo_exists ~/"${!repo_path:-}"; then
for ((j=0; j < ${!py_length:-0}; j+=1)); do
local py_sub_dir="${repo}_python_${j}_sub_dir";
echo "${!repo_path:-}${!py_sub_dir:+/${!py_sub_dir}}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
# shellcheck disable=SC1091
. rapids-generate-docstring;

repo_exists() {
local repo_path="${1:-}";
git -C "${repo_path}" rev-parse --is-inside-work-tree >/dev/null 2>&1;
}

_get_library_paths() {
local i;
local j;
Expand All @@ -27,7 +32,7 @@ _get_library_paths() {
local cpp_length="${repo}_cpp_length";
local py_length="${repo}_python_length";

if test -d ~/"${!repo_path:-}/.git"; then
if repo_exists ~/"${!repo_path:-}"; then

for ((j=0; j < ${!cpp_length:-0}; j+=1)); do
local cpp_sub_dir="${repo}_cpp_${j}_sub_dir";
Expand Down
2 changes: 1 addition & 1 deletion features/src/utils/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "devcontainer-utils",
"id": "utils",
"version": "26.8.1",
"version": "26.8.2",
"description": "A feature to install RAPIDS devcontainer utility scripts",
"containerEnv": {
"BASH_ENV": "/etc/bash.bash_env"
Expand Down
9 changes: 7 additions & 2 deletions features/src/utils/opt/devcontainer/bin/git/repo/clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ clone_git_repo() {
local origin;
local directory;

repo_exists() {
local repo_path="${1:-}";
git -C "${repo_path}" rev-parse --is-inside-work-tree >/dev/null 2>&1;
}

local nargs="${#REST[@]}";

if test "${nargs}" -gt 1; then
Expand All @@ -52,7 +57,7 @@ clone_git_repo() {
local re="(ssh:\/\/|https:\/\/)?(git@)?(.*\.com)[:\/](.*)";
if [[ "${origin}" =~ ${re} ]]; then
directory="$(basename "${BASH_REMATCH[4]//.git/}")";
elif test -d "${origin}" && test -d "${origin}"/.git; then
elif test -d "${origin}" && repo_exists "${origin}"; then
directory="$(basename "${origin}")";
else
echo "fatal: '${origin}' is not a git repository" 1>&2;
Expand All @@ -66,7 +71,7 @@ clone_git_repo() {
upstream="${upstream:-"${origin}"}";
directory="$(realpath -m "${directory}")";

if ! test -d "${directory}"/.git; then
if ! repo_exists "${directory}"; then
git clone "${qj[@]}" "${OPTS[@]}" -- "${origin}" "${directory}";
fi

Expand Down
Loading