[VOL-5031] Build and deploy voltha-onos for v2.12
makefiles/*
-----------
o https://github.com/opencord/onf-make
o Update to the latest library makefiles to support more lint targets.
VERSION
-------
o Cosmetic dev version bump to triage build state.
Change-Id: Iaddd825c24afdfa13e99cfd46cfe887072016d0f
diff --git a/makefiles/bootstrap.mk b/makefiles/bootstrap.mk
new file mode 100644
index 0000000..eec469b
--- /dev/null
+++ b/makefiles/bootstrap.mk
@@ -0,0 +1,80 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Intent: Dependency-free macros used to source library makefiles
+# and define the build environment.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG-bootstrap_mk),$(warning ENTER))
+
+##---------------------##
+##---] CONSTANTS [---##
+##---------------------##
+is-false = $(if $(1),true,$(null))
+is-true = $(if $(1),$(null),true)
+
+##--------------------------##
+##---] LIBRARY MACROS [---##
+##--------------------------##
+is-null = $(if $(1),$(null),$(error $(1)= is undef))
+# is-null-var = $(if $($(1)),$(null),$(error $(1)= is undef))
+
+## [origin]
+## foreach: var=automatic, origin=undef
+is-null-var-orig = $(strip \
+ $(foreach varname,$(1),\
+ $(warning ** is-null-var: varname=$(varname), origin=$(origin 1), origin=$(origin var))\
+ )\
+)
+# $(if $(1),$(call is-null-var-indirect,$($(1))),$(error $(1)= is undef)))\
+
+is-null-var-indirect = $(if $(1),$(null),$(error $(1)= is undef))
+
+# origin - undefned
+# default
+# environment
+# environment override
+# automatic
+# null(blah) ? - true
+
+## -----------------------------------------------------------------------
+## Intent: Given an indirect var containing varname of a makefile *_ROOT
+## parent director, derive a *_MKDIR variable and conditionally
+## include the makefile hierarchy.
+## -----------------------------------------------------------------------
+## Given:
+## o var containing OPT_ROOT=path
+## Return:
+## o OPT_MKDIR=$(OPT_ROOT)/makefiles
+## o If exists include $(OPT_MKDIR)/include.mk
+## -----------------------------------------------------------------------
+# library-include := $(call mk-library-include,blah)
+
+mk-library-include=$(strip \
+ $(warning mk-library-include: $$1[$(1)] = [$($(1))]))\
+ $(call is-null-var,1)\
+ $(foreach var,$($(1)),\
+ $(info var=$(var) is-null=$(call is-null-var,var))\
+ $(foreach val,$$(var),\
+ $(info val=$(val))\
+ $(foreach makedir,$(subst _ROOT,_MKDIR,$(var)),\
+$(warning makedir=$(makedir))\
+)\
+)\
+)\
+)
+
+
+# $(warning makedir=$(makedir))\
+ $(if $($(makedir)),$(null),\
+ $(eval $(makedir)=$$$$($(var))/makefiles)\
+$(warning $(makedir) = $($($(makedir))))\
+$(info $$(wildcard $(val)/makefiles/include.mk) = $(wildcard $(val)/makefiles/include.mk))\
+ $(foreach mf,$(wildcard $(wildcard $(val)/makefiles/include.mk)),\
+$(warning $$(eval include $(mf)))\
+ $(eval include $(mf)))\
+))))\
+)
+
+$(if $(DEBUG-bootstrap_mk),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/consts.mk b/makefiles/consts.mk
index 95d69a2..8961b3a 100644
--- a/makefiles/consts.mk
+++ b/makefiles/consts.mk
@@ -1,6 +1,6 @@
# -*- 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.
@@ -14,30 +14,49 @@
# 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.makefile.version = 1.0
+# -----------------------------------------------------------------------
$(if $(DEBUG),$(warning ENTER))
-null :=#
-space := $(null) $(null)
-dot ?= .
+# include makefiles/constants.mk
+export dot :=.
+export null :=#
+export space := $(null) $(null)
+export quote-single := $(null)'$(null)#'
+export quote-double := $(null)"$(null)#"
-HIDE ?= @
+# [DEBUG] make {target} HIDE=
+HIDE ?= @
-env-clean = /usr/bin/env --ignore-environment
-xargs-n1 := xargs -0 -t -n1 --no-run-if-empty
+env-clean ?= /usr/bin/env --ignore-environment
+xargs-n1 := xargs -0 -t -n1 --no-run-if-empty
+xargs-n1-clean := $(env-clean) $(xargs-n1)
## -----------------------------------------------------------------------
-## Not recommended but support (-u)ndef-less shell for pyenv activate
-## TODO: declare a pyenv shell
+## Intent: NOP command for targets whose dependencies do all heavy lifting
## -----------------------------------------------------------------------
+## usage: foo bar tans
+## <tab>$(nop-command)
+## -----------------------------------------------------------------------
+nop-cmd := :
+
+## -----------------------------------------------------------------------
+## Default shell:
+## o set -e enable error checking
+## o set -u report undefined errors
+## o set -o pipefail propogate shell pipeline failures.
+## -----------------------------------------------------------------------
+SHELL ?= /bin/bash
have-shell-bash := $(filter bash,$(subst /,$(space),$(SHELL)))
$(if $(have-shell-bash),$(null),\
- $(eval export SHELL := /bin/bash -euo pipefail))
+ $(eval export SHELL := bash -euo pipefail))
-shell-pyenv := bash -eo pipefail
+export SHELL ?= bash -euo pipefail
$(if $(DEBUG),$(warning LEAVE))
diff --git a/makefiles/docker/include.mk b/makefiles/docker/include.mk
new file mode 100644
index 0000000..0e53629
--- /dev/null
+++ b/makefiles/docker/include.mk
@@ -0,0 +1,70 @@
+# -*- 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))
+
+VOLTHA_TOOLS_VERSION ?= 2.4.0
+
+# ---------------------------
+# 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
+
+voltha-protos-v5 ?= /go/src/github.com/opencord/voltha-protos/v5
+
+# 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-docker-go,./my.env.temp)
+get-docker-go = $(docker-go-stem) go
+GO ?= $(call get-docker-go)
+
+# Usage: GO_SH := $(call get-docker-go-sh,./my.env.temp)
+get-docker-go-sh = $(docker-go-stem) $(if $(1),--env-file $(1)) sh -c
+GO_SH ?= $(call get-docker-go-sh,./my.env.temp)
+
+# Usage: PROTOC := $(call get-docker-protoc)
+get-docker-protoc = $(docker-run-app) $(vee-citools)-protoc protoc
+PROTOC ?= $(call get-docker-protoc)
+
+# get-docker-protoc-sh = $(strip )
+PROTOC_SH = $(docker-run-is)
+ifdef voltha-protos-v5
+ PROTOC_SH += -v ${CURDIR}:$(voltha-protos-v5)
+ PROTOC_SH += --workdir=$(voltha-protos-v5)
+endif
+PROTOC_SH += $(vee-citools)-protoc sh -c
+
+$(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/help.mk b/makefiles/gerrit/help.mk
new file mode 100644
index 0000000..2ba155b
--- /dev/null
+++ b/makefiles/gerrit/help.mk
@@ -0,0 +1,30 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2021-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.
+# -----------------------------------------------------------------------
+
+# -----------------------------------------------------------------------
+# -----------------------------------------------------------------------
+help-summary ::
+ @echo ' help-gerrit Display help for gerrit targets'
+
+help-verbose :: help-gerrit
+
+help-gerrit:
+ @echo
+ @echo '[GERRIT]'
+ @echo ' replication-status Report sync status of the gerrit-to-github mirror.'
+
+# [EOF]
diff --git a/makefiles/gerrit/include.mk b/makefiles/gerrit/include.mk
new file mode 100644
index 0000000..54e5895
--- /dev/null
+++ b/makefiles/gerrit/include.mk
@@ -0,0 +1,44 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2021-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.
+# -----------------------------------------------------------------------
+
+##--------------------##
+##---] INCLUDES [---##
+##--------------------##
+include $(MAKEDIR)/gerrit/help.mk
+
+# -----------------------------------------------------------------------
+# -----------------------------------------------------------------------
+replication-status:
+ ssh gerrit.opencord.org replication list --detail
+
+# -----------------------------------------------------------------------
+# NOTE: Gerrit ssh targets assume use of ~/.ssh config files
+# port, login, etc are
+# -----------------------------------------------------------------------
+# % ssh -p 29418 <username>@gerrit.opencord.org replication list --detail
+# % ssh gerrit.opencord.org replication list --detail
+# -----------------------------------------------------------------------
+# Host gerrit.opencord.org
+# Hostname gerrit.opencord.org
+# IdentityFile ~/.ssh/gerrit.opencord.org/{ssh_keyfile}
+# IdentitiesOnly yes
+# AddKeysToAgent yes
+# Port 29418
+# User tux@opennetworking.org
+# -----------------------------------------------------------------------
+
+# [EOF]
diff --git a/makefiles/git-submodules.mk b/makefiles/git-submodules.mk
new file mode 100644
index 0000000..373dc23
--- /dev/null
+++ b/makefiles/git-submodules.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/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/help/include.mk b/makefiles/help/include.mk
new file mode 100644
index 0000000..01efdc1
--- /dev/null
+++ b/makefiles/help/include.mk
@@ -0,0 +1,114 @@
+# -*- 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.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: help help-summary help-simple help-verbose
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+
+## -----------------------------------------------------------------------
+## Intent: Render topic/tool based makefile help
+## -----------------------------------------------------------------------
+## Three targets are used to render conditional makefile help
+## help-summary A one-line target summary for the topic
+## help-simple Common targets for the topic (lint-helm, build, test)
+## help-verbose Exhaustive display of supported targets
+## -----------------------------------------------------------------------
+## [COOKBOOK]
+## help colon-colon All 'help' targets are evaluated for 'make help'
+## help-banner Display a usage banner for help
+## help-summary Display all one-line topic summary help
+## [conditonal]
+## help-simple Display all common topic makefile targets.
+## help-verbose Exhaustive display of makefile target help.
+## VERBOSE=
+## -----------------------------------------------------------------------
+## [See Also] makefiles/gerrit/{include.mk, help.mk}
+## help-gerrit Summary targets can always be used to display topic help
+## help-verbose Exhaustive gerrit target display.
+## -----------------------------------------------------------------------
+help :: help-banner help-summary
+
+## -----------------------------------------------------------------------
+## Intent: Display a usage banner for help. Target will be evaluated
+## before all other help display.
+## -----------------------------------------------------------------------
+help-banner:
+ @echo "Usage: $(MAKE) [options] [target] ..."
+
+## -----------------------------------------------------------------------
+## Intent: Display extended help.
+## -----------------------------------------------------------------------
+## Question:
+## o Help display can be long based on volume of targets.
+## o Should a 3rd case be added to display:
+## - help-simple (one-liner help) by default
+## - conditional display of extended help:
+## - help-simple or help-verbose
+## o Current logic displays extended help by default.
+## -----------------------------------------------------------------------
+## Usage: see makefiles/targets/test.mk
+## test-verbose += help-check# # append help target to help-verbose
+## -----------------------------------------------------------------------
+ifdef VERBOSE
+ help-verbose += help-verbose
+ help :: $(help-verbose)
+else
+ help :: help-simple
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Display context specific help for named targets.
+## -----------------------------------------------------------------------
+## [TODO] Display a list of help-* tokens for target specific content:
+## % make help-check
+## % make help-test
+## -----------------------------------------------------------------------
+## [TODO] Define LEVEL= or helper targets (help-lint-{level})
+## for extended help w/o information overload
+## [0] help # make help
+## [1] help-lint # make help-verbose or (VERBOSE=1)
+## [2] help-lint-shell # make help-lint VERBOSE=1 (??)
+## [2] help-lint-yaml
+## -----------------------------------------------------------------------
+help-index ::
+ @echo
+ @echo '[HELP] - An index of help context for common targets'
+ @echo ' help-index This message'
+ $(HIDE)\
+ for name in $(sort $(help-verbose)); do\
+ echo " $$name";\
+ done
+
+## -----------------------------------------------------------------------
+## Intent: Display simple extended target help
+## -----------------------------------------------------------------------
+help-simple :: help-index
+ @echo
+ @echo '[VIEW]'
+ @echo ' reload Setup to auto-reload sphinx doc changes in browser'
+ @echo ' view-html View generated documentation'
+ @echo
+ @echo '[TEST]'
+ @echo " test $(MAKE) lint linkcheck"
+ @echo " test-all $(MAKE) all-generation-targets"
+
+# [EOF]
diff --git a/makefiles/help/trailer.mk b/makefiles/help/trailer.mk
new file mode 100644
index 0000000..8fcdfa6
--- /dev/null
+++ b/makefiles/help/trailer.mk
@@ -0,0 +1,42 @@
+# -*- 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.
+# -----------------------------------------------------------------------
+
+# include this makefile late so text will be displayed at the end6
+
+help ::
+ @echo
+ @echo '[CLEAN]'
+ @echo ' clean Remove generated targets'
+ @echo ' sterile clean + remove virtual env interpreter install'
+
+help ::
+ @echo
+ @echo '[HELP]'
+ @echo ' help Display program help'
+ @echo ' help-verbose Display additional targets and help'
+
+## -----------------------------------------------------------------------
+# repo::voltha-docs -- patch logic not deployed everywhere.
+## -----------------------------------------------------------------------
+# help ::
+# @echo
+# @echo '[NOTE: python 3.10+]'
+# @echo ' The interpreter is not yet fully supported across foreign repositories.'
+# @echo ' While working locally, if make fails to build a target try:'
+# @echo ' $(MAKE) $${target} NO_OTHER_REPO_DOCS=1'
+
+# [EOF]
diff --git a/makefiles/help/variables.mk b/makefiles/help/variables.mk
new file mode 100644
index 0000000..a22b179
--- /dev/null
+++ b/makefiles/help/variables.mk
@@ -0,0 +1,36 @@
+# -*- 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.
+# -----------------------------------------------------------------------
+
+# Include variables.mk after library makefiles have been included
+
+ifdef VERBOSE
+ help :: help-variables
+else
+ help ::
+ @echo
+ @echo '[VARIABLES] - Conditional makefile behavior'
+ @echo ' see also: help-variables'
+endif
+
+help-variables:
+ @echo
+ @echo '[VARIABLES] - Conditional makefile behavior'
+ @echo ' NO_PATCHES= Do not apply patches to the python virtualenv'
+ @echo ' NO_OTHER_REPO_DOCS= No foreign repos, only apply target to local sources.'
+ @echo ' VERBOSE= Display extended help topics'
+
+# [EOF]
diff --git a/makefiles/include.mk b/makefiles/include.mk
index 084b0e7..2e4af37 100644
--- a/makefiles/include.mk
+++ b/makefiles/include.mk
@@ -14,19 +14,63 @@
# 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.makefile.version = 1.0
+# -----------------------------------------------------------------------
+
+ifndef mk-include--onf-make # single-include guard macor
$(if $(DEBUG),$(warning ENTER))
-ONF_MAKE ?= $(MAKEDIR)# fix this -- two distinct makefile imports needed
-ONF_MAKE ?= $(error ONF_MAKE= is required)
+## -----------------------------------------------------------------------
+## 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)
-include $(ONF_MAKE)/consts.mk
-include $(ONF_MAKE)/help.mk
-include $(ONF_MAKE)/lint/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)/virtualenv.mk# # lint-{jjb,python} depends on venv
+include $(ONF_MAKEDIR)/lint/include.mk
+# include $(ONF_MAKEDIR)/git-submodules.mk
+# include $(ONF_MAKEDIR)/gerrit/include.mk
+
+include $(ONF_MAKEDIR)/todo.mk
+include $(ONF_MAKEDIR)/help/variables.mk
+
+##---------------------##
+##---] ON_DEMAND [---##
+##---------------------##
+$(if $(USE_DOCKER_MK),$(eval $(ONF_MAKEDIR)/docker/include.mk))
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+include $(ONF_MAKEDIR)/targets/clean.mk
+# include $(ONF_MAKEDIR)/targets/check.mk
+include $(ONF_MAKEDIR)/targets/sterile.mk
+# include $(ONF_MAKEDIR)/targets/test.mk
$(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/lint/groovy.mk b/makefiles/lint/groovy.mk
new file mode 100644
index 0000000..6baf70c
--- /dev/null
+++ b/makefiles/lint/groovy.mk
@@ -0,0 +1,51 @@
+# -*- 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 [---##
+##-------------------##
+
+groovy-check := npm-groovy-lint
+
+groovy-check-args := $(null)
+# groovy-check-args += --loglevel info
+# groovy-check-args += --ignorepattern
+# groovy-check-args += --verbose
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-GROOVY
+ lint : lint-groovy
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Perform a lint check on command line script sources
+## -----------------------------------------------------------------------
+lint-groovy:
+ $(groovy-check) --version
+ @echo
+ $(HIDE)$(env-clean) find . -iname '*.groovy' -print0 \
+ | $(xargs-n1) $(groovy-check) $(groovy-check-args)
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-groovy Syntax check groovy sources'
+
+# [EOF]
diff --git a/makefiles/lint/groovy/README.md b/makefiles/lint/groovy/README.md
new file mode 100644
index 0000000..aa9b41a
--- /dev/null
+++ b/makefiles/lint/groovy/README.md
@@ -0,0 +1,13 @@
+# lint: groovy source
+
+# Invoke the linting tool
+% make lint-groovy
+
+# Alt checking: groovy interpreter
+
+Odd syntax errors can be detected by the groovy interpreter.
+
+% groovy path/to/{source}.groovy
+
+jjb/ pipeline scripts will eventually due to syntax problems but groovy can
+still detect problems like mismatched quotes, invalid op tokens, etc.
diff --git a/makefiles/lint/groovy/urls b/makefiles/lint/groovy/urls
new file mode 100644
index 0000000..aa5c5eb
--- /dev/null
+++ b/makefiles/lint/groovy/urls
@@ -0,0 +1,8 @@
+# -*- makefile -*-
+
+# Config file and exclusions
+https://www.npmjs.com/package/npm-groovy-lint#Configuration
+
+https://github.com/nvuillam/npm-groovy-lint
+
+# [EOF]
diff --git a/makefiles/lint/yaml/yamllint.helm b/makefiles/lint/help.mk
similarity index 61%
copy from makefiles/lint/yaml/yamllint.helm
copy to makefiles/lint/help.mk
index 6c7787b..24a5aa1 100644
--- a/makefiles/lint/yaml/yamllint.helm
+++ b/makefiles/lint/help.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2021-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.
@@ -13,20 +13,19 @@
# 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
+help ::
-rules:
- empty-lines:
- max-end: 1
- line-length:
- max: 120
- braces:
- min-spaces-inside: 0
- max-spaces-inside: 1
+# -----------------------------------------------------------------------
+# -----------------------------------------------------------------------
+help-summary ::
+ @echo ' help-lint Display lint target help'
+
+help-simple :: help-lint
+help-lint :
+ @echo
+ @echo "[LINT]"
+ @echo ' help-lint Display lint target help'
+
+# [EOF]
diff --git a/makefiles/lint/include.mk b/makefiles/lint/include.mk
index 2a2d9ab..95059fe 100644
--- a/makefiles/lint/include.mk
+++ b/makefiles/lint/include.mk
@@ -2,6 +2,9 @@
# -----------------------------------------------------------------------
# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.1
+# -----------------------------------------------------------------------
$(if $(DEBUG),$(warning ENTER))
@@ -9,15 +12,16 @@
@echo
@echo "[LINT]"
-include $(ONF_MAKE)/lint/makefile.mk
-include $(ONF_MAKE)/lint/python.mk
-include $(ONF_MAKE)/lint/shell.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.mk
+include $(ONF_MAKEDIR)/lint/shell.mk
+include $(ONF_MAKEDIR)/lint/yaml.mk
-ifdef YAML_FILES
- include $(ONF_MAKE)/lint/yaml/python.mk
-else
- include $(ONF_MAKE)/lint/yaml/yamllint.mk
-endif
+include $(ONF_MAKEDIR)/lint/help.mk
$(if $(DEBUG),$(warning LEAVE))
diff --git a/makefiles/lint/jjb.mk b/makefiles/lint/jjb.mk
new file mode 100644
index 0000000..ccfa073
--- /dev/null
+++ b/makefiles/lint/jjb.mk
@@ -0,0 +1,60 @@
+# -*- 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.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-venv
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-JJB
+ lint : lint-jjb
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Construct command line for linting jenkins-job-builder config
+## -----------------------------------------------------------------------
+
+ifdef DEBUG
+ lint-jjb-args += --log_level DEBUG# # verbosity: high
+else
+ lint-jjb-args += --log_level INFO# # verbosity: default
+endif
+lint-jjb-args += --ignore-cache
+lint-jjb-args += test# # command action
+lint-jjb-args += -o archives/job-configs# # Generated jobs written here
+lint-jjb-args += --recursive
+lint-jjb-args += --config-xml# # JJB v3.0 write to OUTPUT/jobname/config.xml
+lint-jjb-args += jjb/# # JJB config sources (input)
+
+lint-jjb-deps := $(null)
+lint-jjb-deps += $(venv-activate-script)
+lint-jjb-deps += checkout-ci-management-sub-modules
+lint-jjb: $(lint-jjb-deps)
+ $(activate) && { jenkins-jobs $(lint-jjb-args); }
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo ' lint-jjb Validate jjb job generation'
+ifdef VERBOSE
+ @echo ' DEBUG=1 lint-jjb --log_level=DEBUG'
+endif
+
+# [EOF]
diff --git a/makefiles/lint/json.mk b/makefiles/lint/json.mk
new file mode 100644
index 0000000..1deeaba
--- /dev/null
+++ b/makefiles/lint/json.mk
@@ -0,0 +1,92 @@
+# -*- 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-json lint-json-all lint-json-modified
+
+have-json-files := $(if $(strip $(JSON_FILES)),true)
+JSON_FILES ?= $(error JSON_FILES= required)
+
+## -----------------------------------------------------------------------
+## Intent: Use the json 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-json-all
+## -----------------------------------------------------------------------
+ifndef NO-LINT-JSON
+ lint-json-mode := $(if $(have-json-files),modified,all)
+ lint : lint-json-$(lint-json-mode)
+endif# NO-LINT-JSON
+
+## -----------------------------------------------------------------------
+## Intent: exhaustive json syntax checking
+## -----------------------------------------------------------------------
+json-find-args := $(null)
+json-find-args += -name '$(venv-name)'
+lint-json-all:
+ $(HIDE)$(MAKE) --no-print-directory lint-json-install
+
+ $(activate)\
+ && find . \( $(json-find-args) \) -prune -o -name '*.json' -print0 \
+ | $(xargs-n1) python -m json.tool > /dev/null ;\
+
+## -----------------------------------------------------------------------
+## Intent: check deps for format and python3 cleanliness
+## Note:
+## json --py3k option no longer supported
+## -----------------------------------------------------------------------
+lint-json-modified: $(venv-activate-script)
+ $(HIDE)$(MAKE) --no-print-directory lint-json-install
+
+ $(activate)\
+ && for jsonfile in $(JSON_FILES); do \
+ echo "Validating json file: $$jsonfile" ;\
+ python -m json.tool $$jsonfile > /dev/null ;\
+ done
+
+## -----------------------------------------------------------------------
+## Intent:
+## -----------------------------------------------------------------------
+.PHONY: lint-json-install
+lint-json-install: $(venv-activate-script)
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** json syntax checking"
+ @echo "** -----------------------------------------------------------------------"
+# $(activate) && pip install --upgrade json.tool
+# $(activate) && python -m json.tool --version (?-howto-?)
+ @echo
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-json Syntax check python using the json command'
+ ifdef VERBOSE
+ @echo ' lint-json-all json checking: exhaustive'
+ @echo ' lint-json-modified json checking: only modified'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/help.mk b/makefiles/lint/license/include.mk
similarity index 62%
copy from makefiles/help.mk
copy to makefiles/lint/license/include.mk
index fba51fe..2b42049 100644
--- a/makefiles/help.mk
+++ b/makefiles/lint/license/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors (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.
@@ -15,19 +15,27 @@
# limitations under the License.
# -----------------------------------------------------------------------
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-REUSE
+ lint : lint-license
+endif
+
## -----------------------------------------------------------------------
+## Intent: Perform a lint check on makefile sources
## -----------------------------------------------------------------------
-.PHONY: help
-help ::
- @echo "Usage: $(MAKE) [options] [target] ..."
-# @echo
-# @echo "[CLEAN]"
-# @echo " clean : Remove files created by the build"
-# @echo " distclean : Remove build and testing artifacts and reports"
-# @echo
-# @echo "[LINT]"
-# @echo " lint : Shorthand for lint-style & lint-sanity"
-# @echo " lint-mod : Verify the integrity of the 'mod' files"
-# @echo " sca : "
+lint-license:
+ reuse --root . lint
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-reuse License syntax checking'
# [EOF]
diff --git a/makefiles/help.mk b/makefiles/lint/license/reuse.mk
similarity index 62%
copy from makefiles/help.mk
copy to makefiles/lint/license/reuse.mk
index fba51fe..5572bef 100644
--- a/makefiles/help.mk
+++ b/makefiles/lint/license/reuse.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors (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.
@@ -15,19 +15,27 @@
# limitations under the License.
# -----------------------------------------------------------------------
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-REUSE
+ lint : lint-license
+endif
+
## -----------------------------------------------------------------------
+## Intent: Perform a lint check on makefile sources
## -----------------------------------------------------------------------
-.PHONY: help
-help ::
- @echo "Usage: $(MAKE) [options] [target] ..."
-# @echo
-# @echo "[CLEAN]"
-# @echo " clean : Remove files created by the build"
-# @echo " distclean : Remove build and testing artifacts and reports"
-# @echo
-# @echo "[LINT]"
-# @echo " lint : Shorthand for lint-style & lint-sanity"
-# @echo " lint-mod : Verify the integrity of the 'mod' files"
-# @echo " sca : "
+lint-license:
+ reuse --root . lint
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-reuse License syntax checking"
# [EOF]
diff --git a/makefiles/lint/makefile.mk b/makefiles/lint/makefile.mk
index 522d027..27206e0 100644
--- a/makefiles/lint/makefile.mk
+++ b/makefiles/lint/makefile.mk
@@ -1,6 +1,18 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# 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.
# -----------------------------------------------------------------------
##-------------------##
@@ -14,7 +26,8 @@
make-check-find += -o \( -iname makefile -o -name '*.mk' \)
make-check-find += -type f -print0
-make-check := $(env-clean) $(MAKE)
+make-check := $(MAKE)
+
make-check-args += --dry-run
make-check-args += --keep-going
make-check-args += --warn-undefined-variables
@@ -31,14 +44,22 @@
endif
## -----------------------------------------------------------------------
+## Intent: Perform a lint check on makefile sources
## -----------------------------------------------------------------------
+lint-make-ignore += JSON_FILES=
+lint-make-ignore += YAML_FILES=
lint-make:
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** Makefile syntax checking"
+ @echo "** -----------------------------------------------------------------------"
$(HIDE)$(env-clean) $(make-check-find) \
- | $(xargs-n1-local) $(make-check) $(make-check-args)
+ | $(xargs-n1-local) $(make-check) $(make-check-args) $(lint-make-ignore)
## -----------------------------------------------------------------------
+## Intent: Display command help
## -----------------------------------------------------------------------
-help ::
- @echo ' lint-make Syntax check [Mm]akefile and *.mk'
+help-summary ::
+ @echo ' lint-make Syntax check [Mm]akefile and *.mk'
# [EOF]
diff --git a/makefiles/lint/python.mk b/makefiles/lint/python.mk
index 9252657..d3fe4fd 100644
--- a/makefiles/lint/python.mk
+++ b/makefiles/lint/python.mk
@@ -1,6 +1,18 @@
# -*- 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.
# -----------------------------------------------------------------------
##-------------------##
@@ -26,14 +38,16 @@
endif
## -----------------------------------------------------------------------
+## Intent: Perform a lint check on makefile sources
## -----------------------------------------------------------------------
lint-python:
$(HIDE)$(env-clean) $(python-check-find) \
| $(xargs-n1) $(python-check) $(python-check-args)
## -----------------------------------------------------------------------
+## Intent: Display command help
## -----------------------------------------------------------------------
-help ::
- @echo ' lint-python Syntax check python sources'
+help-summary ::
+ @echo ' lint-python Syntax check python sources (*.py)'
# [EOF]
diff --git a/makefiles/lint/robot.mk b/makefiles/lint/robot.mk
new file mode 100644
index 0000000..f33c4ba
--- /dev/null
+++ b/makefiles/lint/robot.mk
@@ -0,0 +1,43 @@
+# -*- 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.
+# -----------------------------------------------------------------------
+
+ROBOT_FILES ?= $(error ROBOT_FILES= is required)
+
+LINT_ARGS ?= --verbose --configure LineTooLong:130 -e LineTooLong \
+ --configure TooManyTestSteps:65 -e TooManyTestSteps \
+ --configure TooManyTestCases:50 -e TooManyTestCases \
+ --configure TooFewTestSteps:1 \
+ --configure TooFewKeywordSteps:1 \
+ --configure FileTooLong:2000 -e FileTooLong \
+ -e TrailingWhitespace
+
+
+.PHONY: lint-robot
+
+ifndef NO-LINT-ROBOT
+ lint : lint-robot
+endif
+
+lint-robot: vst_venv
+ source ./$</bin/activate \
+ ; set -u \
+ ; rflint $(LINT_ARGS) $(ROBOT_FILES)
+
+help::
+ @echo " lint-robot Syntax check robot sources using rflint"
+
+# [EOF]
diff --git a/makefiles/lint/shell.mk b/makefiles/lint/shell.mk
index cadc084..704038c 100644
--- a/makefiles/lint/shell.mk
+++ b/makefiles/lint/shell.mk
@@ -1,6 +1,21 @@
# -*- 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.
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
# -----------------------------------------------------------------------
##-------------------##
@@ -18,7 +33,8 @@
# shell-check := $(env-clean) pylint
shell-check := shellcheck
-shell-check-args += -a
+shell-check-args += --check-sourced
+shell-check-args += --external-sources
##-------------------##
##---] TARGETS [---##
@@ -28,6 +44,7 @@
endif
## -----------------------------------------------------------------------
+## Intent: Perform a lint check on command line script sources
## -----------------------------------------------------------------------
lint-shell:
$(shell-check) -V
@@ -36,8 +53,13 @@
| $(xargs-n1) $(shell-check) $(shell-check-args)
## -----------------------------------------------------------------------
+## Intent: Display command help
## -----------------------------------------------------------------------
-help ::
- @echo ' lint-shell Syntax check shell sources'
+help-summary ::
+ @echo ' lint-shell Syntax check shell sources'
+
+# [SEE ALSO]
+# -----------------------------------------------------------------------
+# o https://www.shellcheck.net/wiki/Directive
# [EOF]
diff --git a/makefiles/lint/urls b/makefiles/lint/urls
new file mode 100644
index 0000000..5694a1b
--- /dev/null
+++ b/makefiles/lint/urls
@@ -0,0 +1,5 @@
+# -*- makefile -*-
+
+https://www.shellcheck.net/wiki/Directive
+
+# [EOF]
\ No newline at end of file
diff --git a/makefiles/lint/yaml.mk b/makefiles/lint/yaml.mk
new file mode 100644
index 0000000..ab5b9d6
--- /dev/null
+++ b/makefiles/lint/yaml.mk
@@ -0,0 +1,84 @@
+# -*- 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)
+
+## -----------------------------------------------------------------------
+## Intent: Use the yaml 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-yaml-all
+## -----------------------------------------------------------------------
+lint-yaml-mode := $(if $(have-yaml-files),modified,all)
+lint-yaml : lint-yaml-$(lint-yaml-mode)
+
+ifndef NO-LINT-YAML
+ lint : lint-yaml# # Enable as a default lint target
+endif# NO-LINT-YAML
+
+## -----------------------------------------------------------------------
+## Intent: exhaustive yaml syntax checking
+## -----------------------------------------------------------------------
+lint-yaml-all:
+ $(HIDE)$(MAKE) --no-print-directory lint-yaml-install
+
+ find . \( -iname '*.yaml' -o -iname '*.yml' \) -print0 \
+ | $(xargs-n1-clean) yamllint --strict
+
+## -----------------------------------------------------------------------
+## Intent: check deps for format and python3 cleanliness
+## Note:
+## yaml --py3k option no longer supported
+## -----------------------------------------------------------------------
+lint-yaml-modified:
+ $(HIDE)$(MAKE) --no-print-directory lint-yaml-install
+ yamllint -s $(YAML_FILES)
+
+## -----------------------------------------------------------------------
+## Intent:
+## -----------------------------------------------------------------------
+lint-yaml-install:
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** yaml syntax checking"
+ @echo "** -----------------------------------------------------------------------"
+ yamllint --version
+ @echo
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-yaml Syntax check python using the yaml command'
+ ifdef VERBOSE
+ @echo ' lint-yaml-all yaml checking: exhaustive'
+ @echo ' lint-yaml-modified yaml checking: only locally modified'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/yaml/.yamllint b/makefiles/lint/yaml/.yamllint
deleted file mode 100644
index 6a4fc1e..0000000
--- a/makefiles/lint/yaml/.yamllint
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- makefile -*-
-# -----------------------------------------------------------------------
-# Copyright 2022 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/python.mk b/makefiles/lint/yaml/python.mk
deleted file mode 100644
index 868d9b7..0000000
--- a/makefiles/lint/yaml/python.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- makefile -*-
-# -----------------------------------------------------------------------
-# Copyright 2022 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/todo b/makefiles/lint/yaml/todo
deleted file mode 100644
index 8a9367b..0000000
--- a/makefiles/lint/yaml/todo
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- makefile -*-
-# -----------------------------------------------------------------------
-# Copyright 2022 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/urls b/makefiles/lint/yaml/urls
deleted file mode 100644
index 8747658..0000000
--- a/makefiles/lint/yaml/urls
+++ /dev/null
@@ -1,5 +0,0 @@
-# -*- makefile -*-
-
-https://yamllint.readthedocs.io/en/stable/configuration.html
-
-# [EOF]
\ No newline at end of file
diff --git a/makefiles/lint/yaml/yamllint.mk b/makefiles/lint/yaml/yamllint.mk
deleted file mode 100644
index 9556a45..0000000
--- a/makefiles/lint/yaml/yamllint.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- makefile -*-
-# -----------------------------------------------------------------------
-# Copyright 2022 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))
-
-yamllint := $(env-clean) yamllint
-
-## -------------------------------
-## Add requirement(s) for checking
-## -------------------------------
-# yamllint-cfg := .yamllint
-yamllint-cfg := yamllint.helm
-yamllint-conf = $(wildcard $(yamllint-cfg) $(MAKEDIR)/lint/yaml/$(yamllint-cfg))
-yamllint-args += $(addprefix --config-file$(space),$(yamllint-conf))
-
-# yamllint-args := --no-warnings
-# yamllint-args := --strict
-
-yamllint-find := find . -name 'vendor' -prune
-yamllint-find += -o -name '*.yaml' -type f
-yamllint-find += -print0
-
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
-lint lint-yaml:
- $(HIDE)$(env-clean) $(yamllint-find) \
- | xargs -0 --no-run-if-empty -t -n1 $(yamllint) $(yamllint-args)
-
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
-help::
- @echo " lint-yaml Syntax check yaml sources"
-
-$(if $(DEBUG),$(warning ENTER))
-
-# [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/help.mk b/makefiles/targets/check.mk
similarity index 61%
copy from makefiles/help.mk
copy to makefiles/targets/check.mk
index fba51fe..2145343 100644
--- a/makefiles/help.mk
+++ b/makefiles/targets/check.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors (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.
@@ -13,21 +13,26 @@
# 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))
+
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
-.PHONY: help
-help ::
- @echo "Usage: $(MAKE) [options] [target] ..."
-# @echo
-# @echo "[CLEAN]"
-# @echo " clean : Remove files created by the build"
-# @echo " distclean : Remove build and testing artifacts and reports"
-# @echo
-# @echo "[LINT]"
-# @echo " lint : Shorthand for lint-style & lint-sanity"
-# @echo " lint-mod : Verify the integrity of the 'mod' files"
-# @echo " sca : "
+.PHONY: check
+check : lint lint-yaml lint-jjb
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help-verbose += help-check
+help-check ::
+ @echo
+ @echo '[MAKE: check]'
+ @echo ' check pre-commit checking, with extra targets (default:NO, jenkins:FAIL)'
+
+$(if $(DEBUG),$(warning LEAVE))
# [EOF]
diff --git a/makefiles/help.mk b/makefiles/targets/clean.mk
similarity index 60%
copy from makefiles/help.mk
copy to makefiles/targets/clean.mk
index fba51fe..f504dec 100644
--- a/makefiles/help.mk
+++ b/makefiles/targets/clean.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors (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.
@@ -13,21 +13,28 @@
# 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: Remove makefile generated content
+## -----------------------------------------------------------------------
+.PHONY: clean
+clean ::
+ $(RM) -r $(JOBCONFIG_DIR)
+
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
-.PHONY: help
-help ::
- @echo "Usage: $(MAKE) [options] [target] ..."
-# @echo
-# @echo "[CLEAN]"
-# @echo " clean : Remove files created by the build"
-# @echo " distclean : Remove build and testing artifacts and reports"
-# @echo
-# @echo "[LINT]"
-# @echo " lint : Shorthand for lint-style & lint-sanity"
-# @echo " lint-mod : Verify the integrity of the 'mod' files"
-# @echo " sca : "
+help-verbose += help-clean
+help-clean ::
+ @echo
+ @echo '[MAKE: clean]'
+ @echo ' clean Remove makefile generated content'
+
+$(if $(DEBUG),$(warning LEAVE))
# [EOF]
diff --git a/makefiles/targets/sterile.mk b/makefiles/targets/sterile.mk
new file mode 100644
index 0000000..1eb7035
--- /dev/null
+++ b/makefiles/targets/sterile.mk
@@ -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
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## Intent: Revert sandbox into a pristine checkout stage
+## -----------------------------------------------------------------------
+## Note: Sterile target behavior differs from clean around handling of
+## persistent content. For ex removal of a python virtualenv adds
+## extra overhead to development iteration:
+## make clean - preserve a virtual env
+## make sterile - force reinstallation
+## -----------------------------------------------------------------------
+.PHONY: sterile
+sterile :: clean
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help-verbose += help-sterile
+help-sterile ::
+ @echo
+ @echo '[MAKE: sterile]'
+ @echo ' sterile make clean, also remove persistent content (~venv)'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/targets/test.mk b/makefiles/targets/test.mk
new file mode 100644
index 0000000..d70fa4a
--- /dev/null
+++ b/makefiles/targets/test.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
+# -----------------------------------------------------------------------
+
+$(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/tox.mk b/makefiles/targets/tox.mk
new file mode 100644
index 0000000..b3a638b
--- /dev/null
+++ b/makefiles/targets/tox.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
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## Intent: Sanity check incoming JJB config changes.
+## Todo: Depend on makefiles/lint/jjb.mk :: lint-jjb
+## -----------------------------------------------------------------------
+# lint : lint-jjb
+lint-tox: lint-jjb
+ tox -e py310
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help-verbose += help-tox
+help-tox ::
+ @echo
+ @echo '[MAKE: tox]'
+ @echo ' lint-tox Python unit testing, sanity check incoming JJB changes.'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/help.mk b/makefiles/todo.mk
similarity index 65%
rename from makefiles/help.mk
rename to makefiles/todo.mk
index fba51fe..d97dbbb 100644
--- a/makefiles/help.mk
+++ b/makefiles/todo.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors (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.
@@ -13,21 +13,22 @@
# 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))
+
+todo ::
+ @echo '[TODO]'
+ @echo ' o volthaStackDeploy.groovy - post v2.11 release cleanup for 2.8'
+
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
-.PHONY: help
help ::
- @echo "Usage: $(MAKE) [options] [target] ..."
-# @echo
-# @echo "[CLEAN]"
-# @echo " clean : Remove files created by the build"
-# @echo " distclean : Remove build and testing artifacts and reports"
-# @echo
-# @echo "[LINT]"
-# @echo " lint : Shorthand for lint-style & lint-sanity"
-# @echo " lint-mod : Verify the integrity of the 'mod' files"
-# @echo " sca : "
+ @echo ' todo Display future enhancement list.'
+
+$(if $(DEBUG),$(warning LEAVE))
# [EOF]
diff --git a/makefiles/lint/yaml/yamllint.helm b/makefiles/utils/include.mk
similarity index 76%
rename from makefiles/lint/yaml/yamllint.helm
rename to makefiles/utils/include.mk
index 6c7787b..84f684b 100644
--- a/makefiles/lint/yaml/yamllint.helm
+++ b/makefiles/utils/include.mk
@@ -1,6 +1,6 @@
# -*- 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.
@@ -17,16 +17,13 @@
# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
----
-# yamllint.conf
-extends: default
+$(if $(DEBUG),$(warning ENTER))
-rules:
- empty-lines:
- max-end: 1
- line-length:
- max: 120
- braces:
- min-spaces-inside: 0
- max-spaces-inside: 1
+# 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
new file mode 100644
index 0000000..c6904da
--- /dev/null
+++ b/makefiles/virtualenv.mk
@@ -0,0 +1,82 @@
+# -*- 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.
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: venv
+
+##------------------##
+##---] LOCALS [---##
+##------------------##
+venv-name ?= .venv# # default install directory
+venv-abs-path := $(PWD)/$(venv-name)
+
+venv-activate-script := $(venv-name)/bin/activate# # dependency
+
+# Intent: activate= is a macro for accessing the virtualenv activation script#
+# Usage: $(activate) && python
+activate ?= set +u && source $(venv-activate-script) && set -u
+
+## -----------------------------------------------------------------------
+## Intent: Activate script path dependency
+## Usage:
+## o place on the right side of colon as a target dependency
+## o When the script does not exist install the virtual env and display.
+## -----------------------------------------------------------------------
+$(venv-activate-script):
+ @echo
+ @echo "============================="
+ @echo "Installing python virtual env"
+ @echo "============================="
+ virtualenv -p python3 $(venv-name)
+ $(activate) && python -m pip install --upgrade pip
+ $(activate) && pip install --upgrade setuptools
+ $(activate) && { [[ -r requirements.txt ]] && python -m pip install -r requirements.txt; }
+ $(activate) && python --version
+
+## -----------------------------------------------------------------------
+## Intent: Explicit named installer target w/o dependencies.
+## Makefile targets should depend on venv-activate-script.
+## -----------------------------------------------------------------------
+venv: $(venv-activate-script)
+
+## -----------------------------------------------------------------------
+## Intent: Revert installation to a clean checkout
+## -----------------------------------------------------------------------
+sterile :: clean
+ $(RM) -r "$(venv-abs-path)"
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo
+ @echo '[VIRTUAL ENV]'
+ @echo ' venv Create a python virtual environment'
+ @echo ' venv-name= Subdir name for virtualenv install'
+ @echo ' venv-activate-script make macro name'
+ @echo ' $$(target) dependency install python virtualenv'
+ @echo ' source $$(macro) && cmd configure env and run cmd'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]