[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/README.md b/patches/README.md
index a72d09a..f3302b9 100644
--- a/patches/README.md
+++ b/patches/README.md
@@ -20,7 +20,7 @@
python < 3.10 (collections.abc optional)
-# vst_venv/
+# .venv/
Makefile will first create a python virtualenv directory to selectively
use packages. After setup patches are applied to venv (as a transition)
@@ -29,15 +29,15 @@
# staging/
-The staging directory is used for comparison with the vst_venv directory
+The staging directory is used for comparison with the .venv directory
to generate patches. Populate the directory with a copy of a cleanly
patched virtual interpreter then modify files benath/ staging to generate
a patch from.
% make sterile
-% make vst_venv
+% make .venv
% mkdir staging
-% rsync -rv --checksum vst_venv/. staging/.
+% rsync -rv --checksum .venv/. staging/.
[NOTE] Make python 3.10+ migration edits beneath staging as needed
% make patch-gather
% make sterile
diff --git a/patches/lib/python3.10/site-packages/robot/utils/normalizing.py/patch b/patches/lib/python3.10/site-packages/robot/utils/normalizing.py/patch
index fc9ddd4..ae8619a 100644
--- a/patches/lib/python3.10/site-packages/robot/utils/normalizing.py/patch
+++ b/patches/lib/python3.10/site-packages/robot/utils/normalizing.py/patch
@@ -1,5 +1,5 @@
--- vault/lib/python3.10/site-packages/robot/utils/normalizing.py 2022-11-26 06:59:47.438751606 -0500
-+++ vst_venv/lib/python3.10/site-packages/robot/utils/normalizing.py 2022-11-26 06:57:29.960476182 -0500
++++ .venv/lib/python3.10/site-packages/robot/utils/normalizing.py 2022-11-26 06:57:29.960476182 -0500
@@ -13,10 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
diff --git a/patches/lib/python3.10/site-packages/robot/utils/robottypes3.py/patch b/patches/lib/python3.10/site-packages/robot/utils/robottypes3.py/patch
index 399a769..d1aa540 100644
--- a/patches/lib/python3.10/site-packages/robot/utils/robottypes3.py/patch
+++ b/patches/lib/python3.10/site-packages/robot/utils/robottypes3.py/patch
@@ -1,5 +1,5 @@
--- vault/lib/python3.10/site-packages/robot/utils/robottypes3.py 2022-11-26 07:00:17.126386733 -0500
-+++ vst_venv/lib/python3.10/site-packages/robot/utils/robottypes3.py 2022-11-26 06:57:29.956476232 -0500
++++ .venv/lib/python3.10/site-packages/robot/utils/robottypes3.py 2022-11-26 06:57:29.956476232 -0500
@@ -13,12 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
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]