[VOL-5064] - Build and deploy voltha-system-tests
makefiles/
----------
o Copy in latest library makefiles from repo:onf-make
config.mk
makefiles/lint
--------------
o Support more lint targets
makefiles/virtualenv.mk
-----------------------
o Update to use library logic.
o Install/maintain .venv/ VS vst_venv.
o Proper dependency driven create when needed VS always install.
o Also support replacing inlined venv logic with library makefile logs.
makefiles/commands/kail.mk
--------------------------
o mkdir -p for interactive use when WORKSPACE= is set.
Makefile
--------
o Inline comment delimiters and help targets to improve readabilty.
o Call macro banner-enter/banner-leave to hilight target output.
o Change targets clean and help into double-colon rules so they
are included when library targets are processed.
o Update include $(MAKEDIR) imports, library makefiles are able to infer paths
and define MAKDIR=, ONF_MAKEDIR=.
o Define helper macro run-robot-test= allowing copy & paste robot command
line to be refactored and reduced.
o Define local target 'venv-install' allowing installation of the virtualenv
followed by patching so a newer interpreter can be used locally for testing.
o Shell command separator: replace ';' with '&&' to improve error detection.
o target=gendocs: Split run-on command line into independent steps, activate
script only applies to the for loop invoking tests.
Change-Id: Idc8efd89f36b9f4954d9394a6524e07aa2ea5531
diff --git a/patches/python_310_migration.sh b/patches/python_310_migration.sh
index 4b27c3f..b522caa 100755
--- a/patches/python_310_migration.sh
+++ b/patches/python_310_migration.sh
@@ -15,52 +15,71 @@
# limitations under the License.
# -----------------------------------------------------------------------
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
set -euo pipefail
-dst="vst_venv" # rename to .venv
-src="staging"
-pat="patches"
+## -----------------------------------------------------------------------
+## Intent: Display script documentation.
+## -----------------------------------------------------------------------
+function show_help()
+{
+ cat <<EOH
+Usage: $0
+ apply Patch virtualenv python modules by version (3.10+).
+ backup Create a tarball for work-in-progress.
+ gather Display a list of potential source files to patch.
-declare -a fyls=()
-fyls+=('lib/python3.10/site-packages/robot/utils/normalizing.py')
-fyls+=('lib/python3.10/site-packages/robot/utils/robottypes3.py')
+ --venv Installed venv directory to patch (override default)
+ --help This message
-echo
-echo "==========================================================================="
-echo "CMD: $0"
-echo "PWD: $(/bin/pwd)"
-echo "ARGV: $*"
-echo "==========================================================================="
+See Also
+ patches/README.md Howto create a patch file.
+
+EOH
+ exit 0
+}
+
+##----------------##
+##---] MAIN [---##
+##----------------##
+declare dst='.venv' # "vst_venv"
+declare src="staging"
+declare pat="patches"
+
+## -----------------------
+## Slurp available patches
+## -----------------------
+pushd "$pat" >/dev/null
+readarray -t fyls < <(find . -name 'patch' -print)
+popd >/dev/null
if [ $# -eq 0 ]; then set -- apply; fi
while [ $# -gt 0 ]; do
opt="$1"; shift
case "$opt" in
- help)
- cat <<EOH
-apply - generate patches from vault source.
-backup - Archive patch directory
-gather - collect potential python files to edit.
-EOH
- ;;
- --venv) dst="$1"; shift ;;
-
+ -*help) show_help ;;
+ -*venv) dst="$1"; shift ;;
+
apply)
- pushd "$dst" || { echo "pushd $dst failed"; exit 1; }
+ pushd "$dst" >/dev/null || { echo "pushd $dst failed"; exit 1; }
for fyl in "${fyls[@]}";
do
+ path="${fyl%/*}"
+
# Conditional install, jenkins may not support interpreter yet.
- if [ ! -e "$fyl" ]; then
- echo "[SKIP] No venv file to patch: $fyl"
+ if [ ! -e "$path" ]; then
+ echo "[SKIP] $path"
continue
fi
- echo "$fyl"
- patch -R -p1 < "../$pat/$fyl/patch"
+ echo "[APPLY] $path"
+ patch -R -p1 < "../$pat/${path}/patch"
done
- popd || { echo "popd $dst failed"; exit 1; }
+ popd >/dev/null || { echo "popd $dst failed"; exit 1; }
;;
backup)
@@ -71,7 +90,6 @@
;;
gather)
- set -x
for fyl in "${fyls[@]}";
do
patchDir="$pat/$fyl"
@@ -79,14 +97,17 @@
diff -Naur "$src/$fyl" "$dst/$fyl" | tee "$pat/$fyl/patch"
done
find "$pat" -print
- set +x
;;
-
+
+ help) show_help ;;
+
*)
echo "ERROR: Unknown action [$opt]"
exit 1
;;
esac
+
+ echo
done
# [EOF]