Joey Armstrong | 83874cc | 2022-11-26 09:40:08 -0500 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | 9fadcbe | 2024-01-17 19:00:37 -0500 | [diff] [blame] | 3 | # Copyright 2022-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | 83874cc | 2022-11-26 09:40:08 -0500 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # ----------------------------------------------------------------------- |
| 17 | |
Joey Armstrong | 04cdd9f | 2023-06-09 15:18:23 -0400 | [diff] [blame] | 18 | include $(ONF_MAKEDIR)/patches/help.mk |
Joey Armstrong | 83874cc | 2022-11-26 09:40:08 -0500 | [diff] [blame] | 19 | |
| 20 | patch-gather-args += --exclude=Makefile |
| 21 | patch-gather-args += --exclude-dir=vault |
| 22 | patch-gather-args += --exclude-dir=makefiles |
| 23 | patch-gather-args += --exclude-dir=staging |
| 24 | patch-gather-args += --exclude-dir=patches |
| 25 | |
| 26 | # patch-gather-args += -e 'from collections import' |
| 27 | patch-gather-args += '-e' 'from collections import Mapping' |
| 28 | patch-gather-args += '-e' 'from collections import MutableMapping' |
| 29 | |
Joey Armstrong | 04cdd9f | 2023-06-09 15:18:23 -0400 | [diff] [blame] | 30 | # Defined by [Mm]akefile or makefiles/virtualenv.mk |
| 31 | venv-name ?= $(error $(MAKE) venv-name= is required) |
| 32 | |
| 33 | PATCH_PATH ?= $(error $(MAKE) PATCH_PATH= is required) |
| 34 | |
| 35 | ## ----------------------------------------------------------------------- |
| 36 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 83874cc | 2022-11-26 09:40:08 -0500 | [diff] [blame] | 37 | patch-gather: |
| 38 | grep -r $(patch-gather-args) |
| 39 | |
Joey Armstrong | 04cdd9f | 2023-06-09 15:18:23 -0400 | [diff] [blame] | 40 | ## ----------------------------------------------------------------------- |
| 41 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 83874cc | 2022-11-26 09:40:08 -0500 | [diff] [blame] | 42 | patch-diff: |
Joey Armstrong | 04cdd9f | 2023-06-09 15:18:23 -0400 | [diff] [blame] | 43 | $(HIDE)diff -qr staging $(venv-name) \ |
Joey Armstrong | 83874cc | 2022-11-26 09:40:08 -0500 | [diff] [blame] | 44 | | awk '{print "# diff -Naur "$$2" "$$4}' \ |
| 45 | | tee $@.log |
| 46 | |
Joey Armstrong | 04cdd9f | 2023-06-09 15:18:23 -0400 | [diff] [blame] | 47 | ## ----------------------------------------------------------------------- |
| 48 | ## ----------------------------------------------------------------------- |
| 49 | patch-create: |
| 50 | mkdir -p patches/$(PATCH_PATH) |
| 51 | diff -Naur staging/$(PATCH_PATH) $(venv-name)/$(PATCH_PATH) | tee patches/$(PATCH_PATH)/patch |
| 52 | exit 1 |
| 53 | |
| 54 | ## ----------------------------------------------------------------------- |
| 55 | ## ----------------------------------------------------------------------- |
| 56 | patch-init: |
| 57 | find "$(venv-name)" -name '__pycache__' -type d -print0 \ |
| 58 | | xargs -I'{}' --null --no-run-if-empty $(RM) -r {} |
| 59 | mkdir -p staging |
| 60 | rsync -rv --checksum "$(venv-name)/." "staging/." |
| 61 | @echo "Modify files beneath staging/ to create a patch source" |
| 62 | |
Joey Armstrong | 83874cc | 2022-11-26 09:40:08 -0500 | [diff] [blame] | 63 | # [SEE ALSO] |
| 64 | # --------------------------------------------------------------------------- |
| 65 | # https://bobbyhadz.com/blog/python-importerror-cannot-import-name-mapping-from-collections |
| 66 | # --------------------------------------------------------------------------- |
| 67 | # [EOF] |