Skip to content

Commit

Permalink
fix bug in parse-args.sh, allow cpp lib names to be case sensitive, a…
Browse files Browse the repository at this point in the history
…dd kvikio
  • Loading branch information
trxcllnt committed Jul 26, 2023
1 parent 60e7b24 commit b3ea322
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 29 deletions.
2 changes: 1 addition & 1 deletion features/src/rapids-build-utils/devcontainer-feature.json
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": "23.8.9",
"version": "23.8.10",
"description": "A feature to install the RAPIDS devcontainer build utilities",
"containerEnv": {
"BASH_ENV": "/etc/bash.bash_env"
Expand Down
3 changes: 3 additions & 0 deletions features/src/rapids-build-utils/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ fi

cp -ar ./opt/rapids-build-utils /opt/;

update-alternatives --install /usr/bin/rapids-update-content-command rapids-update-content-command /opt/rapids-build-utils/bin/update-content-command.sh 0;
update-alternatives --install /usr/bin/rapids-post-start-command rapids-post-start-command /opt/rapids-build-utils/bin/post-start-command.sh 0;
update-alternatives --install /usr/bin/rapids-post-attach-command rapids-post-attach-command /opt/rapids-build-utils/bin/post-attach-command.sh 0;
update-alternatives --install /usr/bin/rapids-generate-scripts rapids-generate-scripts /opt/rapids-build-utils/bin/generate-scripts.sh 0;
update-alternatives --install /usr/bin/rapids-join-strings rapids-join-strings /opt/rapids-build-utils/bin/join-strings.sh 0;
update-alternatives --install /usr/bin/rapids-make-conda-env rapids-make-conda-env /opt/rapids-build-utils/bin/make-conda-env.sh 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ generate_cpp_scripts() {

local src="${path}${CPP_SRC:+/$CPP_SRC}";

local args="${CPP_ARGS:-}";

local deps="$(echo -n "${CPP_DEPS:-}" \
| xargs -r -d' ' -I{} bash -c \
'echo -n "-D${0%%/*}_ROOT=\"$(realpath -m ~/$0/build/latest)\" "' \
{} \
)";

local script_name;

for script_name in "configure" "build" "clean"; do
Expand All @@ -92,8 +84,8 @@ generate_cpp_scripts() {
| NAME="${lib}" \
CPP_LIB="${lib}" \
CPP_SRC="${src}" \
CPP_ARGS="${args}" \
CPP_DEPS="${deps}" \
CPP_ARGS="${CPP_ARGS:-}" \
CPP_DEPS="${CPP_DEPS:=}" \
generate_script "${script_name}-${lib}-cpp";
) || true;
done
Expand Down Expand Up @@ -172,11 +164,13 @@ generate_scripts() {
local git_tag="${repo}_git_tag";
local git_upstream="${repo}_git_upstream";

name_to_path[${!repo_name:-}]="${!repo_path:-}";
repo_name="$(tr "[:upper:]" "[:lower:]" <<< "${!repo_name:-}")";

name_to_path["${repo_name:-}"]="${!repo_path:-}";

# Generate a clone script for each repo
(
NAME="${!repo_name:-}" \
NAME="${repo_name:-}" \
SRC_PATH="${!repo_path:-}" \
GIT_TAG="${!git_tag:-}" \
GIT_REPO="${!git_repo:-}" \
Expand All @@ -186,7 +180,7 @@ generate_scripts() {
) || true;

if [[ -d ~/"${!repo_path:-}/.git" ]]; then (
NAME="${!repo_name:-}" \
NAME="${repo_name:-}" \
SRC_PATH="${!repo_path:-}" \
generate_repo_scripts ;
) || true;
Expand All @@ -206,26 +200,32 @@ generate_scripts() {

cpp_libs+=("${!cpp_name:-}");
cpp_dirs+=("${!repo_path:-}/${!cpp_sub_dir:-}");
cpp_name="$(tr "[:upper:]" "[:lower:]" <<< "${!cpp_name:-}")";

name_to_cpp_sub_dir[${!cpp_name:-}]="${!cpp_sub_dir:-}";
name_to_cpp_sub_dir["${cpp_name:-}"]="${!cpp_sub_dir:-}";

local cpp_depends=();
local deps=();

local k=0;

for ((k=0; k < ${!cpp_depends_length:-0}; k+=1)); do
local dep="${repo}_cpp_${j}_depends_${k}";
local dep_name="${name_to_path[${!dep}]}";
local dep_path="${name_to_cpp_sub_dir[${!dep}]}";
cpp_depends+=("${dep_name}${dep_path:+/$dep_path}");
local dep_=$(tr "[:upper:]" "[:lower:]" <<< "${!dep}");
local dep_name="${name_to_path[${dep_}]}";
local dep_path="${name_to_cpp_sub_dir[${dep_}]}";
local dep_dir="${dep_name}${dep_path:+/$dep_path}";

deps+=(-D${!dep}_ROOT=\"$(realpath -m ~/${dep_dir}/build/latest)\");
deps+=(-D$(tr "[:upper:]" "[:lower:]" <<< "${!dep}")_ROOT=\"$(realpath -m ~/${dep_dir}/build/latest)\");
deps+=(-D$(tr "[:lower:]" "[:upper:]" <<< "${!dep}")_ROOT=\"$(realpath -m ~/${dep_dir}/build/latest)\");
done

if [[ -d ~/"${!repo_path:-}/.git" ]]; then (
NAME="${!cpp_name:-}" \
NAME="${cpp_name:-}" \
SRC_PATH="${!repo_path:-}" \
CPP_SRC="${!cpp_sub_dir:-}" \
CPP_ARGS="${!cpp_args:-}" \
CPP_DEPS="${cpp_depends[@]}" \
CPP_DEPS="${deps[@]}" \
generate_cpp_scripts ;
) || true;
fi
Expand All @@ -243,13 +243,15 @@ generate_scripts() {
# scikit-build CMakeLists.txt's aren't 100% consistent in the casing
local cpp_dir="${cpp_dirs[$k]}";
local cpp_lib="${cpp_libs[$k]}";
args+=(-DFIND_${cpp_lib}_CPP=ON);
args+=(-DFIND_$(tr "[:upper:]" "[:lower:]" <<< "${cpp_lib}")_CPP=ON);
args+=(-DFIND_$(tr "[:lower:]" "[:upper:]" <<< "${cpp_lib}")_CPP=ON);
deps+=(-D${cpp_lib}_ROOT=\"$(realpath -m ~/${cpp_dir}/build/latest)\");
deps+=(-D$(tr "[:upper:]" "[:lower:]" <<< "${cpp_lib}")_ROOT=\"$(realpath -m ~/${cpp_dir}/build/latest)\");
deps+=(-D$(tr "[:lower:]" "[:upper:]" <<< "${cpp_lib}")_ROOT=\"$(realpath -m ~/${cpp_dir}/build/latest)\");
done

NAME="${!repo_name:-}" \
NAME="${repo_name:-}" \
SRC_PATH="${!repo_path:-}" \
CPP_ARGS="${args[@]}" \
CPP_DEPS="${deps[@]}" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ clone_${NAME}() {

git -C ~/"${SRC_PATH}" remote prune upstream;

rapids-generate-scripts;

rapids-make-vscode-workspace --update;
rapids-update-content-command;
rapids-post-attach-command;
fi
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,25 @@ repos:
repo: rmm
<<: *git_defaults

- name: kvikio
path: kvikio
cpp:
- name: KvikIO
sub_dir: cpp
depends: []
git:
repo: kvikio
<<: *git_defaults

- name: cudf
path: cudf
cpp:
- name: cudf
sub_dir: cpp
depends: [rmm]
depends: [rmm, KvikIO]
- name: cudf_kafka
sub_dir: cpp/libcudf_kafka
depends: [rmm, cudf]
depends: [rmm, KvikIO, cudf]
git:
repo: cudf
<<: *git_defaults
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": "23.8.11",
"version": "23.8.12",
"description": "A feature to install RAPIDS devcontainer utility scripts",
"containerEnv": {
"BASH_ENV": "/etc/bash.bash_env"
Expand Down
2 changes: 1 addition & 1 deletion features/src/utils/opt/devcontainer/bin/parse-args.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ parse_args() {
key="${key%=*}";
val="${arg#*=}";
# -foo bar | --foo bar
elif grep -qP '^--?[\w]+$' <<< "${arg:-}"; then
elif grep -qP '^--?[^\s]+$' <<< "${arg:-}"; then
shift;
key="${arg#-}";
key="${key#-}";
Expand Down

0 comments on commit b3ea322

Please sign in to comment.