[VOL-5342] - Install repo:onf-make as a git submodule
.gitmodules
.pre-commit-config.yaml
Makefile
config.mk
lf/README.md
lf/config.mk
lf/include.mk
lf/local/include.mk
lf/onf-make
lf/transition.mk
makefiles/include.mk
makefiles/lint/include.mk
-------------------------
o Added transition.mk -- bridge logic for migrating to repo:onf-make.
o Updated a few paths in makefiles/ to use latest lint and virtualenv
makefiles to workaround some warnings and failures in the case of lint.
Change-Id: I1b5d3e46d57e427950ee772a4555f5f75a817417
diff --git a/.gitignore b/.gitignore
index 5c5722a..cd0f1bb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,7 @@
# Virtualenv
python/venv-*
+.venv/
# Protobuf output files
python/**/*_pb2.py
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..758cef6
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "lf/onf-make"]
+ path = lf/onf-make
+ url = https://github.com/opencord/onf-make.git
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 2d66b1e..4d2327f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -35,7 +35,7 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# -----------------------------------------------------------------------
-# .pre-commit-config-yaml 2024-04-19 v0.4
+# .pre-commit-config-yaml v0.6
# -----------------------------------------------------------------------
# ci:
@@ -115,10 +115,10 @@
## -----------------------------------------------------------------------
## [SOURCE] REUSE License Checking
## -----------------------------------------------------------------------
-# - repo: https://github.com/fsfe/reuse-tool
-# rev: v3.0.2
-# hooks:
-# - id: reuse
+ # - repo: https://github.com/fsfe/reuse-tool
+ # rev: v3.0.2
+ # hooks:
+ # - id: reuse
# - id: add-license-headers
# - repo: https://github.com/ansys/pre-commit-hooks
@@ -166,15 +166,11 @@
# -------------------------------------------------------------------
exclude: |
(?x)^(
- ^jjb/.* |
^makefiles/.* |
^lf/.* |
^.venv/.* |
- ^jenkins-scripts/.* |
- ^lf-ansible/.* |
- ^packer/.* |
- ^test/.* |
- ^jjb/pipeline/voltha/voltha-physical-soak-dt-tests.groovy
+ ^.vendor/.* |
+ ^ignore--end-of-exclusion-marker
)$
# [SEE ALSO]
diff --git a/Makefile b/Makefile
index 21b9e81..3a131d0 100644
--- a/Makefile
+++ b/Makefile
@@ -17,15 +17,25 @@
$(if $(DEBUG),$(warning ENTER))
-.DEFAULT_GOAL := help
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+ifndef .DEFAULT_GOAL
+ .DEFAULT_GOAL := help # ?= help evaluated late
+endif
+MAKECMDGOALS ?= help
-$(if $(VERBOSE),$(eval export VERBOSE=$(VERBOSE))) # visible to include(s)
+$(if $(findstring disabled-joey,$(USER)),\
+ $(eval USE_LF_MK := 1)) # special snowflake
##--------------------##
##---] INCLUDES [---##
##--------------------##
-include config.mk
-include makefiles/include.mk
+ifdef USE_LF_MK
+ include lf/include.mk
+else
+ include lf/transition.mk
+endif # ifdef USE_LF_MK
# Variables
VERSION ?= $(shell cat ./VERSION)
@@ -162,7 +172,7 @@
## -----------------------------------------------------------------------
lint: lint-mod lint-dockerfile ## Run all lint targets
-include $(MAKEDIR)/analysis/include.mk
+include $(legacy-mk)/analysis/include.mk
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
@@ -178,7 +188,7 @@
distclean sterile :: ## Removes any local filesystem artifacts generated by a build or test run
$(RM) -r ./sca-report
-fmt: ## Formats the soure code to go best practice style
+fmt: ## Formats the source code to go best practice style
gofmt -s -e -w $(PACKAGES)
# @go fmt ${PACKAGES}
diff --git a/VERSION b/VERSION
index 86bab9c..7bc7793 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.6.0-dev
+3.6.0-dev1
diff --git a/config.mk b/config.mk
deleted file mode 100644
index d843dee..0000000
--- a/config.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- makefile -*-
-# -----------------------------------------------------------------------
-# Copyright 2023-2024 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.
-# -----------------------------------------------------------------------
-
-##--------------------------------##
-##---] Disable lint targets [---##
-##--------------------------------##
-NO-LINT-GROOVY := true# #
-NO-LINT-JJB := true
-# NO-LINT-JSON := true# # Note[1]
-NO-LINT-REUSE := true# # License check
-NO-LINT-MAKEFILE := true
-NO-LINT-PYTHON := true# # Note[1]
-NO-LINT-SHELL := true# # Note[1]
-NO-LINT-YAML := true# # Note[1]
-
-# Note[1] - Plenty of source to cleanup
-
-##---------------------------------##
-##---] Conditional make logic [---##
-##---------------------------------##
-USE_DOCKER_MK := true
-
-# [EOF]
diff --git a/lf/README.md b/lf/README.md
new file mode 100644
index 0000000..9ffb383
--- /dev/null
+++ b/lf/README.md
@@ -0,0 +1,39 @@
+Library makefiles
+=================
+
+$(sandbox-root)/include.mk
+ Source this makefile to import all makefile logic.
+
+$(sandbox-root)/lf/onf-make/
+$(sandbox-root)/lf/onf-make/include.mk
+ repo:onf-make contains common library makefile logic.
+ tag based checkout (frozen) as a git submodule.
+
+$(sandbox-root)/lf/local/
+$(sandbox-root)/lf/local/include.mk
+ per-repository targets and logic to customize makefile behavior.
+
+<!--
+
+# -----------------------------------------------------------------------
+# Copyright 2024 Open Networking Foundation 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent:
+# -----------------------------------------------------------------------
+
+-->
diff --git a/lf/config.mk b/lf/config.mk
new file mode 100644
index 0000000..dd9b4d5
--- /dev/null
+++ b/lf/config.mk
@@ -0,0 +1,139 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2023-2024 Open Networking Foundation 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: 2023-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent:
+# -----------------------------------------------------------------------
+
+--repo-name-- := voltha-go
+--repo-name-- ?= $(error --repo-name--= is required)
+
+##--------------------------------##
+##---] Disable lint targets [---##
+##--------------------------------##
+# NO-LINT-DOC8 := true
+# USE_DOC8_INI := 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]
+
+# NO-LINT-FLAKE8 := true# # Note[1]
+# NO-LINT-PYTHON := true# # Note[1]
+# NO-LINT-PYLINT := 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 += lf/onf-make # repo:onf-make git submodule
+onf-excl-dirs += .venv# # $(venv-name)
+onf-excl-dirs += patches# # voltha docs - python upgrade
+onf-excl-dirs += .tmp #
+onf-excl-dirs += .tox # also a python dependency
+# onf-excl-dirs += vendor# # golang / voltha*-go -- local exclude
+
+# [NOTE] Add exclusions: lint/doc8/doc8.incl
+
+ifeq ($(--repo-name--),voltha-docs)
+ lint-doc8-excl += '_build' # TODO: deprecate
+endif
+
+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)\
+)
+
+$(if $(filter %voltha-docs,$(--repo-name--)),\
+ $(eval --REPO-IS-VOLTHA-DOCS-- := 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 --REPO-IS-VOLTHA-DOCS--
+ onf-excl-dirs += _build
+ onf-excl-dirs += repos
+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)))
+
+# --------------------------------------------------------------------
+# Repository specific values
+# --------------------------------------------------------------------
+# sterile-dirs += archives
+
+# [EOF]
diff --git a/lf/include.mk b/lf/include.mk
new file mode 100644
index 0000000..5d52907
--- /dev/null
+++ b/lf/include.mk
@@ -0,0 +1,109 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2023-2024 Open Networking Foundation 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: 2023-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## Infer path to cloned sandbox root
+## [TODO] Deprecate TOP=
+## -----------------------------------------------------------------------
+lf-sbx-root := $(abspath $(lastword $(MAKEFILE_LIST)))
+lf-sbx-root := $(subst /lf/include.mk,$(null),$(lf-sbx-root))
+
+## -----------------------------------------------------------------------
+## 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-mk-lib := $(onf-mk-top)/onf-make/makefiles
+onf-mk-loc := $(onf-mk-top)/local
+
+TOP ?= $(patsubst %/makefiles/include.mk,%,$(onf-mk-abs))
+
+## -----------------------------------------------------------------------
+## This variable is a bridge to help transition away from legacy makefiles.
+## -----------------------------------------------------------------------
+legacy-mk := $(lf-sbx-root)/makefiles
+
+## ------------------------------------------------------
+## Two distinct vars needed to access library or project
+## ------------------------------------------------------
+ONF_MAKEDIR ?= $(onf-mk-lib)
+MAKEDIR ?= $(onf-mk-loc)
+
+# -----------------------------------------------------------------------
+# Load per-repository conditionals
+# Load late else alter MAKEFILE_LIST
+# NOTE: config.mk can be removed if dynamic feature detection by
+# file extension is added.
+# -----------------------------------------------------------------------
+include $(wildcard $(lf-sbx-root)/config.mk $(lf-sbx-root)/lf/config.mk)
+
+## -----------------------------------------------------------------------
+## Load makefiles in order:
+## 1) Library constants and logic loaded first
+## 2) Parameterize and augment targets from local (repo specific)
+## -----------------------------------------------------------------------
+include $(onf-mk-lib)/include.mk
+include $(onf-mk-loc)/include.mk
+
+## Define late so caller (?- env --ignore-environment -?)
+GIT ?= /usr/bin/env git
+
+## -----------------------------------------------------------------------
+## Intent: This target will update dependent git-submodule to the latest
+## version available from the remote repository. Subsequently
+## a checkin will be needed to make the submodule update permanent.
+## -----------------------------------------------------------------------
+.PHONY: update-git-submodules
+update-git-submodules:
+ $(GIT) submodule foreach git pull
+
+## -----------------------------------------------------------------------
+## Intent: On-demand cloning of git submodule(s).
+## -----------------------------------------------------------------------
+## Trigger: include $(onf-mk-lib)/include.mk
+## - When the make command attempts to include a makefile from the
+## repo:onf-make submodule, this target/dependency will initialize
+## and checkout all submodules the current repository depends on.
+## -----------------------------------------------------------------------
+.PHONY: git-submodules
+git-submodules : $(onf-mk-lib)/include.mk
+
+$(onf-mk-lib)/include.mk:
+
+ $(call banner-enter,(Checkout git submodules))
+
+ $(GIT) submodule update --init --recursive
+
+ $(call banner-leave,(Checkout git submodules))
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help-git :
+ @printf ' %-33.33s %s\n' 'git-submodules' \
+ 'Init and recursive checkout of git submodule(s)'
+ @printf ' %-33.33s %s\n' 'update-git-submodules' \
+ 'Update git submodule(s) to the latest version'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/lf/local/include.mk b/lf/local/include.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lf/local/include.mk
diff --git a/lf/onf-make b/lf/onf-make
new file mode 160000
index 0000000..78fca2d
--- /dev/null
+++ b/lf/onf-make
@@ -0,0 +1 @@
+Subproject commit 78fca2dfde43820c5b0449e6ec00be7547acf4d6
diff --git a/lf/transition.mk b/lf/transition.mk
new file mode 100644
index 0000000..2aab4a0
--- /dev/null
+++ b/lf/transition.mk
@@ -0,0 +1,70 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2024 Open Networking Foundation 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+lf-sbx-root := $(abspath $(lastword $(MAKEFILE_LIST)))
+lf-sbx-root := $(subst /lf/transition.mk,$(null),$(lf-sbx-root))
+
+legacy-mk ?= $(lf-sbx-root)/makefiles
+onf-mk-dir ?= $(lf-sbx-root)/lf/onf-make/makefiles
+
+sandbox-root := $(lf-sbx-root)
+
+## -----------------------------------------------------------------------
+## Intent: on-demand submodule checkout when make targets are invoked
+## -----------------------------------------------------------------------
+GIT ?= /usr/bin/env git
+
+git-submodule-deps += $(onf-mk-dir)/consts.mk
+git-submodule-deps += $(onf-mk-dir)/etc/features.mk # $(call banner-enter)
+git-submodule-deps += $(onf-mk-dir)/virtualenv/include.mk # make venv
+git-submodule-deps += $(onf-mk-dir)/commands/pre-commit/include.mk
+git-submodule-deps += $(onf-mk-dir)/lint/shell/include.mk
+git-submodule-deps += $(onf-mk-dir)/lint/yaml/include.mk
+
+# git-submodule-deps : $(git-submodule-deps)
+
+$(git-submodule-deps) :
+
+ $(call banner-enter,(Checkout git submodules))
+ $(GIT) submodule update --init --recursive
+ $(call banner-leave,(Checkout git submodules))
+
+##--------------------##
+##---] INCLUDES [---##
+##--------------------##
+include $(lf-sbx-root)/lf/config.mk
+include $(onf-mk-dir)/consts.mk
+# include.mk depends on ONF_MAKEDIR
+include $(onf-mk-dir)/etc/features.mk
+include $(onf-mk-dir)/virtualenv/include.mk
+include $(onf-mk-dir)/commands/pre-commit/include.mk
+
+include $(legacy-mk)/include.mk
+
+
+# dependency of virtualenv::sterile
+clean ::
+
+# [EOF]
diff --git a/makefiles/include.mk b/makefiles/include.mk
index db78850..1a6165d 100644
--- a/makefiles/include.mk
+++ b/makefiles/include.mk
@@ -39,7 +39,7 @@
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)/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
@@ -50,7 +50,8 @@
##---------------------##
##---] ON_DEMAND [---##
##---------------------##
-$(if $(USE_DOCKER_MK),$(eval include $(ONF_MAKEDIR)/docker/include.mk))
+# $(if $(USE_DOCKER_MK),$(eval include $(ONF_MAKEDIR)/docker/include.mk))
+$(if $(USE-ONF-DOCKER-MK),$(eval include $(ONF_MAKEDIR)/docker/include.mk))
##-------------------##
##---] TARGETS [---##
diff --git a/makefiles/lint/include.mk b/makefiles/lint/include.mk
index d2f9e6d..fed8f59 100644
--- a/makefiles/lint/include.mk
+++ b/makefiles/lint/include.mk
@@ -18,8 +18,10 @@
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
+include $(onf-mk-dir)/lint/shell/include.mk
+include $(onf-mk-dir)/lint/yaml/include.mk
+# include $(ONF_MAKEDIR)/lint/shell.mk
+# include $(ONF_MAKEDIR)/lint/yaml.mk
include $(ONF_MAKEDIR)/lint/help.mk