Makefile library merge with onf-make and voltha-lib-go
makefiles/
----------
o Import standalone makefile directories to checkin smaller parts of a mega patch.
o Build out directory hierarchy by topic and feature.
makefiles/lint/yaml/
--------------------
o Pull in logic evolved in repo:voltha-lib-go.
o Refactoring: support special snowflake targets by repository.
o ci-management and voltha-lib-go use distinct yamllint.conf files.
o Separate until there is time to review and consolidate.
o Added deps for on-demand local install of yamllint.
- requirements.txt could be used but every build would incur overhead.
Makefile
--------
o Use latest syntax from repo:onf-make.
o No need to set path variables, makefiles/include.mk can infer them.
o Added a help target to explicitly display targets and suggestions.
o Logic is bundled in libraries and use of 'make help' is not well known.
Change-Id: Id8eba6f914a7bfe9a31637901bd8fb78a387e0c2
diff --git a/Makefile b/Makefile
index 9857746..e1e394f 100644
--- a/Makefile
+++ b/Makefile
@@ -15,23 +15,21 @@
# limitations under the License.
# -----------------------------------------------------------------------
-# Makefile for testing JJB jobs in a virtualenv
.PHONY: help clean help test
.DEFAULT_GOAL := help
##-------------------##
##---] GLOBALS [---##
##-------------------##
-TOP ?= .
-MAKEDIR ?= $(TOP)/makefiles
##--------------------##
##---] INCLUDES [---##
##--------------------##
include config.mk
-include $(MAKEDIR)/include.mk
+include makefiles/include.mk
+ONF_MAKEDIR ?= $(error ONF_MAKEDIR= is required)
-VENV_DIR ?= venv-jjb
+# VENV_DIR ?= venv-jjb
JJB_VERSION ?= 2.8.0
# JJB_VERSION ?= 4.1.0
JOBCONFIG_DIR ?= job-configs
@@ -45,14 +43,24 @@
$(JOBCONFIG_DIR):
mkdir $@
+# -----------------------------------------------------------------------
+# Intent: Generate pipeline jobs
+# -----------------------------------------------------------------------
+build : jjb-gen
+
##-------------------##
##---] TARGETS [---##
##-------------------##
-include $(MAKEDIR)/targets/check.mk
-include $(MAKEDIR)/targets/tox.mk# # python unit testing
-include $(MAKEDIR)/targets/test.mk
+## Display make help summary late
+include $(ONF_MAKEDIR)/help/trailer.mk
-## Display make help late
-include $(ONF_MAKE)/help/trailer.mk
+# make help not widely in use yet so be explicit
+help ::
+ @echo
+ @echo 'Usage: $(MAKE) help ...'
+ @echo ' % make clean sterile'
+ @echo ' % make lint lint-jjb'
+ @echo ' % make test'
+ @echo ' % make help # show all available targes'
# [EOF]
diff --git a/config.mk b/config.mk
index aad0f8e..399fbe7 100644
--- a/config.mk
+++ b/config.mk
@@ -14,18 +14,102 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefiles.include.version = 1.1
+# ONF.confg.mk = 1.1
+# -----------------------------------------------------------------------
+
+--repo-name-- := ci-management
+--repo-name-- ?= $(error --repo-name--= is required)
##--------------------------------##
##---] Disable lint targets [---##
##--------------------------------##
-NO-LINT-GROOVY := true# # Note[1]
-# NO-LINT-JJB := false
-# NO-LINT-JSON := true# # Note[1]
-# NO-LINT-MAKE := false
-NO-LINT-PYTHON := true# # Note[1]
-NO-LINT-SHELL := true# # Note[1]
-NO-LINT-YAML := true# # Note[1]
+# NO-LINT-DOC8 := true **
+# NO-LINT-GOLANG := true **
+NO-LINT-GROOVY := true# # Note[1]
+# NO-LINT-JJB := true# # Note[2]
+# NO-LINT-JSON := true# # Note[1]
+NO-LINT-MAKEFILE := true# # Note[1]
+NO-LINT-REUSE := true # License check
+NO-LINT-ROBOT := true
+NO-LINT-SHELL := true# # Note[1]
+NO-LINT-YAML := true# # Note[1]
-# Note[1] - Plenty of source to cleanup
+NO-LINT-PYTHON := true# # Note[1]
+# NO-LINT-PYLINT := true# # Note[1]
+# NO-LINT-TOX := true# # Note[1]
+
+# Note[1] - A boatload of source to cleanup prior to enable.
+# Note[2] - No sources available
+
+##---------------------------------##
+##---] Conditional make logic [---##
+##---------------------------------##
+# USE-ONF-DOCKER-MK := true
+# USE-ONF-GERRIT-MK := true
+# USE-ONF-GIT-MK := true
+USE-ONF-JJB-MK := true
+# USE-VOLTHA-RELEASE-MK := true
+
+##----------------------##
+##---] Debug Mode [---##
+##----------------------##
+# export DEBUG := 1 # makefile debug
+# export DISTUTILS_DEBUG := 1 # verbose: pip
+# export DOCKER_DEBUG := 1 # verbose: docker
+# export VERBOSE := 1 # makefile debug
+
+##-----------------------------------##
+##---] JJB/Jenkins Job Builder [---##
+##-----------------------------------##
+JJB_VERSION ?= 2.8.0
+JOBCONFIG_DIR ?= job-configs
+
+##---------------------------------##
+##---] Filesystem exclusions [---##
+##---------------------------------##
+onf-excl-dirs := $(null) # make clean: dirs=
+onf-excl-dirs += .venv# # $(venv-name)
+onf-excl-dirs += vendor# # golang / voltha*-go
+onf-excl-dirs += patches# # voltha docs - python upgrade
+onf-excl-dirs += .tox # also a python dependency
+
+onf-excl-dirs ?= $(error onf-excl-dirs= is required)
+
+##-----------------------------##
+##---] Feature Detection [---##
+##-----------------------------##
+# [TODO] include makefiles/features/include.mk
+# [TODO] All logic below can migrate there.
+
+$(if $(filter %ci-management,$(--repo-name--)),\
+ $(eval --REPO-IS-CI-MANAGEMENT-- := true)\
+)
+
+# create makefiles/config/byrepo/{--repo-name--}.mk for one-off snowflakes ?
+# $(if $(wildcard docker),$(eval USE-ONF-DOCKER-MK := true))
+
+##-------------------------##
+##---] Derived Flags [---##
+##-------------------------##
+ifdef --REPO-IS-CI-MANAGEMENT--
+ USE-ONF-JJB := true
+
+ onf-excl-dirs += global-jjb
+ onf-excl-dirs += lf-ansible
+ onf-excl-dirs += packer
+endif
+
+ifdef NO-LINT-PYTHON
+ NO-LINT-FLAKE8 := true
+ NO-LINT-PYLINT := true
+endif
+
+ifndef USE-ONF-JJB
+ NO-LINT-JJB := true
+endif
+
+onf-excl-dirs := $(sort $(strip $(onf-excl-dirs)))
# [EOF]
diff --git a/makefiles/bin/compare_sandbox_makefiles.sh b/makefiles/bin/compare_sandbox_makefiles.sh
new file mode 100755
index 0000000..28e47b0
--- /dev/null
+++ b/makefiles/bin/compare_sandbox_makefiles.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
+# Intent: This script is used to bulk refactor and merge makefile changes
+## between development repositories and repo:onf-make.
+## -----------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent:
+## -----------------------------------------------------------------------
+function error
+{
+ echo "$*"
+ exit 1
+}
+
+##----------------##
+##---] MAIN [---##
+##----------------##
+src="$HOME/projects/sandbox/onf-make/makefiles"
+# src="$HOME/projects/sandbox/ci-management/makefiles"
+dst="$(realpath .)"
+
+while [ $# -gt 0 ]; do
+ fyl=$1; shift
+
+ echo "FYL: $fyl"
+ if [ -d "$fyl" ]; then
+ readarray -t fyls < <(find "$fyl" -type f -print)
+ [[ ${#@} -gt 0 ]] && fyls+=("$@")
+ # declare -p fyls
+ [[ ${#fyls} -gt 0 ]] && set -- "${fyls[@]}"
+ continue
+ fi
+
+ src0="$src/$fyl"
+ dst0="$dst/$fyl"
+
+ [[ ! -e "$src0" ]] && error "File does not exist in src= $src0"
+ [[ ! -e "$dst0" ]] && error "File does not exist in dst= $dst0"
+
+ if ! diff -qr "$src0" "$dst0"; then
+ emacs "$src0" "$dst0"
+ fi
+done
+
+# [EOF]
diff --git a/makefiles/commands/include.mk b/makefiles/commands/include.mk
new file mode 100644
index 0000000..01fa145
--- /dev/null
+++ b/makefiles/commands/include.mk
@@ -0,0 +1,36 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
+
+ifndef mk-include--onf-commands
+
+$(if $(DEBUG),$(warning ENTER))
+
+include $(ONF_MAKEDIR)/commands/kail.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+mk-include--onf-commands := true
+
+endif # mk-include--onf-make
+
+# [EOF]
diff --git a/makefiles/commands/kail.mk b/makefiles/commands/kail.mk
new file mode 100644
index 0000000..ff6691d
--- /dev/null
+++ b/makefiles/commands/kail.mk
@@ -0,0 +1,46 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+MAKEDIR ?= $(error MAKEDIR= is required)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help::
+ @echo " kail Install the kail command"
+ifdef VERBOSE
+ @echo " make kail KAIL_PATH="
+endif
+
+# -----------------------------------------------------------------------
+# Install the 'kail' tool if needed: https://github.com/boz/kail
+# o WORKSPACE - jenkins aware
+# o Default to /usr/local/bin/kail
+# + revisit this, system directories should not be a default path.
+# + requires sudo and potential exists for overwrite conflict.
+# -----------------------------------------------------------------------
+KAIL_PATH ?= $(if $(WORKSPACE),$(WORKSPACE)/bin,/usr/local/bin)
+kail-cmd ?= $(KAIL_PATH)/kail
+$(kail-cmd):
+ etc/godownloader.sh -b .
+ rsync -v --checksum kail "$@"
+ $@ version
+ $(RM) kail
+
+.PHONY: kail
+kail : $(kail-cmd)
+
+# [EOF]
diff --git a/makefiles/commands/kail/README.md b/makefiles/commands/kail/README.md
new file mode 100644
index 0000000..470fd3c
--- /dev/null
+++ b/makefiles/commands/kail/README.md
@@ -0,0 +1,15 @@
+# -----------------------------------------------------------------------
+# Workaround for godownloader disappearing:
+# This is a complete hack to get bbsim and v-s-t functional again.
+# A more permanent answer is needed, copy binaries into a *tool* repo
+# and use directly from git clone w/o access or install overhead.
+# ----------------------------------------------------------------------
+
+1) Retrieve an archived copy of the script and place in v-s-t/etc.
+ https://searchcode.com/file/316605398/godownloader.sh
+2) A few script edits are needed:
+ o change download method from curl to wget.
+ o VERSION= variable requires a 'v' prefix.
+3) Update Makefile to install the new command.
+
+# [EOF]
diff --git a/makefiles/commands/kail/godownloader.sh b/makefiles/commands/kail/godownloader.sh
new file mode 100755
index 0000000..77ad5bf
--- /dev/null
+++ b/makefiles/commands/kail/godownloader.sh
@@ -0,0 +1,390 @@
+#!/bin/sh
+set -e
+# Code generated by godownloader on 2019-05-28T19:49:53Z. DO NOT EDIT.
+# Copyright 2019 - (disable makefiles/lint/license.mk)
+#
+
+usage() {
+ this=$1
+ cat <<EOF
+$this: download go binaries for boz/kail
+
+Usage: $this [-b] bindir [-d] [tag]
+ -b sets bindir or installation directory, Defaults to ./bin
+ -d turns on debug logging
+ [tag] is a tag from
+ https://github.com/boz/kail/releases
+ If tag is missing, then the latest will be used.
+
+ Generated by godownloader
+ https://github.com/goreleaser/godownloader
+
+EOF
+ exit 2
+}
+
+parse_args() {
+ #BINDIR is ./bin unless set be ENV
+ # over-ridden by flag below
+
+ BINDIR=${BINDIR:-./bin}
+ while getopts "b:dh?x" arg; do
+ case "$arg" in
+ b) BINDIR="$OPTARG" ;;
+ d) log_set_priority 10 ;;
+ h | \?) usage "$0" ;;
+ x) set -x ;;
+ esac
+ done
+ shift $((OPTIND - 1))
+ TAG=$1
+}
+# this function wraps all the destructive operations
+# if a curl|bash cuts off the end of the script due to
+# network, either nothing will happen or will syntax error
+# out preventing half-done work
+execute() {
+ tmpdir=$(mktemp -d)
+ log_debug "downloading files into ${tmpdir}"
+
+ # ---------------------------------------------------------
+ # [JOEY] - strange, curl fails to retrieve but wget is fine.
+ # ---------------------------------------------------------
+ # http_download "${tmpdir}/${TARBALL}" "${TARBALL_URL}"
+ http_download_wget "${tmpdir}/${TARBALL}" "${TARBALL_URL}"
+
+ http_download "${tmpdir}/${CHECKSUM}" "${CHECKSUM_URL}"
+ hash_sha256_verify "${tmpdir}/${TARBALL}" "${tmpdir}/${CHECKSUM}"
+ srcdir="${tmpdir}"
+ (cd "${tmpdir}" && untar "${TARBALL}")
+ test ! -d "${BINDIR}" && install -d "${BINDIR}"
+# shellcheck disable=SC2043
+ for binexe in "kail" ; do
+ if [ "$OS" = "windows" ]; then
+ binexe="${binexe}.exe"
+ fi
+ install "${srcdir}/${binexe}" "${BINDIR}/"
+ log_info "installed ${BINDIR}/${binexe}"
+ done
+ rm -rf "${tmpdir}"
+}
+is_supported_platform() {
+ platform=$1
+ found=1
+ case "$platform" in
+ darwin/amd64) found=0 ;;
+ linux/amd64) found=0 ;;
+ esac
+ return $found
+}
+check_platform() {
+ if is_supported_platform "$PLATFORM"; then
+ # optional logging goes here
+ true
+ else
+ log_crit "platform $PLATFORM is not supported. Make sure this script is up-to-date and file request at https://github.com/${PREFIX}/issues/new"
+ exit 1
+ fi
+}
+tag_to_version() {
+ if [ -z "${TAG}" ]; then
+ log_info "checking GitHub for latest tag"
+ else
+ log_info "checking GitHub for tag '${TAG}'"
+ fi
+ REALTAG=$(github_release "$OWNER/$REPO" "${TAG}") && true
+ if test -z "$REALTAG"; then
+ log_crit "unable to find '${TAG}' - use 'latest' or see https://github.com/${PREFIX}/releases for details"
+ exit 1
+ fi
+ # if version starts with 'v', remove it
+ TAG="$REALTAG"
+ VERSION=${TAG#v}
+}
+adjust_format() {
+ # change format (tar.gz or zip) based on OS
+ true
+}
+adjust_os() {
+ # adjust archive name based on OS
+ true
+}
+adjust_arch() {
+ # adjust archive name based on ARCH
+ true
+}
+
+cat /dev/null <<EOF
+------------------------------------------------------------------------
+https://github.com/client9/shlib - portable posix shell functions
+Public domain - http://unlicense.org
+https://github.com/client9/shlib/blob/master/LICENSE.md
+but credit (and pull requests) appreciated.
+------------------------------------------------------------------------
+EOF
+is_command() {
+ command -v "$1" >/dev/null
+}
+echoerr() {
+ echo "$@" 1>&2
+}
+log_prefix() {
+ echo "$0"
+}
+_logp=6
+log_set_priority() {
+ _logp="$1"
+}
+log_priority() {
+ if test -z "$1"; then
+ echo "$_logp"
+ return
+ fi
+ [ "$1" -le "$_logp" ]
+}
+log_tag() {
+ case $1 in
+ 0) echo "emerg" ;;
+ 1) echo "alert" ;;
+ 2) echo "crit" ;;
+ 3) echo "err" ;;
+ 4) echo "warning" ;;
+ 5) echo "notice" ;;
+ 6) echo "info" ;;
+ 7) echo "debug" ;;
+ *) echo "$1" ;;
+ esac
+}
+log_debug() {
+ log_priority 7 || return 0
+ echoerr "$(log_prefix)" "$(log_tag 7)" "$@"
+}
+log_info() {
+ log_priority 6 || return 0
+ echoerr "$(log_prefix)" "$(log_tag 6)" "$@"
+}
+log_err() {
+ log_priority 3 || return 0
+ echoerr "$(log_prefix)" "$(log_tag 3)" "$@"
+}
+log_crit() {
+ log_priority 2 || return 0
+ echoerr "$(log_prefix)" "$(log_tag 2)" "$@"
+}
+uname_os() {
+ os=$(uname -s | tr '[:upper:]' '[:lower:]')
+ case "$os" in
+ msys_nt) os="windows" ;;
+ esac
+ echo "$os"
+}
+uname_arch() {
+ arch=$(uname -m)
+ case $arch in
+ x86_64) arch="amd64" ;;
+ x86) arch="386" ;;
+ i686) arch="386" ;;
+ i386) arch="386" ;;
+ aarch64) arch="arm64" ;;
+ armv5*) arch="armv5" ;;
+ armv6*) arch="armv6" ;;
+ armv7*) arch="armv7" ;;
+ esac
+ echo ${arch}
+}
+uname_os_check() {
+ os=$(uname_os)
+ case "$os" in
+ darwin) return 0 ;;
+ dragonfly) return 0 ;;
+ freebsd) return 0 ;;
+ linux) return 0 ;;
+ android) return 0 ;;
+ nacl) return 0 ;;
+ netbsd) return 0 ;;
+ openbsd) return 0 ;;
+ plan9) return 0 ;;
+ solaris) return 0 ;;
+ windows) return 0 ;;
+ esac
+ log_crit "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value. Please file bug at https://github.com/client9/shlib"
+ return 1
+}
+uname_arch_check() {
+ arch=$(uname_arch)
+ case "$arch" in
+ 386) return 0 ;;
+ amd64) return 0 ;;
+ arm64) return 0 ;;
+ armv5) return 0 ;;
+ armv6) return 0 ;;
+ armv7) return 0 ;;
+ ppc64) return 0 ;;
+ ppc64le) return 0 ;;
+ mips) return 0 ;;
+ mipsle) return 0 ;;
+ mips64) return 0 ;;
+ mips64le) return 0 ;;
+ s390x) return 0 ;;
+ amd64p32) return 0 ;;
+ esac
+ log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value. Please file bug report at https://github.com/client9/shlib"
+ return 1
+}
+untar() {
+ tarball=$1
+ case "${tarball}" in
+ *.tar.gz | *.tgz) tar -xzf "${tarball}" ;;
+ *.tar) tar -xf "${tarball}" ;;
+ *.zip) unzip "${tarball}" ;;
+ *)
+ log_err "untar unknown archive format for ${tarball}"
+ return 1
+ ;;
+ esac
+}
+http_download_curl() {
+ local_file=$1
+ source_url=$2
+ header=$3
+ if [ -z "$header" ]; then
+ code=$(curl -w '%{http_code}' -sL -o "$local_file" "$source_url")
+ else
+ code=$(curl -w '%{http_code}' -sL -H "$header" -o "$local_file" "$source_url")
+ fi
+ if [ "$code" != "200" ]; then
+ log_debug "http_download_curl received HTTP status $code"
+ return 1
+ fi
+ return 0
+}
+http_download_wget() {
+ local_file=$1
+ source_url=$2
+ header=$3
+ if [ -z "$header" ]; then
+ wget -q -O "$local_file" "$source_url"
+ else
+ wget -q --header "$header" -O "$local_file" "$source_url"
+ fi
+}
+http_download() {
+ log_debug "http_download $2"
+ if is_command curl; then
+ http_download_curl "$@"
+ return
+ elif is_command wget; then
+ http_download_wget "$@"
+ return
+ fi
+ log_crit "http_download unable to find wget or curl"
+ return 1
+}
+http_copy() {
+ tmp=$(mktemp)
+ http_download "${tmp}" "$1" "$2" || return 1
+ body=$(cat "$tmp")
+ rm -f "${tmp}"
+ echo "$body"
+}
+github_release() {
+ owner_repo=$1
+ version=$2
+ test -z "$version" && version="latest"
+ giturl="https://github.com/${owner_repo}/releases/${version}"
+ json=$(http_copy "$giturl" "Accept:application/json")
+ test -z "$json" && return 1
+ version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name":"//' | sed 's/".*//')
+ test -z "$version" && return 1
+ echo "$version"
+}
+hash_sha256() {
+ TARGET=${1:-/dev/stdin}
+ if is_command gsha256sum; then
+ hash=$(gsha256sum "$TARGET") || return 1
+ echo "$hash" | cut -d ' ' -f 1
+ elif is_command sha256sum; then
+ hash=$(sha256sum "$TARGET") || return 1
+ echo "$hash" | cut -d ' ' -f 1
+ elif is_command shasum; then
+ hash=$(shasum -a 256 "$TARGET" 2>/dev/null) || return 1
+ echo "$hash" | cut -d ' ' -f 1
+ elif is_command openssl; then
+ hash=$(openssl -dst openssl dgst -sha256 "$TARGET") || return 1
+ echo "$hash" | cut -d ' ' -f a
+ else
+ log_crit "hash_sha256 unable to find command to compute sha-256 hash"
+ return 1
+ fi
+}
+hash_sha256_verify() {
+ TARGET=$1
+ checksums=$2
+ if [ -z "$checksums" ]; then
+ log_err "hash_sha256_verify checksum file not specified in arg2"
+ return 1
+ fi
+ BASENAME=${TARGET##*/}
+ want=$(grep "${BASENAME}" "${checksums}" 2>/dev/null | tr '\t' ' ' | cut -d ' ' -f 1)
+ if [ -z "$want" ]; then
+ log_err "hash_sha256_verify unable to find checksum for '${TARGET}' in '${checksums}'"
+ return 1
+ fi
+ got=$(hash_sha256 "$TARGET")
+ if [ "$want" != "$got" ]; then
+ log_err "hash_sha256_verify checksum for '$TARGET' did not verify ${want} vs $got"
+ return 1
+ fi
+}
+cat /dev/null <<EOF
+------------------------------------------------------------------------
+End of functions from https://github.com/client9/shlib
+------------------------------------------------------------------------
+EOF
+
+PROJECT_NAME="kail"
+OWNER=boz
+REPO="kail"
+# shellcheck disable=SC2034
+BINARY=kail
+FORMAT=tar.gz
+OS=$(uname_os)
+ARCH=$(uname_arch)
+PREFIX="$OWNER/$REPO"
+
+# use in logging routines
+log_prefix() {
+ echo "$PREFIX"
+}
+PLATFORM="${OS}/${ARCH}"
+GITHUB_DOWNLOAD=https://github.com/${OWNER}/${REPO}/releases/download
+
+uname_os_check "$OS"
+uname_arch_check "$ARCH"
+
+parse_args "$@"
+
+check_platform
+
+tag_to_version
+
+adjust_format
+
+adjust_os
+
+adjust_arch
+
+log_info "found version: ${VERSION} for ${TAG}/${OS}/${ARCH}"
+
+# ---------------------------------------------------------
+# [JOEY] - as of v0.16.1, download name contains an embedded 'v'
+# ---------------------------------------------------------
+# NAME=${PROJECT_NAME}_${VERSION}_${OS}_${ARCH}
+NAME=${PROJECT_NAME}_v${VERSION}_${OS}_${ARCH}
+
+TARBALL=${NAME}.${FORMAT}
+TARBALL_URL=${GITHUB_DOWNLOAD}/${TAG}/${TARBALL}
+CHECKSUM=checksums.txt
+CHECKSUM_URL=${GITHUB_DOWNLOAD}/${TAG}/${CHECKSUM}
+
+execute
diff --git a/makefiles/consts.mk b/makefiles/consts.mk
index 8961b3a..f1f717f 100644
--- a/makefiles/consts.mk
+++ b/makefiles/consts.mk
@@ -34,8 +34,11 @@
HIDE ?= @
env-clean ?= /usr/bin/env --ignore-environment
-xargs-n1 := xargs -0 -t -n1 --no-run-if-empty
-xargs-n1-clean := $(env-clean) $(xargs-n1)
+
+xargs-cmd := xargs -0 -t --no-run-if-empty
+xargs-n1 := $(xargs-cmd) -n1
+xargs-n1-clean := $(env-clean) $(xargs-n1)
+xargs-cmd-clean := $(env-clean) $(xargs-cmd)
## -----------------------------------------------------------------------
## Intent: NOP command for targets whose dependencies do all heavy lifting
diff --git a/makefiles/docker/config/voltha-lib-go.mk b/makefiles/docker/config/voltha-lib-go.mk
new file mode 100644
index 0000000..4379237
--- /dev/null
+++ b/makefiles/docker/config/voltha-lib-go.mk
@@ -0,0 +1,28 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.d
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## repo:voltha-lib-go values for docker use
+
+go-cobertura-docker-mount := /app/src/github.com/opencord/voltha-lib-go/v7# #
+protoc-sh-docker-mount := /go/src/github.com/opencord/voltha-protos/v5# #
+# voltha-protos-v5 := /go/src/github.com/opencord/voltha-protos/v5
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/docker/config/voltha-openolt-adapter.mk b/makefiles/docker/config/voltha-openolt-adapter.mk
new file mode 100644
index 0000000..4e56be0
--- /dev/null
+++ b/makefiles/docker/config/voltha-openolt-adapter.mk
@@ -0,0 +1,25 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.d
+# -----------------------------------------------------------------------
+
+## repo:voltha-openolt-adapter values for docker use
+
+go-cobertura-docker-mount := /app/src/github.com/opencord/voltha-openolt-adapter
+protoc-sh-docker-mount := /go/src/github.com/opencord/voltha-protos/v5
+# voltha-protos-v5 := /go/src/github.com/opencord/voltha-protos/v5
+
+# [EOF]
+
diff --git a/makefiles/docker/include.mk b/makefiles/docker/include.mk
new file mode 100644
index 0000000..cd02827
--- /dev/null
+++ b/makefiles/docker/include.mk
@@ -0,0 +1,160 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.d
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+# Per-repository
+include $(ONF_MAKEDIR)/docker/config/$(--repo-name--).mk
+
+# ------------------- ##
+# ---] GLOBALS [--- ##
+# ------------------- ##
+VOLTHA_TOOLS_VERSION ?= 2.4.0
+
+# ---------------------------------
+# Induce error for misconfiguration
+# ---------------------------------
+go-cobertura-docker-mount ?= $(error go-cobertura-docker-mount= is required)
+protoc-sh-docker-mount ?= $(error protoc-sh-docker-mount= is required)
+
+# ---------------------------
+# Macros: command refactoring
+# ---------------------------
+docker-iam ?= --user $$(id -u):$$(id -g)# # override for local use
+docker-run = docker run --rm $(docker-iam)# # Docker command stem
+docker-run-is = $(docker-run) $(is-stdin)# # Attach streams when interactive
+docker-run-app = $(docker-run-is) -v ${CURDIR}:/app# # w/filesystem mount
+
+# -----------------------------------------------------------------------
+# --interactive: Attach streams when stdout (fh==0) defined
+# --tty : Always create a pseudo-tty else jenkins:docker is silent
+# -----------------------------------------------------------------------
+is-stdin = $(shell test -t 0 && { echo '--interactive'; })
+is-stdin += --tty
+
+# Docker volume mounts: container:/app/release <=> localhost:{pwd}/release
+vee-golang = -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg
+vee-citools = voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}
+
+# ---------------
+# Tool Containers
+# ---------------
+docker-go-stem = $(docker-run-app) -v gocache:/.cache $(vee-golang) $(vee-citools)-golang
+
+# -----------------------------------------------------------------------
+# Usage: GO := $(call get-cmd-docker-go)
+# -----------------------------------------------------------------------
+get-cmd-docker-go = $(docker-go-stem) go
+GO ?= $(call get-cmd-docker-go)
+
+# -----------------------------------------------------------------------
+# Usage: GO_SH := $(call get-docker-go-sh,./my.env.temp)
+# - populate my.env.temp with shell content to pass in
+# -----------------------------------------------------------------------
+get-cmd-docker-go-sh = $(docker-go-stem) $(if $(1),--env-file $(1)) sh -c
+GO_SH ?= $(call get-cmd-docker-go-sh,./my.env.temp)
+
+# -----------------------------------------------------------------------
+# Usage: PROTOC := $(call get-cmd-docker-protoc)
+# -----------------------------------------------------------------------
+get-cmd-docker-protoc = $(docker-run-app) $(vee-citools)-protoc protoc
+PROTOC ?= $(call get-cmd-docker-protoc)
+
+# -----------------------------------------------------------------------
+# Usage: PROTOC_SH := $(call get-cmd-docker-protoc-sh)
+# -----------------------------------------------------------------------
+get-cmd-docker-protoc-sh =\
+ $(strip \
+ $(docker-run-is) \
+ $(if $(protc-sh-docker-mount), \
+ -v ${CURDIR}:$(protoc-sh-docker-mount) \
+ --workdir=$(protoc-sh-docker-mount) \
+ ) \
+ $(vee-citools)-protoc \
+ sh -c \
+ )
+PROTOC_SH ?= $(call get-cmd-docker-protoc-sh)
+
+# get-docker-protoc-sh = $(strip )
+#PROTOC_SH = $(docker-run-is)
+#ifdef protc-sh-docker-mount
+# PROTOC_SH += -v ${CURDIR}:$(protoc-sh-docker-mount)
+# PROTOC_SH += --workdir=$(protoc-sh-docker-mount)
+#endif # protoc-sh-docker-mount
+#PROTOC_SH += $(vee-citools)-protoc sh -c
+
+# Usage: GO_JUNIT_REPORT := $(call get-docker-go-junit-repo)
+# get-docker-go-junit-repo = $(docker-run-app) $(vee-citools)-go-junit-report go-junit-report
+# GO_JUNIT_REPORT ?= $(call get-docker-go-junit-repo)
+
+# -----------------------------------------------------------------------
+# get-docker-gocover-cobertura = $(docker-run-app)/src/github.com/opencord/voltha-openolt-adapter $(vee-citools)-gocover-cobertura gocover-cobertura
+# GOCOVER_COBERTURA ?= $(call get-docker-gocover-cobertura)
+
+## -----------------------------------------------------------------------
+## Coverage report: junit
+## -----------------------------------------------------------------------
+## Usage: GO_JUNIT_REPORT ?= $(call get-go-junit-report-cmd)
+## -----------------------------------------------------------------------
+get-go-junit-report-cmd =\
+ $(strip \
+ $(docker-run) \
+ -v ${CURDIR}:/app \
+ -i $(vee-citools)-go-junit-report go-junit-report \
+ )
+GO_JUNIT_REPORT ?= $(call get-go-junit-report-cmd)
+
+## -----------------------------------------------------------------------
+## Coverage report: cobertura
+## -----------------------------------------------------------------------
+## Usage: GOCOVER_COBERTURA ?= $(call get-docker-gocover-cobertura-cmd)
+## -----------------------------------------------------------------------
+get-docker-go-cobertura-cmd =\
+ $(strip \
+ $(docker-run)\
+ -v ${CURDIR}:$(go-cobertura-docker-mount)\
+ -i $(vee-citools)-gocover-cobertura gocover-cobertura\
+ )
+GOCOVER_COBERTURA ?= $(call get-docker-go-cobertura-cmd)
+
+## -----------------------------------------------------------------------
+##
+## -----------------------------------------------------------------------
+get-cmd-docker-golangci-lint =\
+ $(strip \
+ $(docker-run-app) \
+ -v gocache:/.cache \
+ $(vee-golang)\
+ $(vee-citools)-golangci-lint\
+ golangci-lint\
+ )
+GOLANGCI_LINT ?= $(call get-cmd-docker-golangci-lint)
+
+## -----------------------------------------------------------------------
+##
+## -----------------------------------------------------------------------
+get-docker-hadolint =\
+ $(strip \
+ $(docker-run-app) \
+ $(vee-citools)-hadolint \
+ hadolint \
+ )
+HADOLINT ?= $(call get-docker-hadolint)
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/etc/features.mk b/makefiles/etc/features.mk
new file mode 100644
index 0000000..a48b42c
--- /dev/null
+++ b/makefiles/etc/features.mk
@@ -0,0 +1,48 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Usage:
+#
+# mytarget:
+# $(call banner-enter,target $@)
+# @echo "Hello World"
+# $(call banner-leave,target $@)
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+target-banner = ** ---------------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Return a command line able to display a banner hilighting
+## make target processing within a logfile.
+## -----------------------------------------------------------------------
+banner-enter=\
+ @echo -e \
+ "\n"\
+ "$(target-banner)\n"\
+ "** $(MAKE) ENTER: $(1)\n"\
+ "$(target-banner)"\
+
+banner-leave=\
+ @echo -e "** $(MAKE) LEAVE: $(1)"
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/etc/include.mk b/makefiles/etc/include.mk
new file mode 100644
index 0000000..a48b42c
--- /dev/null
+++ b/makefiles/etc/include.mk
@@ -0,0 +1,48 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Usage:
+#
+# mytarget:
+# $(call banner-enter,target $@)
+# @echo "Hello World"
+# $(call banner-leave,target $@)
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+target-banner = ** ---------------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Return a command line able to display a banner hilighting
+## make target processing within a logfile.
+## -----------------------------------------------------------------------
+banner-enter=\
+ @echo -e \
+ "\n"\
+ "$(target-banner)\n"\
+ "** $(MAKE) ENTER: $(1)\n"\
+ "$(target-banner)"\
+
+banner-leave=\
+ @echo -e "** $(MAKE) LEAVE: $(1)"
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/gerrit/include.mk b/makefiles/gerrit/include.mk
index 54e5895..5ae76a4 100644
--- a/makefiles/gerrit/include.mk
+++ b/makefiles/gerrit/include.mk
@@ -18,7 +18,7 @@
##--------------------##
##---] INCLUDES [---##
##--------------------##
-include $(MAKEDIR)/gerrit/help.mk
+include $(ONF_MAKEDIR)/gerrit/help.mk
# -----------------------------------------------------------------------
# -----------------------------------------------------------------------
diff --git a/makefiles/git/byrepo/ci-management.mk b/makefiles/git/byrepo/ci-management.mk
new file mode 100644
index 0000000..373dc23
--- /dev/null
+++ b/makefiles/git/byrepo/ci-management.mk
@@ -0,0 +1,80 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+GIT ?= git
+
+## -----------------------------------------------------------------------
+## Intent: Checkout submodules required by ci-management
+## -----------------------------------------------------------------------
+submodule-repos := $(null)
+submodule-repos += global-jjb
+submodule-repos += lf-ansible
+submodule-repos += packer
+
+submodule-deps := $(null)
+submodule-deps += submodules# # named pseudo target
+submodule-deps += $(submodule-repos)
+
+.PHONY: $(submodule-deps)
+$(submodule-deps):
+ @echo
+ @echo "Checkout dependent submodules"
+ $(GIT) submodule init
+ $(GIT) submodule update
+
+# Abstraction: named target for submodule checkout
+checkout-ci-management-sub-modules: $(submodule-repos)
+
+## -----------------------------------------------------------------------
+## Intent: Revert sandbox to a pristine state.
+## -----------------------------------------------------------------------
+sterile ::
+ $(RM) -r $(submodule-repos)
+
+ # FIXME:
+ # o restore hierarchy to avoid git status 'deleted:'
+ # o remove: externals should not be under revision control
+ $(GIT) co $(submodule-repos)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo
+ @echo '[GIT-SUBMODULES: docs]'
+ @echo ' reload Setup to auto-reload sphinx doc changes in browser'
+ @echo
+ @echo '[GIT-SUBMODULES: deps]'
+ @echo ' submodules Checkout dependent git submodules'
+ ifdef VERBOSE
+ @echo ' global-jjb Checkout ci-management submodule global-jjb'
+ @echo ' lf-ansible Checkout ci-management submodule lf-ansible'
+ @echo ' packer Checkout ci-management submodule packer'
+ endif
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+todo ::
+ @echo "Generalize logc, update to depend on .git/ rather than named targets."
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/git/ci-management.mk b/makefiles/git/ci-management.mk
new file mode 100644
index 0000000..373dc23
--- /dev/null
+++ b/makefiles/git/ci-management.mk
@@ -0,0 +1,80 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+GIT ?= git
+
+## -----------------------------------------------------------------------
+## Intent: Checkout submodules required by ci-management
+## -----------------------------------------------------------------------
+submodule-repos := $(null)
+submodule-repos += global-jjb
+submodule-repos += lf-ansible
+submodule-repos += packer
+
+submodule-deps := $(null)
+submodule-deps += submodules# # named pseudo target
+submodule-deps += $(submodule-repos)
+
+.PHONY: $(submodule-deps)
+$(submodule-deps):
+ @echo
+ @echo "Checkout dependent submodules"
+ $(GIT) submodule init
+ $(GIT) submodule update
+
+# Abstraction: named target for submodule checkout
+checkout-ci-management-sub-modules: $(submodule-repos)
+
+## -----------------------------------------------------------------------
+## Intent: Revert sandbox to a pristine state.
+## -----------------------------------------------------------------------
+sterile ::
+ $(RM) -r $(submodule-repos)
+
+ # FIXME:
+ # o restore hierarchy to avoid git status 'deleted:'
+ # o remove: externals should not be under revision control
+ $(GIT) co $(submodule-repos)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo
+ @echo '[GIT-SUBMODULES: docs]'
+ @echo ' reload Setup to auto-reload sphinx doc changes in browser'
+ @echo
+ @echo '[GIT-SUBMODULES: deps]'
+ @echo ' submodules Checkout dependent git submodules'
+ ifdef VERBOSE
+ @echo ' global-jjb Checkout ci-management submodule global-jjb'
+ @echo ' lf-ansible Checkout ci-management submodule lf-ansible'
+ @echo ' packer Checkout ci-management submodule packer'
+ endif
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+todo ::
+ @echo "Generalize logc, update to depend on .git/ rather than named targets."
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/git/include.mk b/makefiles/git/include.mk
index 9125178..42f2a47 100644
--- a/makefiles/git/include.mk
+++ b/makefiles/git/include.mk
@@ -20,17 +20,24 @@
$(if $(DEBUG),$(warning ENTER))
+ifdef USE-ONF-GIT-MK
+ mk-include--onf-git := seen
+endif
+
+ifndef mk-include--onf-git
+
##--------------------##
##---] INCLUDES [---##
##--------------------##
-include $(MAKEDIR)/git/help.mk
-include $(MAKEDIR)/git/required.mk
+include $(ONF_MAKEDIR)/git/help.mk
+include $(ONF_MAKEDIR)/git/required.mk
-ifdef USE_ONF_GIT_MK
- # Dynamic loading when targets are requested by name
- include $(ONF_MAKE)/git/submodules.mk
-endif
+## Special snowflake: per-repository logic loader
+-include $(ONF_MAKEDIR)/git/byrepo/$(--repo-name--).mk
+
+# Dynamic loading when targets are requested by name
+include $(ONF_MAKEDIR)/git/submodules.mk
+
+endif # mk-include--onf-git
# [EOF]
-
-
diff --git a/makefiles/git/required.mk b/makefiles/git/required.mk
index 29fba88..44f498d 100644
--- a/makefiles/git/required.mk
+++ b/makefiles/git/required.mk
@@ -26,7 +26,7 @@
# Makefile can also explicitly define the flag to force always loading.
# -----------------------------------------------------------------------
$(foreach tgt,$(git-mk-targets),\
- $(if $(findstring $(tgt),$(MAKECMDGOALS)),$(eval USE_ONF_GIT_MK := true))\
+ $(if $(findstring $(tgt),$(MAKECMDGOALS)),$(eval USE-ONF-GIT-MK := true))\
)
# [EOF]
diff --git a/makefiles/help/header.mk b/makefiles/help/header.mk
new file mode 100644
index 0000000..021ac0d
--- /dev/null
+++ b/makefiles/help/header.mk
@@ -0,0 +1,6 @@
+# -*- makefile -*-
+
+help :
+ @echo "Usage: make [options] [target] ..."
+ @echo "Targets:"
+ @echo " help This message"
diff --git a/makefiles/include.mk b/makefiles/include.mk
index 491ee0f..778d730 100644
--- a/makefiles/include.mk
+++ b/makefiles/include.mk
@@ -14,51 +14,61 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefiles.include.version = 1.1
+# -----------------------------------------------------------------------
+
+ifndef mk-include--onf-make # single-include guard macro
$(if $(DEBUG),$(warning ENTER))
-# OPT_ROOT ?= /opt/trainlab/current
-# OPT_MAKEDIR := $(OPT_ROOT)/makefiles
-# MAKEDIR ?= $(OPT_MAKEDIR)
+## -----------------------------------------------------------------------
+## Define vars based on relative import (normalize symlinks)
+## Usage: include makefiles/onf/include.mk
+## -----------------------------------------------------------------------
+onf-mk-abs ?= $(abspath $(lastword $(MAKEFILE_LIST)))
+onf-mk-top := $(subst /include.mk,$(null),$(onf-mk-abs))
+ONF_MAKEDIR := $(onf-mk-top)
-ONF_MAKE ?= $(MAKEDIR)# fix this -- two distinct makefiles/ directories are needed
-ONF_MAKE ?= $(error ONF_MAKE= is required)
+TOP ?= $(patsubst %/makefiles/include.mk,%,$(onf-mk-abs))
-include $(ONF_MAKE)/consts.mk
-include $(ONF_MAKE)/help/include.mk
+include $(ONF_MAKEDIR)/consts.mk
+include $(ONF_MAKEDIR)/help/include.mk # render target help
+include $(ONF_MAKEDIR)/utils/include.mk # dependency-less helper macros
+include $(ONF_MAKEDIR)/etc/include.mk # banner macros
+include $(ONF_MAKEDIR)/commands/include.mk # Tools and local installers
-include $(ONF_MAKE)/virtualenv.mk# # lint-{jjb,python} depends on venv
-include $(ONF_MAKE)/lint/include.mk
-include $(ONF_MAKE)/git-submodules.mk
-include $(ONF_MAKE)/gerrit/include.mk
+include $(ONF_MAKEDIR)/virtualenv.mk# # lint-{jjb,python} depends on venv
+include $(ONF_MAKEDIR)/lint/include.mk
-include $(ONF_MAKE)/git/include.mk
-include $(ONF_MAKE)/jjb/include.mk
+include $(ONF_MAKEDIR)/gerrit/include.mk
+include $(ONF_MAKEDIR)/git/include.mk
+include $(ONF_MAKEDIR)/jjb/include.mk
-include $(ONF_MAKE)/release/include.mk
+$(if $(USE-VOLTHA-RELEASE-MK),\
+ $(eval include $(ONF_MAKEDIR)/release/include.mk))
-include $(ONF_MAKE)/todo.mk
-include $(ONF_MAKE)/help/variables.mk
+include $(ONF_MAKEDIR)/todo.mk
+include $(ONF_MAKEDIR)/help/variables.mk
+
+##---------------------##
+##---] ON_DEMAND [---##
+##---------------------##
+$(if $(USE-ONF-GERRIT-MK),$(eval include $(ONF_MAKEDIR)/gerrit/include.mk))
+$(if $(USE-ONF-DOCKER-MK),$(eval include $(ONF_MAKEDIR)/docker/include.mk))
##-------------------##
##---] TARGETS [---##
##-------------------##
-include $(ONF_MAKE)/targets/clean.mk
-# include $(ONF_MAKE)/targets/check.mk
-include $(ONF_MAKE)/targets/sterile.mk
-# include $(ONF_MAKE)/targets/test.mk
+include $(ONF_MAKEDIR)/targets/include.mk # clean, sterile
$(if $(DEBUG),$(warning LEAVE))
-## --------------------------------------------------------------------------
-## structure to support pre/post target handling w/o inlining in Makefile (?)
-## --------------------------------------------------------------------------
-## include makefiles/include.mk
-## include makefiles/main/enter.mk
-## [... include *.mk ...]
-## include makefiles/main/leave.mk
+mk-include--onf-make := true
+
+endif # mk-include--onf-make
# [EOF]
diff --git a/makefiles/jjb/include.mk b/makefiles/jjb/include.mk
index e61ad7c..7d213b4 100644
--- a/makefiles/jjb/include.mk
+++ b/makefiles/jjb/include.mk
@@ -23,12 +23,12 @@
##--------------------##
##---] INCLUDES [---##
##--------------------##
-include $(MAKEDIR)/jjb/help.mk
-include $(MAKEDIR)/jjb/required.mk
+include $(ONF_MAKEDIR)/jjb/help.mk
+include $(ONF_MAKEDIR)/jjb/required.mk
ifdef USE-ONF-JJB-MK
# Dynamic loading when targets are requested by name
- include $(ONF_MAKE)/jjb/targets.mk
+ include $(ONF_MAKEDIR)/jjb/targets.mk
endif
# [EOF]
diff --git a/makefiles/jjb/targets.mk b/makefiles/jjb/targets.mk
index 17fc78f..730d229 100644
--- a/makefiles/jjb/targets.mk
+++ b/makefiles/jjb/targets.mk
@@ -36,13 +36,12 @@
jjb-gen-log := $(jjb-gen-dir)/jjb-gen.log
jjb-gen:
+ $(call banner-enter,Target $@)
@mkdir -p $(jjb-gen-dir)
-
- @echo
- @echo "** Generating pipelines (target: $@)"
@touch "$(jjb-gen-dir)/.sentinel"
- ( jenkins-jobs test $(PWD)/jjb -o $(jjb-gen-dir) 3>&1 2>&1 )\
- > "$(jjb-gen-log)"
+ ( $(activate) \
+ && jenkins-jobs test $(PWD)/jjb -o $(jjb-gen-dir) 3>&1 2>&1 \
+ ) | tee "$(jjb-gen-log)"
ifdef LOGS
-@less "$(jjb-gen-log)"
@@ -54,6 +53,8 @@
find "$(jjb-gen-dir)" -newer "$(jjb-gen-dir)/.sentinel" -ls
endif
+ $(call banner-leave,Target $@)
+
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
sterile ::
diff --git a/makefiles/lint/include.mk b/makefiles/lint/include.mk
index 357b6f5..894f718 100644
--- a/makefiles/lint/include.mk
+++ b/makefiles/lint/include.mk
@@ -1,6 +1,25 @@
# -*- makefile -*-
+# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.2
# -----------------------------------------------------------------------
$(if $(DEBUG),$(warning ENTER))
@@ -9,15 +28,15 @@
@echo
@echo "[LINT]"
-include $(ONF_MAKE)/lint/groovy.mk
-include $(ONF_MAKE)/lint/jjb.mk
-include $(ONF_MAKE)/lint/json.mk
-include $(ONF_MAKE)/lint/makefile.mk
-include $(ONF_MAKE)/lint/python.mk
-include $(ONF_MAKE)/lint/shell.mk
-include $(ONF_MAKE)/lint/yaml.mk
-
-include $(ONF_MAKE)/lint/help.mk
+include $(ONF_MAKEDIR)/lint/groovy.mk
+include $(ONF_MAKEDIR)/lint/jjb.mk
+include $(ONF_MAKEDIR)/lint/json.mk
+include $(ONF_MAKEDIR)/lint/license/include.mk
+include $(ONF_MAKEDIR)/lint/makefile.mk
+include $(ONF_MAKEDIR)/lint/python/include.mk
+include $(ONF_MAKEDIR)/lint/shell.mk
+include $(ONF_MAKEDIR)/lint/tox/include.mk
+include $(ONF_MAKEDIR)/lint/yaml/include.mk
$(if $(DEBUG),$(warning LEAVE))
diff --git a/makefiles/lint/license/include.mk b/makefiles/lint/license/include.mk
new file mode 100644
index 0000000..2b42049
--- /dev/null
+++ b/makefiles/lint/license/include.mk
@@ -0,0 +1,41 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-REUSE
+ lint : lint-license
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Perform a lint check on makefile sources
+## -----------------------------------------------------------------------
+lint-license:
+ reuse --root . lint
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-reuse License syntax checking'
+
+# [EOF]
diff --git a/makefiles/lint/license/reuse.mk b/makefiles/lint/license/reuse.mk
new file mode 100644
index 0000000..5572bef
--- /dev/null
+++ b/makefiles/lint/license/reuse.mk
@@ -0,0 +1,41 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-REUSE
+ lint : lint-license
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Perform a lint check on makefile sources
+## -----------------------------------------------------------------------
+lint-license:
+ reuse --root . lint
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-reuse License syntax checking"
+
+# [EOF]
diff --git a/makefiles/lint/python/find_utils.mk b/makefiles/lint/python/find_utils.mk
new file mode 100644
index 0000000..7ab4c4f
--- /dev/null
+++ b/makefiles/lint/python/find_utils.mk
@@ -0,0 +1,32 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Intent:
+# o Construct a find command able to gather python files with filtering.
+# o Used by library makefiles flake8.mk and pylint.mk for iteration.
+# -----------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Construct a string for invoking find \( excl-pattern \) -prune
+# -----------------------------------------------------------------------
+gen-python-find-excl = \
+ $(strip \
+ -name '__ignored__' \
+ $(foreach dir,$($(1)),-o -name $(dir)) \
+ )
+
+## -----------------------------------------------------------------------
+## Intent: Construct a find command to gather a list of python files
+## with exclusions.
+## -----------------------------------------------------------------------
+## Usage:
+# $(activate) & $(call gen-python-find-cmd) | $(args-n1) pylint
+## -----------------------------------------------------------------------
+gen-python-find-cmd = \
+ $(strip \
+ find . \
+ \( $(call gen-python-find-excl,onf-excl-dirs) \) -prune \
+ -o -name '*.py' \
+ -print0 \
+ )
+
+# [EOF]
diff --git a/makefiles/lint/python/flake8.mk b/makefiles/lint/python/flake8.mk
new file mode 100644
index 0000000..cf1bc2b
--- /dev/null
+++ b/makefiles/lint/python/flake8.mk
@@ -0,0 +1,94 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License")
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-flake8 lint-flake8-all lint-flake8-modified
+
+PYTHON_FILES ?= $(error PYTHON_FILES= required)
+
+## -----------------------------------------------------------------------
+## Intent: Use the flake8 command to perform syntax checking.
+## Usage:
+## % make lint
+## % make lint-flake8-all
+## -----------------------------------------------------------------------
+ifndef NO-LINT-FLAKE8
+ lint-flake8-mode := $(if $(have-python-files),modified,all)
+ lint : lint-flake8
+ lint-flake8 : lint-flake8-$(lint-flake8-mode)
+endif# NO-LINT-FLAKE8
+
+## -----------------------------------------------------------------------
+## Intent: exhaustive flake8 syntax checking
+## -----------------------------------------------------------------------
+# Construct: find . \( -name '__ignored__' -o -name dir -o name dir \)
+# flake8-find-filter := $(null)
+# flake8-find-filter += -name '__ignored__'# # for alignment
+# flake8-find-filter += $(foreach dir,$(onf-excl-dirs),-o -name $(dir)))
+
+lint-flake8-all: $(venv-activate-script)
+ $(HIDE)$(MAKE) --no-print-directory lint-flake8-install
+
+ $(activate) && $(call gen-python-find-cmd) \
+ | $(xargs-n1) flake8 --max-line-length=99 --count
+
+# && find . \( $(flake8-find-filter) \) -prune -o -name '*.py' -print0 \
+# | $(xargs-n1) flake8 --max-line-length=99 --count
+
+## -----------------------------------------------------------------------
+## Intent: check deps for format and python3 cleanliness
+## Note:
+## pylint --py3k option no longer supported
+## -----------------------------------------------------------------------
+lint-flake8-modified: $(venv-activate-script)
+ $(HIDE)$(MAKE) --no-print-directory lint-flake8-install
+
+ $(activate)\
+ && flake8 --max-line-length=99 --count $(PYTHON_FILES)
+
+## -----------------------------------------------------------------------
+## Intent:
+## -----------------------------------------------------------------------
+.PHONY: lint-flake8-install
+lint-flake8-install: $(venv-activate-script)
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** python flake8 syntax checking"
+ @echo "** -----------------------------------------------------------------------"
+ $(activate) && pip install --upgrade flake8
+ $(activate) && flake8 --version
+ @echo
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-flake8 Syntax check python using the flake8 command'
+ ifdef VERBOSE
+ @echo ' $(MAKE) lint-pylint PYTHON_FILES=...'
+ @echo ' lint-flake8-modified flake8 checking: only modified'
+ @echo ' lint-flake8-all flake8 checking: exhaustive'
+ @echo ' lint-flake8-install Install the flake8 command'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/python/include.mk b/makefiles/lint/python/include.mk
new file mode 100644
index 0000000..ce7d7af
--- /dev/null
+++ b/makefiles/lint/python/include.mk
@@ -0,0 +1,31 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+$(if $(UNSTABLE),$(eval lint-python-all := true))
+
+include $(ONF_MAKEDIR)/lint/python/find_utils.mk
+include $(ONF_MAKEDIR)/lint/python/flake8.mk
+include $(ONF_MAKEDIR)/lint/python/pylint.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/python/pylint.mk b/makefiles/lint/python/pylint.mk
new file mode 100644
index 0000000..87ffb43
--- /dev/null
+++ b/makefiles/lint/python/pylint.mk
@@ -0,0 +1,95 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License")
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-pylint lint-pylint-all lint-pylint-modified
+
+PYTHON_FILES ?= $(error PYTHON_FILES= required)
+
+## -----------------------------------------------------------------------
+## Intent: Use the pylint command to perform syntax checking.
+## o If UNSTABLE=1 syntax check all sources
+## o else only check sources modified by the developer.
+## Usage:
+## % make lint UNSTABLE=1
+## % make lint-pylint-all
+## -----------------------------------------------------------------------
+ifndef NO-LINT-PYLINT
+ lint-pylint-mode := $(if $(have-python-files),modified,all)
+ lint : lint-pylint
+ lint-pylint : lint-pylint-$(lint-pylint-mode)
+endif# NO-LINT-PYLINT
+
+## -----------------------------------------------------------------------
+## Intent: exhaustive pylint syntax checking
+## -----------------------------------------------------------------------
+
+# Construct: find . \( -name '__ignored__' -o -name dir -o name dir \)
+# pylint-find-filter := $(null)
+# pylint-find-filter += -name '__ignored__'# # for alignment
+# pylint-find-filter += $(foreach dir,$(onf-excl-dirs),-o -name $(dir)))
+
+# pylint-find-filter := $(call gen-python-find-excl,onf-excl-dirs)
+# $(error pylint-find-filter := $(pylint-find-filter))
+lint-pylint-all: $(venv-activate-script)
+ $(MAKE) --no-print-directory lint-pylint-install
+
+ $(activate) && $(call gen-python-find-cmd) | $(xargs-n1) pylint
+# | $(xargs-n1-clean) yamllint --strict
+
+## -----------------------------------------------------------------------
+## Intent: check deps for format and python3 cleanliness
+## Note:
+## pylint --py3k option no longer supported
+## -----------------------------------------------------------------------
+lint-pylint-modified: $(venv-activate-script)
+ $(MAKE) --no-print-directory lint-pylint-install
+
+ $(activate) && pylint $(PYTHON_FILES)
+
+## -----------------------------------------------------------------------
+## Intent:
+## -----------------------------------------------------------------------
+.PHONY: lint-pylint-install
+lint-pylint-install: $(venv-activate-script)
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** python pylint syntax checking"
+ @echo "** -----------------------------------------------------------------------"
+ $(activate) && pip install --upgrade pylint
+ $(activate) && pylint --version
+ @echo
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-pylint Syntax check python using the pylint command'
+ ifdef VERBOSE
+ @echo ' $(MAKE) lint-pylint PYTHON_FILES=...'
+ @echo ' lint-pylint-modified pylint checking: only modified'
+ @echo ' lint-pylint-all pylint checking: exhaustive'
+ @echo ' lint-pylint-install Install the pylint command'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/tox/include.mk b/makefiles/lint/tox/include.mk
new file mode 100644
index 0000000..7d7cf3e
--- /dev/null
+++ b/makefiles/lint/tox/include.mk
@@ -0,0 +1,27 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+include $(ONF_MAKEDIR)/lint/tox/tox.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/tox/tox.mk b/makefiles/lint/tox/tox.mk
new file mode 100644
index 0000000..35cec00
--- /dev/null
+++ b/makefiles/lint/tox/tox.mk
@@ -0,0 +1,91 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-tox lint-tox-all lint-tox-modified
+
+PYTHON_FILES ?= $(error PYTHON_FILES= required)
+
+## -----------------------------------------------------------------------
+## Intent: Sanity check incoming JJB config changes.
+## Todo: Depend on makefiles/lint/jjb.mk :: lint-jjb
+## -----------------------------------------------------------------------
+ifndef NO-LINT-TOX
+ lint-tox-mode := $(if $(have-python-files),modified,all)
+ lint : lint-tox
+ lint-tox : lint-tox-$(lint-tox-mode)
+endif# NO-LINT-TOX
+
+## -----------------------------------------------------------------------
+## Intent: Invoke tox on all sources
+## -----------------------------------------------------------------------
+lint-tox-all: $(venv-activate-script)
+ $(MAKE) --no-print-directory lint-tox-install
+
+ $(activate) && tox -e py310
+
+## -----------------------------------------------------------------------
+## Intent: Invoke tox on modified sources (target is mainly for consistency)
+## -----------------------------------------------------------------------
+lint-tox-modified: $(venv-activate-script)
+ $(MAKE) --no-print-directory lint-tox-install
+
+ $(activate) && tox -e py310 $(PYTHON_FILES)
+
+## -----------------------------------------------------------------------
+## Intent: https://tox.wiki/en/4.6.4/installation.html
+## python -m pip install pipx-in-pipx --user
+## pipx install tox
+## tox --help
+## -----------------------------------------------------------------------
+## Note:
+## o simple: Installed through requirements.txt
+## o This target can make usage on-demand.
+## -----------------------------------------------------------------------
+.PHONY: lint-tox-install
+lint-tox-install: $(venv-activate-script)
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** python tox syntax checking"
+ @echo "** -----------------------------------------------------------------------"
+ $(activate) && pip install --upgrade tox
+ $(activate) && tox --version
+ @echo
+
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-tox Invoke the tox test command'
+ ifdef VERBOSE
+ @echo ' $(MAKE) lint-tox PYTHON_FILES=...'
+ @echo ' lint-tox-modified tox checking: only modified'
+ @echo ' lint-tox-all tox checking: exhaustive'
+ @echo ' lint-tox-install Install the tox command'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/yaml/.yamllint b/makefiles/lint/yaml/.yamllint
new file mode 100644
index 0000000..c42c6d5
--- /dev/null
+++ b/makefiles/lint/yaml/.yamllint
@@ -0,0 +1,45 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+---
+
+yaml-files:
+ - '*.yaml'
+ - '*.yml'
+ - '.yamllint'
+
+rules:
+ document-start: disable
+ line-length:
+ max: 160
+
+# -----------------------------------------------------------------------
+# .. seealso: https://gerrit.opencord.org/plugins/gitiles/helm-repo-tools/+/refs/heads/master/yamllint.conf
+# -----------------------------------------------------------------------
+#
+# extends: default
+#
+#rules:
+# empty-lines:
+# max-end: 1
+# line-length:
+# max: 120
+# braces:
+# min-spaces-inside: 0
+# max-spaces-inside: 1
diff --git a/makefiles/lint/yaml/byrepo/ci-management/yamllint.conf b/makefiles/lint/yaml/byrepo/ci-management/yamllint.conf
new file mode 100644
index 0000000..32d76ab
--- /dev/null
+++ b/makefiles/lint/yaml/byrepo/ci-management/yamllint.conf
@@ -0,0 +1,8 @@
+extends: default
+
+rules:
+ empty-lines:
+ max-end: 1
+ line-length:
+ max: 120
+
diff --git a/makefiles/lint/yaml/byrepo/voltha-lib-go/include.mk b/makefiles/lint/yaml/byrepo/voltha-lib-go/include.mk
new file mode 100644
index 0000000..6cbd0ea
--- /dev/null
+++ b/makefiles/lint/yaml/byrepo/voltha-lib-go/include.mk
@@ -0,0 +1,27 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##--------------------##
+##---] INCLUDES [---##
+##--------------------##
+include $(ONF_MAKEDIR)/lint/yaml/byrepo/$(--repo-name--)/yamllint.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/yaml/byrepo/voltha-lib-go/python.mk b/makefiles/lint/yaml/byrepo/voltha-lib-go/python.mk
new file mode 100644
index 0000000..cf0eef5
--- /dev/null
+++ b/makefiles/lint/yaml/byrepo/voltha-lib-go/python.mk
@@ -0,0 +1,41 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+YAML_FILES ?= $(error YAML_FILES= is required)
+
+lint-yaml-dep = $(addsuffix ^lint-yaml,$(YAML_FILES))
+lint-yaml-src = $(firstword $(subst ^,$(space),$(1)))
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+.PHONY : lint-yaml
+lint : lint-yaml
+
+lint-yaml: $(venv-activate)
+lint-yaml: $(lint-yaml-dep)
+
+$(lint-yaml-dep):
+ $(vst-env) && yamllint -s $(call lint-yaml-src,$@)
+
+help::
+ @echo " lint-yaml Syntax check yaml sources"
+
+# [EOF]
diff --git a/makefiles/lint/yaml/byrepo/voltha-lib-go/repo b/makefiles/lint/yaml/byrepo/voltha-lib-go/repo
new file mode 100644
index 0000000..99e8451
--- /dev/null
+++ b/makefiles/lint/yaml/byrepo/voltha-lib-go/repo
@@ -0,0 +1 @@
+Source from voltha-lib-go
\ No newline at end of file
diff --git a/makefiles/lint/yaml/byrepo/voltha-lib-go/todo b/makefiles/lint/yaml/byrepo/voltha-lib-go/todo
new file mode 100644
index 0000000..8400c64
--- /dev/null
+++ b/makefiles/lint/yaml/byrepo/voltha-lib-go/todo
@@ -0,0 +1,39 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+env-clean = /usr/bin/env --ignore-environment
+xargs-n1 := xargs -0 -t -n1 --no-run-if-empty
+
+yamllint := $(env-clean) $(YAMLLINT)
+yamllint-args := -c .yamllint
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+lint : lint-yaml
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+lint-yaml:
+ $(HIDE)$(env-clean) find . -name '*.yaml' -type f -print0 \
+ | $(xargs-n1) $(yamllint) $(yamllint-args)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help:
+ @echo
+ @echo "USAGE: $(MAKE)"
+ @echo " lint perform syntax checks on source"
+ @echo " test perform syntax checks on source"
+ @echo " pre-check Verify tools and deps are available for testing"
+ @echo
+ @echo "[LINT]"
+ @echo " lint-json Syntax check .json sources"
+ @echo " lint-yaml Syntax check .yaml sources"
+ @echo
+# [EOF]
diff --git a/makefiles/lint/yaml/byrepo/voltha-lib-go/urls b/makefiles/lint/yaml/byrepo/voltha-lib-go/urls
new file mode 100644
index 0000000..8747658
--- /dev/null
+++ b/makefiles/lint/yaml/byrepo/voltha-lib-go/urls
@@ -0,0 +1,5 @@
+# -*- makefile -*-
+
+https://yamllint.readthedocs.io/en/stable/configuration.html
+
+# [EOF]
\ No newline at end of file
diff --git a/makefiles/lint/yaml/byrepo/voltha-lib-go/yamllint.helm b/makefiles/lint/yaml/byrepo/voltha-lib-go/yamllint.helm
new file mode 100644
index 0000000..bf1d2b9
--- /dev/null
+++ b/makefiles/lint/yaml/byrepo/voltha-lib-go/yamllint.helm
@@ -0,0 +1,32 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+---
+# yamllint.conf
+
+extends: default
+
+rules:
+ empty-lines:
+ max-end: 1
+ line-length:
+ max: 120
+ braces:
+ min-spaces-inside: 0
+ max-spaces-inside: 1
diff --git a/makefiles/lint/yaml/byrepo/voltha-lib-go/yamllint.mk b/makefiles/lint/yaml/byrepo/voltha-lib-go/yamllint.mk
new file mode 100644
index 0000000..fb56e3a
--- /dev/null
+++ b/makefiles/lint/yaml/byrepo/voltha-lib-go/yamllint.mk
@@ -0,0 +1,72 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+--onf-mk-lint-yaml-- := true# # Inhibit loading downstream lint-yaml targets
+
+# yamllint := $(env-clean) yamllint
+# yamllint := $(activate) && yamllint
+
+YAMLLINT = $(activate) && yamllint
+
+## -------------------------------
+## Add requirement(s) for checking
+## -------------------------------
+yamllint-cfg := yamllint.helm
+yamllint-conf = $(wildcard $(yamllint-cfg) $(ONF_MAKEDIR)/lint/yaml/$(yamllint-cfg))
+yamllint-args += $(addprefix --config-file$(space),$(yamllint-conf))
+yamllint-args += --strict
+
+## -----------------------------------------------------------------------
+## Intent: Use the yaml command to perform syntax checking.
+## -----------------------------------------------------------------------
+ifndef NO-LINT-YAML
+ # lint-yaml-mode := $(if $(have-yaml-files),modified,all)
+ lint : lint-yaml
+ lint-yaml : lint-yaml-votlha-lib-go
+# lint-yaml : lint-yaml-all-votlha-lib-go-$(lint-yaml-mode)
+endif# NO-LINT-YAML
+
+## -----------------------------------------------------------------------
+## ----------------------------------------------------------------------
+lint-yaml-votlha-lib-go: lint-yaml-cmd-version
+
+ $(call banner-enter,Target $@)
+ $(HIDE)$(MAKE) --no-print-directory lint-yaml-install
+
+ $(HIDE)$(env-clean) $(call gen-yaml-find-cmd) \
+ | $(env-clean) $(xargs-cmd) -I'{}' \
+ bash -c "$(YAMLLINT) $(yamllint-args) {}"
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ # lint-yaml help already displayed by lint/yaml/help.mk
+ ifdef VERBOSE
+ @echo ' $(MAKE) lint-yaml YAML_FILES=...'
+ @echo ' lint-yaml-votlha-lib-go lint-yaml for repo:voltha-lib-go'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/yaml/find_utils.mk b/makefiles/lint/yaml/find_utils.mk
new file mode 100644
index 0000000..49d4cb0
--- /dev/null
+++ b/makefiles/lint/yaml/find_utils.mk
@@ -0,0 +1,32 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Intent:
+# o Construct a find command able to gather python files with filtering.
+# o Used by library makefiles flake8.mk and pylint.mk for iteration.
+# -----------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Construct a string for invoking find \( excl-pattern \) -prune
+# -----------------------------------------------------------------------
+gen-yaml-find-excl = \
+ $(strip \
+ -name '__ignored__' \
+ $(foreach dir,$($(1)),-o -name $(dir)) \
+ )
+
+## -----------------------------------------------------------------------
+## Intent: Construct a find command to gather a list of python files
+## with exclusions.
+## -----------------------------------------------------------------------
+## Usage:
+# $(activate) & $(call gen-python-find-cmd) | $(args-n1) pylint
+## -----------------------------------------------------------------------
+gen-yaml-find-cmd = \
+ $(strip \
+ find . \
+ \( $(call gen-yaml-find-excl,onf-excl-dirs) \) -prune \
+ -o \( -iname '*.yaml' -o -iname '*.yml' \) \
+ -print0 \
+ )
+
+# [EOF]
diff --git a/makefiles/lint/yaml/help.mk b/makefiles/lint/yaml/help.mk
new file mode 100644
index 0000000..ef8621e
--- /dev/null
+++ b/makefiles/lint/yaml/help.mk
@@ -0,0 +1,41 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## ---------------------------------------------------------------------------
+## Intent: Display a help banner early so includes below that also define
+## help targets will be displayed beneath a high level banner.
+## ---------------------------------------------------------------------------
+help ::
+ ifndef VERBOSE
+ @echo ' lint-yaml Invoke all yaml linting targets'
+ else
+ $(HIDE)$(MAKE) --no-print-directory help-lint-yaml
+ endif
+
+## ---------------------------------------------------------------------------
+## Intent: Display extended target help
+## ---------------------------------------------------------------------------
+help-lint-yaml:
+ @echo
+ @echo '[LINT: yaml] (make lint-yaml VERBOSE=1)'
+ @echo ' lint-yaml Invoke all yaml linting targets'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/yaml/include.mk b/makefiles/lint/yaml/include.mk
new file mode 100644
index 0000000..26c4a7f
--- /dev/null
+++ b/makefiles/lint/yaml/include.mk
@@ -0,0 +1,42 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+ifndef --onf-mk-lint-yaml--
+
+$(if $(DEBUG),$(warning ENTER))
+
+##--------------------##
+##---] INCLUDES [---##
+##--------------------##
+include $(ONF_MAKEDIR)/lint/yaml/help.mk
+include $(ONF_MAKEDIR)/lint/yaml/find_utils.mk
+include $(ONF_MAKEDIR)/lint/yaml/install.mk
+
+# [TODO] Consolidate and refactor to support a simpler answer
+# Special snowflake linting requirements
+-include $(ONF_MAKEDIR)/lint/yaml/byrepo/$(--repo-name--)/include.mk
+
+# Standard lint-yaml targets
+include $(ONF_MAKEDIR)/lint/yaml/yamllint.mk
+
+--onf-mk-lint-yaml-- := true# # Flag to inhibit re-including
+
+$(if $(DEBUG),$(warning LEAVE))
+
+endif # --onf-mk-lint-yaml--
+
+# [EOF]
diff --git a/makefiles/lint/yaml/install.mk b/makefiles/lint/yaml/install.mk
new file mode 100644
index 0000000..62b777d
--- /dev/null
+++ b/makefiles/lint/yaml/install.mk
@@ -0,0 +1,73 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## Intent: Install the yamllint tool
+## -----------------------------------------------------------------------
+.PHONY: lint-yaml-install
+
+# -----------------------------------------------------------------------
+# We can(/should?) define a command macro
+# wait a bit until use cases are better known.
+# Initial use required inserting xargs bash -c "$(YAMLLINT) {}"
+# -----------------------------------------------------------------------
+# YAMLLINT ?= $(venv-activate-bin)/yamllint
+# YAMLLINT ?= $(activate) && yamllint
+
+## -----------------------------------------------------------------------
+## Intent: Display yamllint command version string.
+## Note: As a side effect, install yamllint by dependency
+## -----------------------------------------------------------------------
+.PHONY: lint-yaml-cmd-version
+lint-yaml-cmd-version : $(venv-activate-bin)/yamllint
+
+ $(HIDE) echo
+ $< --version
+
+## -----------------------------------------------------------------------
+## Intent: On-demand instalation of the yamllint command
+## -----------------------------------------------------------------------
+lint-yaml-install := $(venv-activate-bin)/yamllint
+$(lint-yaml-install) : $(venv-activate-script)
+
+ $(call banner-enter,Target $@)
+ $(activate) && pip install yamllint
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Purge yamllint tool installation
+## -----------------------------------------------------------------------
+sterile ::
+ $(HIDE)$(RM) "$(venv-abs-bin)/yamllint"
+ $(HIDE)$(RM) -r .venv/lib/*/site-packages/yamllint
+
+ # Remove both file:command and dir:libraries
+ # find "$(venv-abs-path)" -iname 'yamllint' -print0 \
+ # | $(xargs-n1-clean) $(RM) -r {}
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-yaml-install Install the yamllint tool'
+
+# [EOF]
diff --git a/makefiles/lint/yaml/yamllint.mk b/makefiles/lint/yaml/yamllint.mk
new file mode 100644
index 0000000..1563c7c
--- /dev/null
+++ b/makefiles/lint/yaml/yamllint.mk
@@ -0,0 +1,78 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License")
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-yaml lint-yaml-all lint-yaml-modified
+
+have-yaml-files := $(if $(strip $(YAML_FILES)),true)
+YAML_FILES ?= $(error YAML_FILES= is required)
+
+YAMLLINT = $(activate) && yamllint
+yamllint-args += --strict
+
+## -----------------------------------------------------------------------
+## Intent: Use the yaml command to perform syntax checking.
+## -----------------------------------------------------------------------
+ifndef NO-LINT-YAML
+ lint-yaml-mode := $(if $(have-yaml-files),modified,all)
+ lint : lint-yaml
+ lint-yaml : lint-yaml-$(lint-yaml-mode)
+endif# NO-LINT-YAML
+
+## -----------------------------------------------------------------------
+## Intent: exhaustive yaml syntax checking
+## -----------------------------------------------------------------------
+lint-yaml-all: lint-yaml-cmd-version
+
+ $(call banner-enter,Target $@)
+ $(HIDE)$(MAKE) --no-print-directory lint-yaml-install
+ $(HIDE)$(activate) && $(call gen-yaml-find-cmd) \
+ | $(env-clean) $(xargs-cmd) -I'{}' \
+ bash -c "$(YAMLLINT) $(yamllint-args) {}"
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: check deps for format and python3 cleanliness
+## Note:
+## yaml --py3k option no longer supported
+## -----------------------------------------------------------------------
+lint-yaml-modified: lint-yaml-cmd-version
+
+ $(call banner-enter,Target $@)
+ $(HIDE)$(MAKE) --no-print-directory lint-yaml-install
+ $(YAMLLINT) $(yamllint-args) $(YAML_FILES)
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-yaml Syntax check python using the yaml command'
+ ifdef VERBOSE
+ @echo ' $(MAKE) lint-yaml YAML_FILES=...'
+ @echo ' lint-yaml-all yaml checking: exhaustive'
+ @echo ' lint-yaml-modified yaml checking: only locally modified'
+ @echo ' lint-yaml-install Install the pylint command'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/python/include.mk b/makefiles/python/include.mk
index 24f3426..70b5ca1 100644
--- a/makefiles/python/include.mk
+++ b/makefiles/python/include.mk
@@ -19,9 +19,9 @@
# -----------------------------------------------------------------------
ifdef PYTHON_FILES
- include $(ONF_MAKE)/python/test/include.mk
+ include $(ONF_MAKEDIR)/python/test/include.mk
else
- include $(ONF_MAKE)/python/test/include.mk
+ include $(ONF_MAKEDIR)/python/test/include.mk
endif
# [EOF]
diff --git a/makefiles/release/include.mk b/makefiles/release/include.mk
index 3c9879e..8891df1 100644
--- a/makefiles/release/include.mk
+++ b/makefiles/release/include.mk
@@ -23,12 +23,12 @@
##--------------------##
##---] INCLUDES [---##
##--------------------##
-include $(MAKEDIR)/release/help.mk
-include $(MAKEDIR)/release/required.mk
+include $(ONF_MAKEDIR)/release/help.mk
+include $(ONF_MAKEDIR)/release/required.mk
ifdef USE_VOLTHA_RELEASE_MK
# Dynamic loading when targets are requested by name
- include $(MAKEDIR)/release/targets.mk
+ include $(ONF_MAKEDIR)/release/targets.mk
endif
# [EOF]
diff --git a/makefiles/release/targets.mk b/makefiles/release/targets.mk
index ea2988a..b201998 100644
--- a/makefiles/release/targets.mk
+++ b/makefiles/release/targets.mk
@@ -32,10 +32,10 @@
##--------------------##
##---] INCLUDES [---##
##--------------------##
-include $(MAKEDIR)/release/voltha-versions.mk
-include $(MAKEDIR)/release/targets/voltha-certification.mk
-include $(MAKEDIR)/release/targets/voltha-e2e.mk
-include $(MAKEDIR)/release/targets/voltha-nightly-jobs.mk
+include $(ONF_MAKEDIR)/release/voltha-versions.mk
+include $(ONF_MAKEDIR)/release/targets/voltha-certification.mk
+include $(ONF_MAKEDIR)/release/targets/voltha-e2e.mk
+include $(ONF_MAKEDIR)/release/targets/voltha-nightly-jobs.mk
# last-release := voltha-2.11
last-release := $(voltha-release-last)
diff --git a/makefiles/targets/check.mk b/makefiles/targets/check.mk
index 2145343..aa1b0d0 100644
--- a/makefiles/targets/check.mk
+++ b/makefiles/targets/check.mk
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
diff --git a/makefiles/targets/clean.mk b/makefiles/targets/clean.mk
index f504dec..f787e5c 100644
--- a/makefiles/targets/clean.mk
+++ b/makefiles/targets/clean.mk
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
diff --git a/makefiles/targets/include.mk b/makefiles/targets/include.mk
new file mode 100644
index 0000000..20e1bf5
--- /dev/null
+++ b/makefiles/targets/include.mk
@@ -0,0 +1,36 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+include $(ONF_MAKEDIR)/targets/clean.mk
+include $(ONF_MAKEDIR)/targets/check.mk
+include $(ONF_MAKEDIR)/targets/sterile.mk
+include $(ONF_MAKEDIR)/targets/test/include.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/targets/sterile.mk b/makefiles/targets/sterile.mk
index 1eb7035..c661f53 100644
--- a/makefiles/targets/sterile.mk
+++ b/makefiles/targets/sterile.mk
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
diff --git a/makefiles/targets/test/ci-management.mk b/makefiles/targets/test/ci-management.mk
new file mode 100644
index 0000000..2f68086
--- /dev/null
+++ b/makefiles/targets/test/ci-management.mk
@@ -0,0 +1,41 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+.PHONY: test
+test: $(venv-activate-script) $(JOBCONFIG_DIR)
+ $(activate) \
+ && pipdeptree \
+ && jenkins-jobs -l DEBUG test --recursive --config-xml -o "$(JOBCONFIG_DIR)" jjb/ ;
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help-verbose += help-test
+help-test ::
+ @echo
+ @echo '[MAKE: test]'
+ @echo ' test Perform testing that a jenkins job pull request will invoke'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/targets/test/include.mk b/makefiles/targets/test/include.mk
new file mode 100644
index 0000000..a706bfd
--- /dev/null
+++ b/makefiles/targets/test/include.mk
@@ -0,0 +1,31 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+# Special snowflake: repository-dependent test target
+-include $(ONF_MAKEDIR)/targets/test/$(--repo-name--).mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/utils/include.mk b/makefiles/utils/include.mk
new file mode 100644
index 0000000..5a7678f
--- /dev/null
+++ b/makefiles/utils/include.mk
@@ -0,0 +1,29 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+# usage: $(call if-not,false,5)
+if-not = $(info 1=$(1), 2=$(2), 3=$(3))\
+ $(if $(1),$(null),$(2))
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/utils/test/makefile b/makefiles/utils/test/makefile
new file mode 100644
index 0000000..a148cfa
--- /dev/null
+++ b/makefiles/utils/test/makefile
@@ -0,0 +1,9 @@
+# -*- makefile -*-
+
+include ../include.mk
+
+all:
+
+test ::
+ @echo "Testing if-not"
+ @echo $(call if-not,$(null),true,false)
diff --git a/makefiles/virtualenv.mk b/makefiles/virtualenv.mk
index 93eb29d..dae1ab8 100644
--- a/makefiles/virtualenv.mk
+++ b/makefiles/virtualenv.mk
@@ -13,7 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-## -----------------------------------------------------------------------
+# -----------------------------------------------------------------------
# https://gerrit.opencord.org/plugins/gitiles/onf-make
# ONF.makefile.version = 1.0
# -----------------------------------------------------------------------
@@ -30,8 +30,8 @@
##------------------##
venv-name ?= .venv# # default install directory
venv-abs-path := $(PWD)/$(venv-name)
-
-venv-activate-script := $(venv-name)/bin/activate# # dependency
+venv-activate-bin := $(venv-name)/bin
+venv-activate-script := $(venv-activate-bin)/activate# # dependency
# Intent: activate= is a macro for accessing the virtualenv activation script#
# Usage: $(activate) && python
diff --git a/requirements.txt b/requirements.txt
index 95c3a6b..23e849d 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,13 @@
-# jenkins-job-builder==4.1.0
+# -*- makefile -*-
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+
+jenkins-job-builder==4.1.0
pipdeptree
+jenkins-jobs
+
+# Installed on-demand by makefiles/lint/python/{flake8,pylint,tox}.mk
+# pylint
+# tox
+
+# [EOF]