From d35212d4952ef392f25e82e35ccaf2528e58f2f5 Mon Sep 17 00:00:00 2001 From: Julius Athenstaedt Date: Mon, 16 Oct 2023 17:07:23 +0200 Subject: [PATCH 1/4] unify profile mode and dependency into -p option for scripts/dl_dep.sh --- scripts/dl_dep.sh | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/scripts/dl_dep.sh b/scripts/dl_dep.sh index 98ece4830..457ca238e 100755 --- a/scripts/dl_dep.sh +++ b/scripts/dl_dep.sh @@ -81,7 +81,7 @@ list_versions() { profile="$(basename ${filename%%.specs})" versions[$id]+="${profile} " - done < <(find -L "${PROFILES_DIR}" -type f -name "*.specs" -print0 | sort -z) + done < <(find -L "${PROFILES_DIR}" -type f -name "*.specs" -print0 | sort -z) echo -e "Available versions and configuration profiles:\n" @@ -332,7 +332,7 @@ optional arguments: List dependency configuration profiles available for download -p, --profile PROFILE_NAME[:PROFILE_VERSION] Allows downloading a pre-defined set of dependencies as defined - in \${PROFILES_DIR}/PROFILE_NAME.specs. This is useful to + in \${PROFILES_DIR}/PROFILE_NAME.specs. This is useful to deploy specific library versions and/or configurations, using a recognizable name. Optionally, PROFILE_NAME may include a specific version for the profile, e.g. 'mogon2:latest' or @@ -368,27 +368,6 @@ while [[ $# -gt 0 ]]; do case ${key} in -p | --profile) - [ -n "${EXECUTION_MODE}" ] && exec_mode_error || EXECUTION_MODE='profile' - - if [[ -z "$2" ]]; then - echo "ERROR: Missing argument for -p/--profile option" - exit 1 - fi - - if [[ "$2" =~ ^(.*):(.*)$ ]]; then - PROFILE_NAME="${BASH_REMATCH[1]}" - PROFILE_VERSION="${BASH_REMATCH[2]}" - else - PROFILE_NAME="$2" - PROFILE_VERSION="${DEFAULT_VERSION}" - fi - - shift # past argument - shift # past value - ;; - - -d | --dependency) - [ -n "${EXECUTION_MODE}" ] && exec_mode_error || EXECUTION_MODE='dependency' if [[ -z "$2" ]]; then -- GitLab From 263d0cf441fcc16b2b526da9d66fe48e96dd36b3 Mon Sep 17 00:00:00 2001 From: Julius Athenstaedt Date: Mon, 16 Oct 2023 17:08:23 +0200 Subject: [PATCH 2/4] unify profile mode and dependency into -p option for scripts/compile_dep.sh --- scripts/compile_dep.sh | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/scripts/compile_dep.sh b/scripts/compile_dep.sh index 577b80e7b..c0abdcbcc 100755 --- a/scripts/compile_dep.sh +++ b/scripts/compile_dep.sh @@ -90,8 +90,8 @@ optional arguments: unspecified, the 'latest' version of the specified profile will be used. -j, --compilecores COMPILE_CORES - Set the number of cores that will be used to compile the - dependencies. If unspecified, defaults to the number of + Set the number of cores that will be used to compile the + dependencies. If unspecified, defaults to the number of available cores. -t, --test Perform libraries tests. -P, --profiles-dir PROFILES_DIR @@ -373,26 +373,6 @@ while [[ $# -gt 0 ]]; do case ${key} in -p | --profile) - [ -n "${EXECUTION_MODE}" ] && exec_mode_error || EXECUTION_MODE='profile' - - if [[ -z "$2" ]]; then - echo "ERROR: Missing argument for -p/--profile option" - exit 1 - fi - - if [[ "$2" =~ ^(.*):(.*)$ ]]; then - PROFILE_NAME="${BASH_REMATCH[1]}" - PROFILE_VERSION="${BASH_REMATCH[2]}" - else - PROFILE_NAME="$2" - PROFILE_VERSION="${DEFAULT_VERSION}" - fi - - shift # past argument - shift # past value - ;; - -d | --dependency) - [ -n "${EXECUTION_MODE}" ] && exec_mode_error || EXECUTION_MODE='dependency' if [[ -z "$2" ]]; then -- GitLab From 460dbbf06f4958a2febd4dbd9b82ba6e60485d9d Mon Sep 17 00:00:00 2001 From: Julius Athenstaedt Date: Fri, 20 Oct 2023 15:45:11 +0200 Subject: [PATCH 3/4] fix tests for unified profile flag in dependencyscripts --- scripts/compile_dep.sh | 16 +---- scripts/dl_dep.sh | 16 +---- tests/scripts/compile_dep.sh/test.bats | 81 ++++--------------------- tests/scripts/dl_dep.sh/test.bats | 82 ++++---------------------- 4 files changed, 29 insertions(+), 166 deletions(-) diff --git a/scripts/compile_dep.sh b/scripts/compile_dep.sh index c0abdcbcc..276ab9256 100755 --- a/scripts/compile_dep.sh +++ b/scripts/compile_dep.sh @@ -50,8 +50,7 @@ declare -A PROFILE_CLONEDEPS_ARGS PROFILE_CLONEDEPS_PATCHES usage_short() { echo " usage: compile_dep.sh -h | - -p PROFILE_NAME[:PROFILE_VERSION] | - -d DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] | + -p DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] | -l [PROFILE_NAME:[PROFILE_VERSION]] | -h [ -P PROFILES_DIR ] [ -j COMPILE_CORES] [ -n ] @@ -74,16 +73,7 @@ optional arguments: -h, --help Shows this help message and exits -l, --list-dependencies [[PROFILE_NAME:]PROFILE_VERSION] List dependencies available for building and installation - -p, --profile PROFILE_NAME[:PROFILE_VERSION] - Allows installing a pre-defined set of dependencies as defined - in \${PROFILES_DIR}/PROFILE_NAME.specs. This is useful to - deploy specific library versions and/or configurations, - using a recognizable name. Optionally, PROFILE_NAME may include - a specific version for the profile, e.g. 'mogon2:latest' or - 'ngio:0.9.1', which will download the dependencies defined for - that specific version. If unspecified, the 'default:latest' profile - will be used, which should include all the possible dependencies. - -d, --dependency DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] + -p, --profile DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] Build and install a specific dependency, ignoring any --profile option provided. If PROFILE_NAME is unspecified, the 'default' profile will be used. Similarly, if PROFILE_VERSION is @@ -376,7 +366,7 @@ while [[ $# -gt 0 ]]; do [ -n "${EXECUTION_MODE}" ] && exec_mode_error || EXECUTION_MODE='dependency' if [[ -z "$2" ]]; then - echo "ERROR: Missing argument for -d/--dependency option" + echo "ERROR: Missing argument for -p/--profile option" exit fi diff --git a/scripts/dl_dep.sh b/scripts/dl_dep.sh index 457ca238e..eb95d9da3 100755 --- a/scripts/dl_dep.sh +++ b/scripts/dl_dep.sh @@ -307,8 +307,7 @@ wgetdeps() { usage_short() { echo " -usage: dl_dep.sh -p PROFILE_NAME[:PROFILE_VERSION] | - -d DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] | +usage: dl_dep.sh -p DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] | -l [[PROFILE_NAME:]PROFILE_VERSION] | -h [ -P PROFILES_DIR ] [ -n ] @@ -330,16 +329,7 @@ optional arguments: -h, --help Shows this help message and exits -l, --list-dependencies [[PROFILE_NAME:]PROFILE_VERSION] List dependency configuration profiles available for download - -p, --profile PROFILE_NAME[:PROFILE_VERSION] - Allows downloading a pre-defined set of dependencies as defined - in \${PROFILES_DIR}/PROFILE_NAME.specs. This is useful to - deploy specific library versions and/or configurations, - using a recognizable name. Optionally, PROFILE_NAME may include - a specific version for the profile, e.g. 'mogon2:latest' or - 'ngio:0.9.1', which will download the dependencies defined for - that specific version. If unspecified, the 'default:latest' profile - will be used, which should include all the possible dependencies. - -d, --dependency DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] + -p, --profile DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] Build and install a specific dependency, ignoring any --profile option provided. If PROFILE_NAME is unspecified, the 'default' profile will be used. Similarly, if PROFILE_VERSION is unspecified, @@ -371,7 +361,7 @@ while [[ $# -gt 0 ]]; do [ -n "${EXECUTION_MODE}" ] && exec_mode_error || EXECUTION_MODE='dependency' if [[ -z "$2" ]]; then - echo "ERROR: Missing argument for -d/--dependency option" + echo "ERROR: Missing argument for -p/--profile option" exit 1 fi diff --git a/tests/scripts/compile_dep.sh/test.bats b/tests/scripts/compile_dep.sh/test.bats index 244aff136..2d8b8187e 100644 --- a/tests/scripts/compile_dep.sh/test.bats +++ b/tests/scripts/compile_dep.sh/test.bats @@ -14,7 +14,7 @@ setup() { # make sure that the script is able to find the profiles cd ${GIT_ROOTDIR}/scripts - + # make executables in scripts/ visible to PATH PATH="${GIT_ROOTDIR}/scripts:$PATH" } @@ -43,87 +43,28 @@ teardown() { done < "$expected_output" } -@test "[compile_dep.sh] Check --profile and --dependency option at the same time" { - run -1 compile_dep.sh -p foobar -d barbaz - assert_output --partial "ERROR: --profile and --dependency options are mutually exclusive" -} - -@test "[compile_dep.sh] Check --profile option without argument" { - run -1 compile_dep.sh -p - assert_output --partial "ERROR: Missing argument for -p/--profile option" -} - @test "[compile_dep.sh] Check invalid --profile option without SOURCES_PATH or INSTALL_PATH" { run -1 compile_dep.sh -p foo - assert_output --partial "ERROR: Positional arguments missing." + assert_output --partial "ERROR: Positional arguments missing." } @test "[compile_dep.sh] Check invalid --profile option without SOURCES_PATH" { run -1 compile_dep.sh -p foo bar - assert_output --partial "ERROR: Positional arguments missing." -} - -@test "[compile_dep.sh] Check invalid --profile option" { - run -1 compile_dep.sh -p foo bar baz - assert_output --partial "Profile 'foo:latest' does not exist." -} - -@test "[compile_dep.sh] Check valid --profile option, no PROFILE_VERSION" { - - profile_names=($(compile_dep.sh -l latest | perl -lne "print for /^\* (\w+):.*$/")) - - for pn in "${profile_names[@]}"; do - - expected_output=${SCRIPT_TESTDIR}/latest/${pn}.out - - assert_exist $expected_output - - run compile_dep.sh -n -p "${pn}" foo bar - - while IFS= read -r line - do - assert_output --partial "$line" - done < "$expected_output" - done - -} - -@test "[compile_dep.sh] Check valid --profile option, with PROFILE_VERSION" { - - profile_versions=($(compile_dep.sh -l | perl -lne "print for /^\s{2}(.*?):$/")) - - for pv in "${profile_versions[@]}"; do - profile_names=($(compile_dep.sh -l ${pv} | perl -lne "print for /^\* (\w+):.*$/")) - - for pn in "${profile_names[@]}"; do - - expected_output=${SCRIPT_TESTDIR}/${pv}/${pn}.out - - assert_exist $expected_output - - run compile_dep.sh -n -p "${pn}:${pv}" foo bar - - while IFS= read -r line - do - assert_output --partial "$line" - done < "$expected_output" - done - - done + assert_output --partial "ERROR: Positional arguments missing." } -@test "[compile_dep.sh] Check unknown --dependency option" { +@test "[compile_dep.sh] Check unknown --profile option" { profile_name=default profile_version=latest - run -1 compile_dep.sh -n -d foobar bar baz + run -1 compile_dep.sh -n -p foobar bar baz assert_output --partial "Dependency 'foobar' not found in '$profile_name:$profile_version'" } -@test "[compile_dep.sh] Check valid --dependency option, no PROFILE_NAME or PROFILE_VERSION" { +@test "[compile_dep.sh] Check valid --profile option, no PROFILE_NAME or PROFILE_VERSION" { dependency_names=($(compile_dep.sh -l default:latest | perl -lne "print for /^\s{4}(\w+(?::\w+)*):.*$/")) @@ -131,7 +72,7 @@ teardown() { source_path=$(readlink -f ${BATS_TEST_TMPDIR}/foo) install_path=$(readlink -f ${BATS_TEST_TMPDIR}/bar) - run compile_dep.sh -n -d "${dep}" ${source_path} ${install_path} + run compile_dep.sh -n -p "${dep}" ${source_path} ${install_path} assert_output --regexp \ "CORES = [0-9]+ \(default\) @@ -149,7 +90,7 @@ Done" done } -@test "[compile_dep.sh] Check valid --dependency option, PROFILE_NAME only" { +@test "[compile_dep.sh] Check valid --profile option, PROFILE_NAME only" { profile_names=($(compile_dep.sh -l latest | perl -lne "print for /^\* (\w+):.*$/")) @@ -161,7 +102,7 @@ Done" source_path=$(readlink -f ${BATS_TEST_TMPDIR}/foo) install_path=$(readlink -f ${BATS_TEST_TMPDIR}/bar) - run compile_dep.sh -n -d "${dep}@${pn}" ${source_path} ${install_path} + run compile_dep.sh -n -p "${dep}@${pn}" ${source_path} ${install_path} assert_output --regexp \ "CORES = [0-9]+ \(default\) @@ -180,7 +121,7 @@ Done" done } -@test "[compile_dep.sh] Check valid --dependency option, PROFILE_NAME and PROFILE_VERSION" { +@test "[compile_dep.sh] Check valid --profile option, PROFILE_NAME and PROFILE_VERSION" { profile_versions=($(compile_dep.sh -l | perl -lne "print for /^\s{2}(.*?):$/")) @@ -196,7 +137,7 @@ Done" source_path=$(readlink -f ${BATS_TEST_TMPDIR}/foo) install_path=$(readlink -f ${BATS_TEST_TMPDIR}/bar) - run compile_dep.sh -n -d "${dep}@${pn}" ${source_path} ${install_path} + run compile_dep.sh -n -p "${dep}@${pn}" ${source_path} ${install_path} assert_output --regexp \ "CORES = [0-9]+ \(default\) diff --git a/tests/scripts/dl_dep.sh/test.bats b/tests/scripts/dl_dep.sh/test.bats index 51b27ba3a..c3212e49e 100644 --- a/tests/scripts/dl_dep.sh/test.bats +++ b/tests/scripts/dl_dep.sh/test.bats @@ -14,7 +14,7 @@ setup() { # make sure that the script is able to find the profiles cd ${GIT_ROOTDIR}/scripts - + # make executables in scripts/ visible to PATH PATH="${GIT_ROOTDIR}/scripts:$PATH" } @@ -29,7 +29,7 @@ teardown() { assert_output --partial "usage: dl_dep.sh" } -@test "[dl_dep.sh] Check no --profile or --dependency options" { +@test "[dl_dep.sh] Check no --profile options" { expected_output=${SCRIPT_TESTDIR}/latest/default.out @@ -43,11 +43,6 @@ teardown() { done < "$expected_output" } -@test "[dl_dep.sh] Check --profile and --dependency option at the same time" { - run -1 dl_dep.sh -p foobar -d barbaz - assert_output --partial "ERROR: --profile and --dependency options are mutually exclusive" -} - @test "[dl_dep.sh] Check --profile option without argument" { run -1 dl_dep.sh -p assert_output --partial "ERROR: Missing argument for -p/--profile option" @@ -55,86 +50,33 @@ teardown() { @test "[dl_dep.sh] Check invalid --profile option without DESTINATION_PATH" { run -1 dl_dep.sh -p foobar - assert_output --partial "ERROR: Positional arguments missing." + assert_output --partial "ERROR: Positional arguments missing." } @test "[dl_dep.sh] Check valid --profile option without DESTINATION_PATH" { run dl_dep.sh -p default - assert_output --partial "ERROR: Positional arguments missing." + assert_output --partial "ERROR: Positional arguments missing." } -@test "[dl_dep.sh] Check valid --profile option, no PROFILE_VERSION" { - - profile_names=($(dl_dep.sh -l latest | perl -lne "print for /^\* (\w+):.*$/")) - - for pn in "${profile_names[@]}"; do - - expected_output=${SCRIPT_TESTDIR}/latest/${pn}.out - - assert_exist $expected_output - - run dl_dep.sh -n -p "${pn}" "${BATS_TEST_TMPDIR}" - - while IFS= read -r line - do - assert_output --partial "$line" - done < "$expected_output" - done -} - -@test "[dl_dep.sh] Check valid --profile option, with PROFILE_VERSION" { - - profile_versions=($(dl_dep.sh -l | perl -lne "print for /^\s{2}(.*?):$/")) - - for pv in "${profile_versions[@]}"; do - profile_names=($(dl_dep.sh -l ${pv} | perl -lne "print for /^\* (\w+):.*$/")) - - for pn in "${profile_names[@]}"; do - - expected_output=${SCRIPT_TESTDIR}/${pv}/${pn}.out - - assert_exist $expected_output - - run dl_dep.sh -n -p "${pn}:${pv}" "${BATS_TEST_TMPDIR}" - - while IFS= read -r line - do - assert_output --partial "$line" - done < "$expected_output" - done - - done -} - -@test "[dl_dep.sh] Check unknown --dependency option" { +@test "[dl_dep.sh] Check unknown --profile option" { profile_name=default profile_version=latest - run -1 dl_dep.sh -n -d foobar "${BATS_TEST_TMPDIR}" + run -1 dl_dep.sh -n -p foobar "${BATS_TEST_TMPDIR}" assert_output "ERROR: 'foobar' not found in '$profile_name:$profile_version'" } -@test "[dl_dep.sh] Check invalid --dependency option without DESTINATION_PATH" { - run -1 dl_dep.sh -d foobar - assert_output --partial "ERROR: Positional arguments missing." -} - -@test "[dl_dep.sh] Check valid --dependency option without DESTINATION_PATH" { - run dl_dep.sh -d mercury - assert_output --partial "ERROR: Positional arguments missing." -} - -@test "[dl_dep.sh] Check valid --dependency option, no PROFILE_NAME or PROFILE_VERSION" { +@test "[dl_dep.sh] Check valid --profile option, no PROFILE_NAME or PROFILE_VERSION" { dependency_names=($(dl_dep.sh -l default:latest | perl -lne "print for /^\s{4}(\w+(?::\w+)*):.*$/")) for dep in "${dependency_names[@]}"; do destination_path=$(readlink -f ${BATS_TEST_TMPDIR}) - run dl_dep.sh -n -d "${dep}" "${BATS_TEST_TMPDIR}" + run dl_dep.sh -n -p "${dep}" "${BATS_TEST_TMPDIR}" assert_output --regexp \ "Destination path is set to \"${destination_path}\" @@ -147,7 +89,7 @@ Done" done } -@test "[dl_dep.sh] Check valid --dependency option, PROFILE_NAME only" { +@test "[dl_dep.sh] Check valid --profile option, PROFILE_NAME only" { profile_names=($(dl_dep.sh -l latest | perl -lne "print for /^\* (\w+):.*$/")) @@ -158,7 +100,7 @@ Done" for dep in "${dependency_names[@]}"; do destination_path=$(readlink -f ${BATS_TEST_TMPDIR}) - run dl_dep.sh -n -d "${dep}@${pn}" "${BATS_TEST_TMPDIR}" + run dl_dep.sh -n -p "${dep}@${pn}" "${BATS_TEST_TMPDIR}" assert_output --regexp \ "Destination path is set to \"${destination_path}\" @@ -172,7 +114,7 @@ Done" done } -@test "[dl_dep.sh] Check valid --dependency option, PROFILE_NAME and PROFILE_VERSION" { +@test "[dl_dep.sh] Check valid --profile option, PROFILE_NAME and PROFILE_VERSION" { profile_versions=($(dl_dep.sh -l | perl -lne "print for /^\s{2}(.*?):$/")) @@ -186,7 +128,7 @@ Done" for dep in "${dependency_names[@]}"; do destination_path=$(readlink -f ${BATS_TEST_TMPDIR}) - run dl_dep.sh -n -d "${dep}@${pn}:${pv}" "${BATS_TEST_TMPDIR}" + run dl_dep.sh -n -p "${dep}@${pn}:${pv}" "${BATS_TEST_TMPDIR}" assert_output --regexp \ "Destination path is set to \"${destination_path}\" -- GitLab From f92742709cdcd1bd297bd21ef50d2b95d174ac5f Mon Sep 17 00:00:00 2001 From: Julius Athenstaedt Date: Fri, 1 Dec 2023 15:45:43 +0100 Subject: [PATCH 4/4] fix syntax for profiles, e.g. mogon2:0.8.0 or mogon2: for latest --- scripts/compile_dep.sh | 19 ++++++++++++------- scripts/dl_dep.sh | 19 ++++++++++++------- scripts/gkfs_dep.sh | 20 ++++---------------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/scripts/compile_dep.sh b/scripts/compile_dep.sh index 276ab9256..3b11e880f 100755 --- a/scripts/compile_dep.sh +++ b/scripts/compile_dep.sh @@ -50,7 +50,7 @@ declare -A PROFILE_CLONEDEPS_ARGS PROFILE_CLONEDEPS_PATCHES usage_short() { echo " usage: compile_dep.sh -h | - -p DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] | + -p DEPENDENCY_NAME[[@PROFILE_NAME:][PROFILE_VERSION]] | -l [PROFILE_NAME:[PROFILE_VERSION]] | -h [ -P PROFILES_DIR ] [ -j COMPILE_CORES] [ -n ] @@ -73,7 +73,7 @@ optional arguments: -h, --help Shows this help message and exits -l, --list-dependencies [[PROFILE_NAME:]PROFILE_VERSION] List dependencies available for building and installation - -p, --profile DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] + -p, --profile DEPENDENCY_NAME[[@PROFILE_NAME:][PROFILE_VERSION]] Build and install a specific dependency, ignoring any --profile option provided. If PROFILE_NAME is unspecified, the 'default' profile will be used. Similarly, if PROFILE_VERSION is @@ -387,6 +387,16 @@ while [[ $# -gt 0 ]]; do PROFILE_VERSION="${BASH_REMATCH[3]}" fi + # e.g. default:latest + elif [[ "$2" =~ ^(.*):(.*)$ ]]; then + if [[ -n "${BASH_REMATCH[1]}" ]]; then + PROFILE_NAME="${BASH_REMATCH[1]}" + fi + + if [[ -n "${BASH_REMATCH[2]}" ]]; then + PROFILE_VERSION="${BASH_REMATCH[2]}" + fi + # e.g. mercury@mogon1 elif [[ "$2" =~ ^(.*)@(.*)$ ]]; then if [[ -n "${BASH_REMATCH[1]}" ]]; then @@ -401,11 +411,6 @@ while [[ $# -gt 0 ]]; do DEPENDENCY="$2" fi - if [[ ! -n "${DEPENDENCY}" ]]; then - echo "ERROR: Missing dependency name." - exit 1 - fi - shift # past argument shift # past value ;; diff --git a/scripts/dl_dep.sh b/scripts/dl_dep.sh index eb95d9da3..efef420ca 100755 --- a/scripts/dl_dep.sh +++ b/scripts/dl_dep.sh @@ -307,7 +307,7 @@ wgetdeps() { usage_short() { echo " -usage: dl_dep.sh -p DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] | +usage: dl_dep.sh -p DEPENDENCY_NAME[[@PROFILE_NAME:][PROFILE_VERSION]] | -l [[PROFILE_NAME:]PROFILE_VERSION] | -h [ -P PROFILES_DIR ] [ -n ] @@ -329,7 +329,7 @@ optional arguments: -h, --help Shows this help message and exits -l, --list-dependencies [[PROFILE_NAME:]PROFILE_VERSION] List dependency configuration profiles available for download - -p, --profile DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] + -p, --profile DEPENDENCY_NAME[[@PROFILE_NAME:][PROFILE_VERSION]] Build and install a specific dependency, ignoring any --profile option provided. If PROFILE_NAME is unspecified, the 'default' profile will be used. Similarly, if PROFILE_VERSION is unspecified, @@ -379,6 +379,16 @@ while [[ $# -gt 0 ]]; do PROFILE_VERSION="${BASH_REMATCH[3]}" fi + # e.g. default:latest + elif [[ "$2" =~ ^(.*):(.*)$ ]]; then + if [[ -n "${BASH_REMATCH[1]}" ]]; then + PROFILE_NAME="${BASH_REMATCH[1]}" + fi + + if [[ -n "${BASH_REMATCH[2]}" ]]; then + PROFILE_VERSION="${BASH_REMATCH[2]}" + fi + # e.g. mercury@mogon1 elif [[ "$2" =~ ^(.*)@(.*)$ ]]; then if [[ -n "${BASH_REMATCH[1]}" ]]; then @@ -393,11 +403,6 @@ while [[ $# -gt 0 ]]; do DEPENDENCY="$2" fi - if [[ ! -n "${DEPENDENCY}" ]]; then - echo "ERROR: Missing dependency name." - exit 1 - fi - shift # past argument shift # past value ;; diff --git a/scripts/gkfs_dep.sh b/scripts/gkfs_dep.sh index 891aff50e..6977ba394 100755 --- a/scripts/gkfs_dep.sh +++ b/scripts/gkfs_dep.sh @@ -32,8 +32,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" usage_short() { echo " usage: compile_dep.sh -h | - -p PROFILE_NAME[:PROFILE_VERSION] | - -d DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] | + -p DEPENDENCY_NAME[[@PROFILE_NAME:][PROFILE_VERSION]] | -l [PROFILE_NAME:[PROFILE_VERSION]] | -h [ -P PROFILES_DIR ] [ -j COMPILE_CORES] [ -n ] [ -v ] @@ -56,7 +55,7 @@ optional arguments: -h, --help Shows this help message and exits -l, --list-dependencies [[PROFILE_NAME:]PROFILE_VERSION] List dependencies available for building and installation - -p, --profile PROFILE_NAME[:PROFILE_VERSION] + -p, --dependency DEPENDENCY_NAME[[@PROFILE_NAME:][PROFILE_VERSION]] Allows installing a pre-defined set of dependencies as defined in \${PROFILES_DIR}/PROFILE_NAME.specs. This is useful to deploy specific library versions and/or configurations, @@ -65,7 +64,6 @@ optional arguments: 'ngio:0.9.1', which will download the dependencies defined for that specific version. If unspecified, the 'default:latest' profile will be used, which should include all the possible dependencies. - -d, --dependency DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] Build and install a specific dependency, ignoring any --profile option provided. If PROFILE_NAME is unspecified, the 'default' profile will be used. Similarly, if PROFILE_VERSION is @@ -100,11 +98,6 @@ while [[ $# -gt 0 ]]; do shift # past argument shift # past value ;; - -d | --dependency) - DEPENDENCY="$2" - shift # past argument - shift # past value - ;; -j | --compilecores) COMPILE_ARGS="$COMPILE_ARGS -j $2" shift # past argument @@ -156,12 +149,7 @@ fi SOURCE_DIR="$(readlink -mn "${1}")" INSTALL_DIR="$(readlink -mn "${2}")" # build arguments -if [[ -n $DEPENDENCY ]]; then - PROFILE_STR="-d $DEPENDENCY" - if [[ -n $PROFILE ]]; then - PROFILE_STR="$PROFILE_STR@$PROFILE" - fi -elif [[ -n $PROFILE ]]; then +if [[ -n $PROFILE ]]; then PROFILE_STR="-p $PROFILE" fi if [[ -n $PROFILE_STR ]]; then @@ -182,4 +170,4 @@ echo -e "\n\n##############################" echo "# Compiling dependencies ... #" echo "##############################" [[ "$VERBOSE" == true ]] && echo "# COMPILE_CMD: $COMPILE_CMD" -$COMPILE_CMD || exit 1 \ No newline at end of file +$COMPILE_CMD || exit 1 -- GitLab