Verified Commit 57a502ea authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

dep_scripts: Allow setting the directory for profiles

parent d4c12451
Loading
Loading
Loading
Loading
+25 −9
Original line number Diff line number Diff line
@@ -50,10 +50,12 @@ declare -A PROFILE_CLONEDEPS_ARGS PROFILE_CLONEDEPS_PATCHES

usage_short() {
	echo "
usage: compile_dep.sh -p PROFILE_NAME[:PROFILE_VERSION] |
usage: compile_dep.sh -h |
                      -p PROFILE_NAME[:PROFILE_VERSION] |
                      -d DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] |
                      -l [PROFILE_NAME:[PROFILE_VERSION]] | -n | -h
                      [ -j COMPILE_CORES]
                      -l [PROFILE_NAME:[PROFILE_VERSION]] |
                      -h
                      [ -P PROFILES_DIR ] [ -j COMPILE_CORES] [ -n ]
                      SOURCES_PATH INSTALL_PATH
	"
}
@@ -70,11 +72,11 @@ positional arguments:


optional arguments:
    -h, --help  shows this help message and exits
    -h, --help  Shows this help message and exits
    -l, --list-dependencies [[PROFILE_NAME:]PROFILE_VERSION]
                list dependencies available for building and installation
                List dependencies available for building and installation
    -p, --profile PROFILE_NAME[:PROFILE_VERSION]
                allows installing a pre-defined set of dependencies as defined
                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
@@ -83,15 +85,19 @@ optional arguments:
                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
                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, the 'latest' version of the specified profile will
                be used.
    -j, --compilecores COMPILE_CORES
                number of cores that are used to compile the dependencies
                defaults to number of available cores
                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
                Choose the directory to be used when searching for profiles.
                If unspecified, PROFILES_DIR defaults to \${PWD}/profiles.
    -n, --dry-run
                Do not actually run, print only what would be done.
"
@@ -361,6 +367,16 @@ while [[ $# -gt 0 ]]; do
        PERFORM_TEST=true
        shift
        ;;
    -P | --profiles-dir)

        if [[ ! -d "$2" ]]; then
            echo "ERROR: PROFILES_DIR '$2' does not exist or is not a directory."
            exit 1
        fi

        PROFILES_DIR="$2"
        shift
        ;;
    -l | --list-dependencies)
        if [[ -z "$2" ]]; then
            list_versions
+25 −9
Original line number Diff line number Diff line
@@ -217,6 +217,9 @@ load_profile() {
    for k in "${!wgetdeps[@]}"; do
        PROFILE_WGETDEPS["${k}"]="${wgetdeps[${k}]}"
    done

    # load source URLs for dependencies
    load_sources
}

load_sources() {
@@ -300,7 +303,9 @@ usage_short() {
    echo "
usage: dl_dep.sh -p PROFILE_NAME[:PROFILE_VERSION] |
                 -d DEPENDENCY_NAME[[@PROFILE_NAME][:PROFILE_VERSION]] |
                 -l [[PROFILE_NAME:]PROFILE_VERSION] | -n | -h
                 -l [[PROFILE_NAME:]PROFILE_VERSION] |
                 -h
                 [ -P PROFILES_DIR ] [ -n ]
                 DESTINATION_PATH
	"
}
@@ -312,15 +317,15 @@ help_msg() {
This script gets all GekkoFS dependency sources (excluding the fs itself)

positional arguments:
        DESTINATION_PATH        path where dependencies should be downloaded
        DESTINATION_PATH        Path where dependencies should be downloaded


optional arguments:
        -h, --help              shows this help message and exits
        -h, --help              Shows this help message and exits
        -l, --list-dependencies [[PROFILE_NAME:]PROFILE_VERSION]
                                list dependency configuration profiles available for download
                                List dependency configuration profiles available for download
        -p, --profile PROFILE_NAME[:PROFILE_VERSION]
                                allows downloading a pre-defined set of dependencies as defined
                                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
@@ -329,10 +334,13 @@ optional arguments:
                                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
                                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,
                                the 'latest' version of the specified profile will be used.
        -P, --profiles-dir PROFILES_DIR
                                Choose the directory to be used when searching for profiles.
                                If unspecified, PROFILES_DIR defaults to \${PWD}/profiles.
        -n, --dry-run           Do not actually run, print only what would be done.
        -v, --verbose           Increase download verbosity
        "
@@ -347,9 +355,6 @@ exec_mode_error() {
# load default profile for now, might be overridden later
load_profile "${DEFAULT_PROFILE}" "${DEFAULT_VERSION}"

# load source URLs for dependencies
load_sources

POSITIONAL=()
while [[ $# -gt 0 ]]; do
    key="$1"
@@ -442,6 +447,17 @@ while [[ $# -gt 0 ]]; do
        VERBOSE=true
        shift # past argument
        ;;
    -P | --profiles-dir)

        if [[ ! -d "$2" ]]; then
            echo "ERROR: PROFILES_DIR '$2' does not exist or is not a directory."
            exit 1
        fi

        PROFILES_DIR="$2"
        SOURCES_FILE="${PROFILES_DIR}/sources.list"
        shift
        ;;
    -n | --dry-run)
        DRY_RUN=true
        shift