diff options
Diffstat (limited to 'docker/scripts/lib_csit.sh')
-rw-r--r-- | docker/scripts/lib_csit.sh | 90 |
1 files changed, 43 insertions, 47 deletions
diff --git a/docker/scripts/lib_csit.sh b/docker/scripts/lib_csit.sh index 36ab0b27d..2e877f803 100644 --- a/docker/scripts/lib_csit.sh +++ b/docker/scripts/lib_csit.sh @@ -20,7 +20,7 @@ if [ -n "$(alias lib_csit_imported 2> /dev/null)" ] ; then fi alias lib_csit_imported=true -export CIMAN_DOCKER_SCRIPTS="${CIMAN_DOCKER_SCRIPTS:-$(dirname $BASH_SOURCE)}" +export CIMAN_DOCKER_SCRIPTS="${CIMAN_DOCKER_SCRIPTS:-$(dirname ${BASH_SOURCE[0]})}" . "$CIMAN_DOCKER_SCRIPTS/lib_common.sh" . "$CIMAN_DOCKER_SCRIPTS/lib_apt.sh" @@ -50,7 +50,7 @@ csit_checkout_branch_for_vpp() { && source "$csit_bash_function_dir/branch.sh" CSIT_DIR="$csit_dir" checkout_csit_for_vpp "$vpp_branch" - # shellcheck disable=SC2034 + # shellcheck disable=SC2034,SC2063 csit_branch="$(git branch | grep -e '^*' | mawk '{print $2}')" } @@ -69,14 +69,14 @@ csit_install_packages() { git clean -qfdx python3 -m pip install pyyaml - local exclude_roles="-e calibration -e kernel -e mellanox -e nomad -e consul" + local exclude_roles="-e calibration -e kernel -e mellanox -e nomad -e consul -e aws -e vpp" [ "$OS_ARCH" = "aarch64" ] && exclude_roles="$exclude_roles -e iperf" # Not in double quotes to let bash remove newline characters local yaml_files yaml_files="$(grep -r packages_by $csit_ansible_dir | cut -d: -f1 | sort -u | grep -v $exclude_roles)" packages="$(dbld_csit_find_ansible_packages.py --$OS_ID --$OS_ARCH $yaml_files)" - packages="${packages/bionic /}" + packages="${packages/jammy /}" packages="${packages/focal /}" packages="${packages/libmbedcrypto1/libmbedcrypto3}" packages="${packages/libmbedtls10/libmbedtls12}" @@ -85,10 +85,10 @@ csit_install_packages() { if [ -n "$packages" ] ; then case "$OS_NAME" in ubuntu*) - apt_install_packages $packages + apt_install_packages "$packages" 2>&1 | tee -a "$bld_log" ;; debian*) - apt_install_packages $packages + apt_install_packages "$packages" 2>&1 | tee -a "$bld_log" ;; *) echo "Unsupported OS ($OS_ID): CSIT packages NOT INSTALLED!" @@ -97,6 +97,35 @@ csit_install_packages() { fi } +csit_install_hugo() { + local branch="$1" + CSIT_DIR="$DOCKER_CSIT_DIR" + + if [ -f "$CSIT_DIR/VPP_REPO_URL" ] \ + && [ -f "$CSIT_DIR/requirements.txt" ]; then + + local branchname + # use bash variable substitution to replace '/' with '_' to convert from + # vpp to csit branch name nomenclature + branchname="${branch////_}" + local csit_bash_function_dir="$CSIT_DIR/resources/libraries/bash/function" + local bld_log="$DOCKER_BUILD_LOG_DIR" + bld_log="${bld_log}/$FDIOTOOLS_IMAGENAME-$branchname-csit_install_hugo-bld.log" + + description="Install CSIT hugo packages from $branch branch" + echo_log " Starting $description..." + git clean -qfdx + + source "$csit_bash_function_dir"/hugo.sh + go_install 2>&1 | tee -a "$bld_log" + hugo_install 2>&1 | tee -a "$bld_log" + + else + echo_log "ERROR: Missing or invalid CSIT_DIR: '$CSIT_DIR'!" + return 1 + fi +} + csit_pip_cache() { local branch="$1" # ensure PS1 is defined (used by virtualenv activate script) @@ -113,60 +142,27 @@ csit_pip_cache() { local csit_bash_function_dir="$CSIT_DIR/resources/libraries/bash/function" local bld_log="$DOCKER_BUILD_LOG_DIR" bld_log="${bld_log}/$FDIOTOOLS_IMAGENAME-$branchname-csit_pip_cache-bld.log" - local pip_cmd="python3 -m pip --disable-pip-version-check" export PYTHONPATH=$CSIT_DIR description="Install CSIT python packages from $branch branch" - echo_log " Starting $description..." - git clean -qfdx + echo_log " Starting $description..." 2>&1 | tee -a "$bld_log" + git clean -qfdx 2>&1 | tee -a "$bld_log" rm -rf "$PYTHONPATH/env" - # Virtualenv version is pinned in common.sh in newer csit branches. - # (note: xargs removes leading/trailing spaces) + # Activate / install CSIT python virtualenv ($CSIT_DIR/requirements.txt) local common_sh="$csit_bash_function_dir/common.sh" - install_virtualenv="$(grep 'virtualenv' $common_sh | grep pip | grep install | cut -d'|' -f1 | xargs)" - $install_virtualenv - virtualenv --no-download --python="$(which python3)" "$CSIT_DIR/env" - source "$CSIT_DIR/env/bin/activate" - - if [ "$OS_ARCH" = "aarch64" ] ; then - local numpy_ver - numpy_ver="$(grep numpy $PYTHONPATH/requirements.txt)" - [ -n "$numpy_ver" ] && $pip_cmd install $numpy_ver 2>&1 | \ - tee -a $bld_log - fi - - # TODO: Update CSIT release branches to PyYAML==6.0.1 or greater - # then remove this workaround: https://github.com/yaml/pyyaml/issues/736 - if grep -q 'PyYAML==5.4.1' "$PYTHONPATH/requirements.txt" ; then - local constraintfile - constraintfile="/tmp/constraint.txt" - - # create a constraint file that limits the Cython version to one that should work - echo 'Cython < 3.0' > "$constraintfile" + # shellcheck disable=1090 + source "$common_sh" + activate_virtualenv "${CSIT_DIR}" "${CSIT_DIR}/requirements.txt" 2>&1 | tee -a "$bld_log" - # seed pip's local wheel cache with a PyYAML wheel - PIP_CONSTRAINT="$constraintfile" $pip_cmd wheel PyYAML==5.4.1 - - rm -f "$constraintfile" - fi - - # Install csit python requirements - $pip_cmd install -r "$CSIT_DIR/requirements.txt" 2>&1 | \ - tee -a "$bld_log" # Install tox python requirements - $pip_cmd install -r "$CSIT_DIR/tox-requirements.txt" 2>&1 | \ + activate_virtualenv "${CSIT_DIR}" "${CSIT_DIR}/tox-requirements.txt" 2>&1 |\ tee -a "$bld_log" - # Run tox which installs pylint requirments - pushd "$CSIT_DIR" >& /dev/null || exit 1 - tox || true - popd >& /dev/null || exit 1 # Clean up virtualenv directories - deactivate git checkout -q -- . git clean -qfdx - echo_log " Completed $description!" + echo_log " Completed $description!" 2>&1 | tee -a "$bld_log" else echo_log "ERROR: Missing or invalid CSIT_DIR: '$CSIT_DIR'!" return 1 |