From 02fbc6d2b229070129bc7a0b6a0a7603b2590123 Mon Sep 17 00:00:00 2001 From: Nicolas PLANEL Date: Thu, 6 Mar 2025 19:04:29 +0100 Subject: [PATCH 1/6] index: add VPP repository FD.io's Vector Packet Processor (VPP) is a fast, scalable layer 2-4 multi-platform network stack. It runs in Linux Userspace on multiple architectures including x86, ARM, and Power architectures. VPP's high performance network stack is quickly becoming the network stack of choice for applications around the world. Signed-off-by: Nicolas PLANEL Signed-off-by: Nicolas PLANEL --- utils/index | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/index b/utils/index index 6e84a3e7..407bad4e 100755 --- a/utils/index +++ b/utils/index @@ -140,6 +140,7 @@ add_default_remotes $1 $# $2 linux https://git.kernel.org/pub/scm/linux/kernel/g https://github.com/bootlin/linux-history.git add_default_remotes $1 $# $2 xen https://xenbits.xen.org/git-http/xen.git add_default_remotes $1 $# $2 freebsd https://git.freebsd.org/src.git +add_default_remotes $1 $# $2 vpp https://gerrit.fd.io/r/vpp # Index a single project if test "x$2" != "x--all"; then From 576340848007f5743a978a067a33722792ad17e5 Mon Sep 17 00:00:00 2001 From: Nicolas PLANEL Date: Mon, 17 Mar 2025 17:35:31 +0100 Subject: [PATCH 2/6] filter: introduce prefix_path parameter --- elixir/filters/cpppathinc.py | 2 +- elixir/filters/projects.py | 5 +++++ elixir/filters/utils.py | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/elixir/filters/cpppathinc.py b/elixir/filters/cpppathinc.py index 6d3c48c2..6049e6e0 100755 --- a/elixir/filters/cpppathinc.py +++ b/elixir/filters/cpppathinc.py @@ -35,7 +35,7 @@ def keep_cpppathinc(m): def untransform_formatted_code(self, ctx: FilterContext, html: str) -> str: def replace_cpppathinc(m): w = self.cpppathinc[decode_number(m.group(1)) - 1] - path = f'/include/{ w }' + path = f'/%s/{ w }' % self.prefix_path return f'{ w }' return re.sub('__KEEPCPPPATHINC__([A-J]+)', replace_cpppathinc, html, flags=re.MULTILINE) diff --git a/elixir/filters/projects.py b/elixir/filters/projects.py index 1059ebd4..2568fff1 100755 --- a/elixir/filters/projects.py +++ b/elixir/filters/projects.py @@ -102,6 +102,11 @@ *default_filters, ConfigInFilter, ], + 'vpp': [ + *default_filters, + (CppPathIncFilter, {"prefix_path": 'src'}), + MakefileFileFilter, + ], 'zephyr': [ *default_filters, DtsiFilter, diff --git a/elixir/filters/utils.py b/elixir/filters/utils.py index e0d74398..9b5b949c 100755 --- a/elixir/filters/utils.py +++ b/elixir/filters/utils.py @@ -28,9 +28,11 @@ class FilterContext: # up to the filter, but it's important to be careful to not break formatting. # The second part runs on HTML, replacing markings left by the first part with HTML code. # path_exceptions: list of regexes, disables filter if path of the filtered file matches a regex from the list +# prefix_path: will be used to replace the prefix path during the untransform_formatted_code step class Filter: - def __init__(self, path_exceptions: List[str] = []): + def __init__(self, path_exceptions: List[str] = [], prefix_path: str = "include"): self.path_exceptions = path_exceptions + self.prefix_path = prefix_path # Return True if filter can be applied to file with path def check_if_applies(self, ctx: FilterContext) -> bool: From 221b9e104c94612d7250d22d118d9f8e0115f2f0 Mon Sep 17 00:00:00 2001 From: Nicolas PLANEL Date: Mon, 17 Mar 2025 20:05:03 +0100 Subject: [PATCH 3/6] cpppathinc: prefix_path as a list of prefix path --- elixir/filters/cpppathinc.py | 7 +++++-- elixir/filters/projects.py | 2 +- elixir/filters/utils.py | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/elixir/filters/cpppathinc.py b/elixir/filters/cpppathinc.py index 6049e6e0..9c21fc73 100755 --- a/elixir/filters/cpppathinc.py +++ b/elixir/filters/cpppathinc.py @@ -35,8 +35,11 @@ def keep_cpppathinc(m): def untransform_formatted_code(self, ctx: FilterContext, html: str) -> str: def replace_cpppathinc(m): w = self.cpppathinc[decode_number(m.group(1)) - 1] - path = f'/%s/{ w }' % self.prefix_path - return f'{ w }' + for p in self.prefix_path: + path = f'/%s/{ w }' % p + if ctx.query.query('exist', ctx.tag, path): + return f'{ w }' + return w return re.sub('__KEEPCPPPATHINC__([A-J]+)', replace_cpppathinc, html, flags=re.MULTILINE) diff --git a/elixir/filters/projects.py b/elixir/filters/projects.py index 2568fff1..7476df85 100755 --- a/elixir/filters/projects.py +++ b/elixir/filters/projects.py @@ -104,7 +104,7 @@ ], 'vpp': [ *default_filters, - (CppPathIncFilter, {"prefix_path": 'src'}), + (CppPathIncFilter, {"prefix_path": ['src', 'src/plugins']}), MakefileFileFilter, ], 'zephyr': [ diff --git a/elixir/filters/utils.py b/elixir/filters/utils.py index 9b5b949c..fe2d3e4f 100755 --- a/elixir/filters/utils.py +++ b/elixir/filters/utils.py @@ -28,9 +28,9 @@ class FilterContext: # up to the filter, but it's important to be careful to not break formatting. # The second part runs on HTML, replacing markings left by the first part with HTML code. # path_exceptions: list of regexes, disables filter if path of the filtered file matches a regex from the list -# prefix_path: will be used to replace the prefix path during the untransform_formatted_code step +# prefix_path: a list of paths, will be used to replace the prefix path during the untransform_formatted_code step class Filter: - def __init__(self, path_exceptions: List[str] = [], prefix_path: str = "include"): + def __init__(self, path_exceptions: List[str] = [], prefix_path: List[str] = ["include"]): self.path_exceptions = path_exceptions self.prefix_path = prefix_path From 47009a74d7bc6b180449f6f4231c892a2efe2b7d Mon Sep 17 00:00:00 2001 From: Nicolas PLANEL Date: Mon, 17 Mar 2025 20:24:35 +0100 Subject: [PATCH 4/6] add more search include path --- elixir/filters/projects.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elixir/filters/projects.py b/elixir/filters/projects.py index 7476df85..6715a7ab 100755 --- a/elixir/filters/projects.py +++ b/elixir/filters/projects.py @@ -104,7 +104,7 @@ ], 'vpp': [ *default_filters, - (CppPathIncFilter, {"prefix_path": ['src', 'src/plugins']}), + (CppPathIncFilter, {"prefix_path": ['src', 'src/plugins', 'src/vpp-api', 'src/vpp-api/vapi']}), MakefileFileFilter, ], 'zephyr': [ From f7feb34bc6aaa7702f2499346cb6a1170653a87c Mon Sep 17 00:00:00 2001 From: Nicolas PLANEL Date: Mon, 28 Apr 2025 14:28:36 +0200 Subject: [PATCH 5/6] move prefix_path arg to CppPathIncFilter --- elixir/filters/cpppathinc.py | 5 ++++- elixir/filters/utils.py | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/elixir/filters/cpppathinc.py b/elixir/filters/cpppathinc.py index 9c21fc73..0915fcfa 100755 --- a/elixir/filters/cpppathinc.py +++ b/elixir/filters/cpppathinc.py @@ -1,4 +1,5 @@ import re +from typing import List from .utils import Filter, FilterContext, encode_number, decode_number, extension_matches # Filters for cpp includes like these: @@ -8,8 +9,10 @@ # If we make references to other projects, we could # end up with links to headers which are outside the project # Example: u-boot/v2023.10/source/env/embedded.c#L16 +# prefix_path: a list of paths, will be used to replace the prefix path during the untransform_formatted_code step class CppPathIncFilter(Filter): - def __init__(self, *args, **kwargs): + def __init__(self, prefix_path: List[str] = ["include"], *args, **kwargs): + self.prefix_path = prefix_path super().__init__(*args, **kwargs) self.cpppathinc = [] diff --git a/elixir/filters/utils.py b/elixir/filters/utils.py index fe2d3e4f..e0d74398 100755 --- a/elixir/filters/utils.py +++ b/elixir/filters/utils.py @@ -28,11 +28,9 @@ class FilterContext: # up to the filter, but it's important to be careful to not break formatting. # The second part runs on HTML, replacing markings left by the first part with HTML code. # path_exceptions: list of regexes, disables filter if path of the filtered file matches a regex from the list -# prefix_path: a list of paths, will be used to replace the prefix path during the untransform_formatted_code step class Filter: - def __init__(self, path_exceptions: List[str] = [], prefix_path: List[str] = ["include"]): + def __init__(self, path_exceptions: List[str] = []): self.path_exceptions = path_exceptions - self.prefix_path = prefix_path # Return True if filter can be applied to file with path def check_if_applies(self, ctx: FilterContext) -> bool: From 3be5c76fff8882b259c22c1fbfb15bbc3c744806 Mon Sep 17 00:00:00 2001 From: Nicolas PLANEL Date: Mon, 28 Apr 2025 17:38:00 +0200 Subject: [PATCH 6/6] use Query.file_exists() --- elixir/filters/cpppathinc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elixir/filters/cpppathinc.py b/elixir/filters/cpppathinc.py index 0915fcfa..d37875a5 100755 --- a/elixir/filters/cpppathinc.py +++ b/elixir/filters/cpppathinc.py @@ -40,7 +40,7 @@ def replace_cpppathinc(m): w = self.cpppathinc[decode_number(m.group(1)) - 1] for p in self.prefix_path: path = f'/%s/{ w }' % p - if ctx.query.query('exist', ctx.tag, path): + if ctx.query.file_exists(ctx.tag, path): return f'{ w }' return w