From 36a449f1da07c1aad6557348b7bd9e9ee948c908 Mon Sep 17 00:00:00 2001 From: Michal Sieron Date: Sun, 29 Mar 2026 23:58:30 +0200 Subject: [PATCH 1/2] cls_stash: Utility functions for PACKAGES_DYNAMIC There are several recipes in oe-core that utilize this feature and oelint-adv currently will throw false positives for them on checks, which expect package name at some place. Implementing those utility functions in the parser allows to use them in multiple rules without duplicating the code. Signed-off-by: Michal Sieron --- oelint_parser/cls_stash.py | 40 +++++++++++++++++++++++++++++++++- tests/test_packages_dynamic.py | 25 +++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 tests/test_packages_dynamic.py diff --git a/oelint_parser/cls_stash.py b/oelint_parser/cls_stash.py index c9e53d2..9d261a2 100644 --- a/oelint_parser/cls_stash.py +++ b/oelint_parser/cls_stash.py @@ -3,7 +3,7 @@ import hashlib import os from collections import UserList -from typing import Iterable, List, Union +from typing import Iterable, List, Set, Union from urllib.parse import urlparse import regex @@ -887,3 +887,41 @@ def IsPackageGroup(self, _file: str) -> bool: _inherits = self.GetItemsFor( filename=_file, classifier=Inherit.CLASSIFIER) return any(x for x in _inherits if "packagegroup" in x.get_items()) + + @functools.cache # noqa: B019 + def GetPackagesDynamic(self, _file: str) -> Set[str]: + """returns set of dynamic package patterns defined for _file + + Args: + _file {str} -- Full path to file + + Returns: + Set[str] -- set of dynamic package patterns + """ + packages_dynamic = set() + items = self.GetItemsFor(filename=_file, + classifier=Variable.CLASSIFIER, + attribute=Variable.ATTR_VAR, + attributeValue="PACKAGES_DYNAMIC") + for i in items: + packages_dynamic.update(self.SafeLineSplit(self.ExpandTerm(_file, i.VarValueStripped))) + + return packages_dynamic + + @functools.cache # noqa: B019 + def IsDynamicPackage(self, _file: str, name: str) -> bool: + """returns if the name is likely a dynamic package or not + + Args: + _file {str} -- Full path to file + name {str} -- Name to check + + Returns: + bool -- True if name is a dynamic package + """ + expanded = self.ExpandTerm(_file, name) + for pattern in self.GetPackagesDynamic(_file): + if RegexRpl.match(pattern, expanded): + return True + + return False diff --git a/tests/test_packages_dynamic.py b/tests/test_packages_dynamic.py new file mode 100644 index 0000000..187ccd6 --- /dev/null +++ b/tests/test_packages_dynamic.py @@ -0,0 +1,25 @@ +import pytest # noqa: I900 + +from .utils import TestBaseClass + +class TestOelintPackagesDynamic(TestBaseClass): + def test_packages_dynamic(self): + from oelint_parser.cls_stash import Stash + from oelint_parser.cls_item import Item + + self.__stash = Stash() + recipe_path = self.create_tempfile( + "myrecipe_3.1.bb", + ''' + PACKAGES_DYNAMIC = "^${PN}-lib.* ^foo-" + RDEPENDS:${PN}-libfoo += "baz" + RSUGGESTS:myrecipe-libbar += "baz" + FILES:foo-bar += "baz" + ''') + self.__stash.AddFile(recipe_path) + self.__stash.Finalize() + + assert self.__stash.IsDynamicPackage(recipe_path, "${PN}-libfoo") + assert self.__stash.IsDynamicPackage(recipe_path, "myrecipe-libfoo") + assert self.__stash.IsDynamicPackage(recipe_path, "foo-bar") + assert not self.__stash.IsDynamicPackage(recipe_path, "myrecipe") From 6cc2dce1cc20db77f37845514e1bd6295852c7d4 Mon Sep 17 00:00:00 2001 From: Michal Sieron Date: Mon, 30 Mar 2026 17:01:51 +0200 Subject: [PATCH 2/2] docs: Add entries related to PACKAGES_DYNAMIC Signed-off-by: Michal Sieron --- docs/api-documentation.md | 3141 +++++++++++++++++++------------------ 1 file changed, 1592 insertions(+), 1549 deletions(-) diff --git a/docs/api-documentation.md b/docs/api-documentation.md index ea1c5f1..5699c6e 100644 --- a/docs/api-documentation.md +++ b/docs/api-documentation.md @@ -1,43 +1,6 @@ # Table of Contents * [oelint\_parser](#oelint_parser) -* [oelint\_parser.parser](#oelint_parser.parser) - * [get\_full\_scope](#oelint_parser.parser.get_full_scope) - * [prepare\_lines\_subparser](#oelint_parser.parser.prepare_lines_subparser) - * [prepare\_lines](#oelint_parser.parser.prepare_lines) - * [get\_items](#oelint_parser.parser.get_items) -* [oelint\_parser.inlinerep](#oelint_parser.inlinerep) - * [bb\_utils\_filter](#oelint_parser.inlinerep.bb_utils_filter) - * [bb\_utils\_contains](#oelint_parser.inlinerep.bb_utils_contains) - * [bb\_utils\_contains\_any](#oelint_parser.inlinerep.bb_utils_contains_any) - * [oe\_utils\_conditional](#oelint_parser.inlinerep.oe_utils_conditional) - * [oe\_utils\_ifelse](#oelint_parser.inlinerep.oe_utils_ifelse) - * [oe\_utils\_any\_distro\_features](#oelint_parser.inlinerep.oe_utils_any_distro_features) - * [oe\_utils\_all\_distro\_features](#oelint_parser.inlinerep.oe_utils_all_distro_features) - * [oe\_utils\_vartrue](#oelint_parser.inlinerep.oe_utils_vartrue) - * [oe\_utils\_less\_or\_equal](#oelint_parser.inlinerep.oe_utils_less_or_equal) - * [oe\_utils\_version\_less\_or\_equal](#oelint_parser.inlinerep.oe_utils_version_less_or_equal) - * [oe\_utils\_both\_contain](#oelint_parser.inlinerep.oe_utils_both_contain) - * [d\_getvar](#oelint_parser.inlinerep.d_getvar) - * [inlinerep](#oelint_parser.inlinerep.inlinerep) -* [oelint\_parser.constants](#oelint_parser.constants) - * [Constants](#oelint_parser.constants.Constants) - * [\_\_init\_\_](#oelint_parser.constants.Constants.__init__) - * [GetByPath](#oelint_parser.constants.Constants.GetByPath) - * [AddConstants](#oelint_parser.constants.Constants.AddConstants) - * [RemoveConstants](#oelint_parser.constants.Constants.RemoveConstants) - * [OverrideConstants](#oelint_parser.constants.Constants.OverrideConstants) - * [FunctionsKnown](#oelint_parser.constants.Constants.FunctionsKnown) - * [FunctionsOrder](#oelint_parser.constants.Constants.FunctionsOrder) - * [MirrorsKnown](#oelint_parser.constants.Constants.MirrorsKnown) - * [VariablesKnown](#oelint_parser.constants.Constants.VariablesKnown) - * [DistrosKnown](#oelint_parser.constants.Constants.DistrosKnown) - * [MachinesKnown](#oelint_parser.constants.Constants.MachinesKnown) - * [ImagesClasses](#oelint_parser.constants.Constants.ImagesClasses) - * [ImagesVariables](#oelint_parser.constants.Constants.ImagesVariables) - * [SetsBase](#oelint_parser.constants.Constants.SetsBase) - * [ClassIgnore](#oelint_parser.constants.Constants.ClassIgnore) - * [IncludeIgnore](#oelint_parser.constants.Constants.IncludeIgnore) * [oelint\_parser.cls\_stash](#oelint_parser.cls_stash) * [Stash](#oelint_parser.cls_stash.Stash) * [StashList](#oelint_parser.cls_stash.Stash.StashList) @@ -69,6 +32,22 @@ * [GetValidNamedResources](#oelint_parser.cls_stash.Stash.GetValidNamedResources) * [IsImage](#oelint_parser.cls_stash.Stash.IsImage) * [IsPackageGroup](#oelint_parser.cls_stash.Stash.IsPackageGroup) + * [GetPackagesDynamic](#oelint_parser.cls_stash.Stash.GetPackagesDynamic) + * [IsDynamicPackage](#oelint_parser.cls_stash.Stash.IsDynamicPackage) +* [oelint\_parser.inlinerep](#oelint_parser.inlinerep) + * [bb\_utils\_filter](#oelint_parser.inlinerep.bb_utils_filter) + * [bb\_utils\_contains](#oelint_parser.inlinerep.bb_utils_contains) + * [bb\_utils\_contains\_any](#oelint_parser.inlinerep.bb_utils_contains_any) + * [oe\_utils\_conditional](#oelint_parser.inlinerep.oe_utils_conditional) + * [oe\_utils\_ifelse](#oelint_parser.inlinerep.oe_utils_ifelse) + * [oe\_utils\_any\_distro\_features](#oelint_parser.inlinerep.oe_utils_any_distro_features) + * [oe\_utils\_all\_distro\_features](#oelint_parser.inlinerep.oe_utils_all_distro_features) + * [oe\_utils\_vartrue](#oelint_parser.inlinerep.oe_utils_vartrue) + * [oe\_utils\_less\_or\_equal](#oelint_parser.inlinerep.oe_utils_less_or_equal) + * [oe\_utils\_version\_less\_or\_equal](#oelint_parser.inlinerep.oe_utils_version_less_or_equal) + * [oe\_utils\_both\_contain](#oelint_parser.inlinerep.oe_utils_both_contain) + * [d\_getvar](#oelint_parser.inlinerep.d_getvar) + * [inlinerep](#oelint_parser.inlinerep.inlinerep) * [oelint\_parser.cls\_item](#oelint_parser.cls_item) * [\_\_id\_regex\_\_](#oelint_parser.cls_item.__id_regex__) * [Item](#oelint_parser.cls_item.Item) @@ -201,6 +180,29 @@ * [match](#oelint_parser.rpl_regex.RegexRpl.match) * [sub](#oelint_parser.rpl_regex.RegexRpl.sub) * [finditer](#oelint_parser.rpl_regex.RegexRpl.finditer) +* [oelint\_parser.parser](#oelint_parser.parser) + * [get\_full\_scope](#oelint_parser.parser.get_full_scope) + * [prepare\_lines\_subparser](#oelint_parser.parser.prepare_lines_subparser) + * [prepare\_lines](#oelint_parser.parser.prepare_lines) + * [get\_items](#oelint_parser.parser.get_items) +* [oelint\_parser.constants](#oelint_parser.constants) + * [Constants](#oelint_parser.constants.Constants) + * [\_\_init\_\_](#oelint_parser.constants.Constants.__init__) + * [GetByPath](#oelint_parser.constants.Constants.GetByPath) + * [AddConstants](#oelint_parser.constants.Constants.AddConstants) + * [RemoveConstants](#oelint_parser.constants.Constants.RemoveConstants) + * [OverrideConstants](#oelint_parser.constants.Constants.OverrideConstants) + * [FunctionsKnown](#oelint_parser.constants.Constants.FunctionsKnown) + * [FunctionsOrder](#oelint_parser.constants.Constants.FunctionsOrder) + * [MirrorsKnown](#oelint_parser.constants.Constants.MirrorsKnown) + * [VariablesKnown](#oelint_parser.constants.Constants.VariablesKnown) + * [DistrosKnown](#oelint_parser.constants.Constants.DistrosKnown) + * [MachinesKnown](#oelint_parser.constants.Constants.MachinesKnown) + * [ImagesClasses](#oelint_parser.constants.Constants.ImagesClasses) + * [ImagesVariables](#oelint_parser.constants.Constants.ImagesVariables) + * [SetsBase](#oelint_parser.constants.Constants.SetsBase) + * [ClassIgnore](#oelint_parser.constants.Constants.ClassIgnore) + * [IncludeIgnore](#oelint_parser.constants.Constants.IncludeIgnore) @@ -208,2310 +210,2286 @@ oelint_parser is a library to parse bitbake files. - + -# oelint\_parser.parser +# oelint\_parser.cls\_stash - + -#### get\_full\_scope +## Stash Objects ```python -def get_full_scope(_string: str, offset: int, _sstart: int, _send: int) -> str +class Stash() ``` -get full block of an inline statement +The Stash object is the central storage for extracting the bitbake information. -**Arguments**: + -- `_string` _str_ - input string -- `offset` _int_ - offset in string -- `_sstart` _int_ - block start index -- `_send` _int_ - block end index - +## StashList Objects -**Returns**: +```python +class StashList(UserList) +``` -- `str` - full block on inline statement +Extended list of Items. - + -#### prepare\_lines\_subparser +#### \_\_init\_\_ ```python -def prepare_lines_subparser(_iter: Iterable, - lineOffset: int, - num: int, - line: int, - raw_line: str = None, - negative: bool = False) -> tuple[dict, str, int] +def __init__(stash: 'Stash', items: Iterable[Item]) -> None ``` -preprocess raw input +StashList - Extended list of Items. **Arguments**: -- `_iter` _iterator_ - line interator object -- `lineOffset` _int_ - current line index -- `num` _int_ - internal line counter -- `line` _int_ - input string -- `raw_line` _string, optional_ - internal line representation. Defaults to None. -- `negative` _bool_ - Negative branch inline expansion. Defaults to False - - -**Returns**: - - tuple[dict, str, int]: preproccessed chunk, buffer for next iteration, number of lines +- `stash` _Stash_ - Parent stash object +- `items` _Iterable_ - Iterable input - + -#### prepare\_lines +#### insert ```python -def prepare_lines(_file: str, - lineOffset: int = 0, - negative: bool = False) -> List[str] +def insert(index: int, item: Item) -> None ``` -break raw file input into preprocessed chunks +Insert into list **Arguments**: -- `_file` _string_ - Full path to file -- `lineOffset` _int, optional_ - line offset counter. Defaults to 0. -- `negative` _bool_ - Negative branch inline expansion. Defaults to False - - -**Returns**: - -- `list` - preprocessed list of chunks +- `index` _int_ - index where to insert +- `item` _Item_ - object to insert - + -#### get\_items +#### append ```python -def get_items(stash: object, - _file: str, - lineOffset: int = 0, - new_style_override_syntax: bool = False, - negative: bool = False) -> List[Item] +def append(item: Union[Item, Iterable[Item]]) -> None ``` -parses file +Append to list **Arguments**: -- `stash` _oelint_parser.cls_stash.Stash_ - Stash object -- `_file` _string_ - Full path to file -- `lineOffset` _int, optional_ - line offset counter. Defaults to 0. -- `new_style_override_syntax` _bool, optional_ - default to new override syntax (default: False) -- `negative` _bool, optional_ - Negative branch inline expansion (default: False) - +- `item` _Union[Item, Iterable[Item]]_ - Item or Iterable of Items -**Returns**: + -- `list` - List of oelint_parser.cls_item.* representations +#### extend - +```python +def extend(other: 'Stash.StashList') -> None +``` -# oelint\_parser.inlinerep +Extend list - +**Arguments**: -#### bb\_utils\_filter +- `other` _Stash.StashList_ - Other stash other + + + +#### remove ```python -def bb_utils_filter(_in: str, negative_clause: bool = False) -> str +def remove(item: Union[Item, Iterable[Item]]) -> None ``` -bb.utils.filter emulation +Remove from list **Arguments**: -- `_in` _str_ - Input string -- `negative_clause` _bool_ - return negative branch - - -**Returns**: - -- `str` - True argument of the conditional or None if not applicable +- `item` _Item_ - Item(s) to remove - + -#### bb\_utils\_contains +#### reduce ```python -def bb_utils_contains(_in: str, negative_clause: bool = False) -> str +def reduce(filename: str = None, + classifier: Union[Iterable[str], str] = None, + attribute: Union[Iterable[str], str] = None, + attributeValue: Union[Iterable[str], str] = None, + nolink: bool = False) -> 'Stash.StashList' ``` -bb.utils.contains emulation +Filters the list. + +NOTE: This is a destructive operation. +If you want to have a copy returned use + +Stash.Reduce(,...) instead. **Arguments**: -- `_in` _str_ - Input string -- `negative_clause` _bool_ - return negative branch +- `filename` _str, optional_ - Full path to file. Defaults to None. +- `classifier` _Union[Iterable[str], str], optional_ - (iterable of) class specifier (e.g. Variable). Defaults to None. +- `attribute` _Union[Iterable[str], str], optional_ - (iterable of) class attribute name. Defaults to None. +- `attributeValue` _Union[Iterable[str], str], optional_ - (iterable of) value of the class attribute value. Defaults to None. +- `nolink` _bool, optional_ - Consider linked files. Defaults to False. **Returns**: -- `str` - True argument of the conditional or None if not applicable +- `Stash.StashList` - self - + -#### bb\_utils\_contains\_any +#### \_\_init\_\_ ```python -def bb_utils_contains_any(_in: str, negative_clause: bool = False) -> str +def __init__(quiet: bool = False, + new_style_override_syntax: bool = False, + negative_inline: bool = False) -> None ``` -bb.utils.contains_any emulation +Stash object **Arguments**: -- `_in` _str_ - Input string -- `negative_clause` _bool_ - return negative branch - - -**Returns**: - -- `str` - True argument of the conditional or None if not applicable +- `quiet` _bool, optional_ - No progress printing. Defaults to False. +- `new_style_override_syntax` _bool, optional_ - Enforce new override syntax. Defaults to False. +- `negative_inline` _bool, optional_ - Negative branch inline expansion. Defaults to False. - + -#### oe\_utils\_conditional +#### AddFile ```python -def oe_utils_conditional(_in: str, negative_clause: bool = False) -> str +def AddFile(_file: str, + lineOffset: int = 0, + forcedLink: str = None) -> List[Item] ``` -oe.utils.conditional emulation +Adds a file to the stash **Arguments**: -- `_in` _str_ - Input string -- `negative_clause` _bool_ - return negative branch +- `_file` _str_ - Full path to file -**Returns**: +**Arguments**: -- `str` - True argument of the conditional or None if not applicable +- `lineOffset` _int_ - Line offset from the file that include this file (default: {0}) +- `forcedLink` _type_ - Force link against a file (default: {None}) + - +**Returns**: -#### oe\_utils\_ifelse +- `list` - List of {oelint_parser.cls_item.Item} -```python -def oe_utils_ifelse(_in: str, negative_clause: bool = False) -> str -``` + -oe.utils.ifelse emulation +#### FingerPrint -**Arguments**: +```python +@property +def FingerPrint() -> str +``` -- `_in` _str_ - Input string -- `negative_clause` _bool_ - return negative branch - +Get the SHA1 fingerprint of the current Stash **Returns**: -- `str` - True argument of the conditional or None if not applicable +- `str` - hexdigest checksum - + -#### oe\_utils\_any\_distro\_features +#### Append ```python -def oe_utils_any_distro_features(_in: str, - negative_clause: bool = False) -> str +def Append(item: Union[Item, Iterable[Item]]) -> None ``` -oe.utils.any_distro_features emulation +appends one or mote items to the stash **Arguments**: -- `_in` _str_ - Input string -- `negative_clause` _bool_ - return negative branch - - -**Returns**: - -- `str` - True argument of the conditional or None if not applicable +- `item` _Item_ - Item(s) to append - + -#### oe\_utils\_all\_distro\_features +#### Remove ```python -def oe_utils_all_distro_features(_in: str, - negative_clause: bool = False) -> str +def Remove(item: Union[Item, Iterable[Item]]) -> None ``` -oe.utils.all_distro_features emulation +removes one or more items from the stash **Arguments**: -- `_in` _str_ - Input string -- `negative_clause` _bool_ - return negative branch - - -**Returns**: - -- `str` - True argument of the conditional or None if not applicable +- `item` _Item_ - Item(s) to remove - + -#### oe\_utils\_vartrue +#### AddDistroMachineFromLayer ```python -def oe_utils_vartrue(_in: str, negative_clause: bool = False) -> str +def AddDistroMachineFromLayer(path: str) -> None ``` -oe.utils.vartrue emulation +adds machine and distro configuration from the layer of the provided file **Arguments**: -- `_in` _str_ - Input string -- `negative_clause` _bool_ - return negative branch - +- `path` _str_ - Path to file -**Returns**: + -- `str` - True argument of the conditional or None if not applicable +#### Finalize - +```python +def Finalize() -> None +``` -#### oe\_utils\_less\_or\_equal +finalize the dependencies within the stash + + + +#### GetRecipes ```python -def oe_utils_less_or_equal(_in: str, negative_clause: bool = False) -> str +@functools.cache +def GetRecipes() -> None ``` -oe.utils.less_or_equal emulation +Get bb files in stash -**Arguments**: +**Returns**: -- `_in` _str_ - Input string -- `negative_clause` _bool_ - return negative branch - +- `list` - List of bb files in stash + + + +#### GetLoneAppends + +```python +@functools.cache +def GetLoneAppends() -> List[str] +``` + +Get bbappend without a matching bb **Returns**: -- `str` - True argument of the conditional or None if not applicable +- `list` - list of bbappend without a matching bb - + -#### oe\_utils\_version\_less\_or\_equal +#### GetConfFiles ```python -def oe_utils_version_less_or_equal(_in: str, - negative_clause: bool = False) -> str +@functools.cache +def GetConfFiles() -> List[str] ``` -oe.utils.version_less_or_equal emulation +Get configurations files -**Arguments**: +**Returns**: -- `_in` _str_ - Input string -- `negative_clause` _bool_ - return negative branch - +- `List[str]` - List of configuration files + + + +#### GetBBClasses + +```python +@functools.cache +def GetBBClasses() -> List[str] +``` + +Get bbclass files **Returns**: -- `str` - True argument of the conditional or None if not applicable +- `List[str]` - List of bbclass files - + -#### oe\_utils\_both\_contain +#### GetLinksForFile ```python -def oe_utils_both_contain(_in: str, negative_clause: bool = False) -> str +@functools.cache +def GetLinksForFile(filename: str) -> List[str] ``` -oe.utils.both_contain emulation +Get file which this file is linked against **Arguments**: -- `_in` _str_ - Input string -- `negative_clause` _bool_ - return negative branch +- `filename` _str_ - full path to file **Returns**: -- `str` - True argument of the conditional or None if not applicable +- `list` - list of full paths the file is linked against - + -#### d\_getvar +#### Reduce ```python -def d_getvar(_in: str) -> str +def Reduce(in_list: Iterable[Item], + filename: str = None, + classifier: Union[Iterable[str], str] = None, + attribute: Union[Iterable[str], str] = None, + attributeValue: Union[Iterable[str], str] = None, + nolink: bool = False) -> List[Item] ``` -d.getVar emulation in inline block +Reduce a list by filtering **Arguments**: -- `_in` _str_ - Input string +- `in_list` _Stash.StashList_ - Input list. +- `filename` _str, optional_ - Full path to file. Defaults to None. +- `classifier` _Union[Iterable[str], str], optional_ - (iterable of) class specifier (e.g. Variable). Defaults to None. +- `attribute` _Union[Iterable[str], str], optional_ - (iterable of) class attribute name. Defaults to None. +- `attributeValue` _Union[Iterable[str], str], optional_ - (iterable of) value of the class attribute value. Defaults to None. +- `nolink` _bool, optional_ - Consider linked files. Defaults to False. **Returns**: -- `str` - Variable reference if found +- `List[Item]` - Returns a list of items fitting the set filters - + -#### inlinerep +#### GetItemsFor ```python -def inlinerep(_in: str, negative_clause: bool = False) -> str +def GetItemsFor(filename: str = None, + classifier: Union[Iterable[str], str] = None, + attribute: Union[Iterable[str], str] = None, + attributeValue: Union[Iterable[str], str] = None, + nolink: bool = False) -> 'Stash.StashList' ``` -Replaces inline code expressions +Get items for filename **Arguments**: -- `_in` _str_ - Input string -- `negative_clause` _bool_ - return negative branch +- `filename` _str, optional_ - Full path to file. Defaults to None. +- `classifier` _Union[Iterable[str], str], optional_ - (iterable of) class specifier (e.g. Variable). Defaults to None. +- `attribute` _Union[Iterable[str], str], optional_ - (iterable of) class attribute name. Defaults to None. +- `attributeValue` _Union[Iterable[str], str], optional_ - (iterable of) value of the class attribute value. Defaults to None. +- `nolink` _bool, optional_ - Consider linked files. Defaults to False. **Returns**: -- `str` - Expanded string or None, if not applicable - - - -# oelint\_parser.constants +- `Stash.StashList` - Returns a list of items fitting the set filters - + -## Constants Objects +#### ExpandVar ```python -class Constants() +def ExpandVar(filename: str = None, + attribute: Union[Iterable[str], str] = None, + attributeValue: Union[Iterable[str], str] = None, + nolink: bool = False) -> dict ``` -Interface for constants - - - -#### \_\_init\_\_ +Expand variable to dictionary -```python -def __init__(file_: str = DEFAULT_DB) -> None -``` +**Arguments**: -Constants interface +- `filename` _str_ - Full path to file (default: {None}) +- `attribute` _str_ - class attribute name (default: {None}) +- `attributeValue` _str_ - value of the class attribute name (default: {None}) +- `nolink` _bool_ - Consider linked files (default: {False}) + -**Arguments**: +**Returns**: -- `file_` _str, optional_ - File to load. Defaults to DEFAULT_DB. +- `{dict}` - expanded variables from call + base set of variables - + -#### GetByPath +#### GetFiles ```python -def GetByPath(path: str) -> Union[Dict, List] +@functools.cache +def GetFiles(_file: str, pattern: str) -> List[str] ``` -Get constant from path +Get files matching SRC_URI entries **Arguments**: -- `path` _str_ - / joined path in the constant structure +- `_file` _str_ - Full path to filename +- `pattern` _str_ - glob pattern to apply **Returns**: - Union[Dict, List]: Item in structure or empty dictionary +- `list` - list of files matching pattern - + -#### AddConstants +#### GetLayerRoot ```python -def AddConstants(_dict: dict) -> None +@functools.cache +def GetLayerRoot(name: str) -> str ``` -Add constants to the existing +Find the path to the layer root of a file **Arguments**: -- `dict` _dict_ - constant dictionary to add +- `name` _str_ - filename + - +**Returns**: -#### RemoveConstants +- `str` - path to layer root or empty string + + + +#### FindLocalOrLayer ```python -def RemoveConstants(_dict: dict) -> None +@functools.cache +def FindLocalOrLayer(name: str, localdir: str) -> str ``` -Remove constants from the existing +Find file in local dir or in layer **Arguments**: -- `dict` _dict_ - constant dictionary to remove +- `name` _str_ - filename +- `localdir` _str_ - path to local dir + - +**Returns**: -#### OverrideConstants +- `str` - path to found file or None + + + +#### GetScrComponents ```python -def OverrideConstants(_dict: dict) -> None +@functools.cache +def GetScrComponents(string: str) -> dict ``` -Override constants in the existing db +Return SRC_URI components **Arguments**: -- `dict` _dict]_ - constant dictionary with override values +- `string` _str_ - raw string + - +**Returns**: -#### FunctionsKnown +- `dict` - scheme: protocol used, src: source URI, options: parsed options + + + +#### SafeLineSplit ```python -@property -def FunctionsKnown() -> List[str] +@functools.cache +def SafeLineSplit(string: str) -> List[str] ``` -Return known functions +Split line in a safe manner + +**Arguments**: + +- `string` _str_ - raw input + **Returns**: -- `list` - list of known functions +- `list` - safely split input - + -#### FunctionsOrder +#### GuessRecipeName ```python -@property -def FunctionsOrder() -> List[str] +@functools.cache +def GuessRecipeName(_file: str) -> str ``` -Return function order +Get the recipe name from filename + +**Arguments**: + +- `_file` _str_ - filename + **Returns**: -- `list` - List of functions to order in their designated order +- `str` - recipe name - + -#### MirrorsKnown +#### GuessBaseRecipeName ```python -@property -def MirrorsKnown() -> Dict[str, str] +@functools.cache +def GuessBaseRecipeName(_file: str) -> str ``` -Return known mirrors and their replacements +Get the base recipe name from filename (aka BPN) + +**Arguments**: + +- `_file` _str_ - filename + **Returns**: -- `dict` - Dict of known mirrors and their replacements +- `str` - recipe name - + -#### VariablesKnown +#### GuessRecipeVersion ```python -@property -def VariablesKnown() -> List[str] +@functools.cache +def GuessRecipeVersion(_file: str) -> str | None ``` -Known variables +Get recipe version from filename + +**Arguments**: + +- `_file` _str_ - filename + **Returns**: -- `list` - List of known variables +- `str` - recipe version - + -#### DistrosKnown +#### ExpandTerm ```python -@property -def DistrosKnown() -> List[str] +def ExpandTerm(_file: str, + value: str, + spare: List[str] = None, + seen: List[str] = None, + objref: Variable = None) -> str ``` -Known distros +Expand a variable (replacing all variables by known content) + +**Arguments**: + +- `_file` _str_ - Full path to file +- `value` _str_ - Variable value to expand +- `spare` _list[str]_ - items to keep unexpanded (default: None) +- `seen` _list[str]_ - seen items (default: None) +- `objref` _Variable_ - reference to the calling variable instance (default: None) + **Returns**: -- `list` - List of known distros +- `str` - expanded value - + -#### MachinesKnown +#### GetValidPackageNames ```python -@property -def MachinesKnown() -> List[str] +@functools.cache +def GetValidPackageNames(_file: str, strippn: bool = False) -> List[str] ``` -Known machines +Get known valid names for packages + +**Arguments**: + +- `_file` _str_ - Full path to file +- `strippn` _bool_ - strip the package name (default: False) + **Returns**: -- `list` - List of known machines +- `list` - list of valid package names - + -#### ImagesClasses +#### GetValidNamedResources ```python -@property -def ImagesClasses() -> List[str] +@functools.cache +def GetValidNamedResources(_file: str) -> List[str] ``` -Classes that are used in images +Get list of valid SRCREV resource names + +**Arguments**: + +- `_file` _str_ - Full path to file + **Returns**: -- `list` - Classes that are used in images +- `list` - list of valid SRCREV resource names - + -#### ImagesVariables +#### IsImage ```python -@property -def ImagesVariables() -> List[str] +@functools.cache +def IsImage(_file: str) -> bool ``` -Variables that are used in images +returns if the file is likely an image recipe or not + +**Arguments**: + +- `_file` _str_ - Full path to file + **Returns**: -- `list` - Variables that are used in images +- `bool` - True if _file is an image recipe - + -#### SetsBase +#### IsPackageGroup ```python -@property -def SetsBase() -> Dict[str, str] +@functools.cache +def IsPackageGroup(_file: str) -> bool ``` -Base variable set +returns if the file is likely a packagegroup recipe or not + +**Arguments**: + +- `_file` _str_ - Full path to file + **Returns**: -- `dict` - dictionary with base variable set +- `bool` - True if _file is a packagegroup recipe - + -#### ClassIgnore +#### GetPackagesDynamic ```python -@property -def ClassIgnore() -> List[str] +@functools.cache +def GetPackagesDynamic(_file: str) -> Set[str] ``` -_summary_ +returns set of dynamic package patterns defined for _file + +**Arguments**: + +- `_file` _str_ - Full path to file + **Returns**: -- `List[str]` - List of classes to ignore +- `Set[str]` - set of dynamic package patterns - + -#### IncludeIgnore +#### IsDynamicPackage ```python -@property -def IncludeIgnore() -> List[str] +@functools.cache +def IsDynamicPackage(_file: str, name: str) -> bool ``` -Includes to ignore +returns if the name is likely a dynamic package or not + +**Arguments**: + +- `_file` _str_ - Full path to file +- `name` _str_ - Name to check + **Returns**: -- `List[str]` - List of paths to ignore +- `bool` - True if name is a dynamic package - + -# oelint\_parser.cls\_stash +# oelint\_parser.inlinerep - + -## Stash Objects +#### bb\_utils\_filter ```python -class Stash() +def bb_utils_filter(_in: str, negative_clause: bool = False) -> str ``` -The Stash object is the central storage for extracting the bitbake information. +bb.utils.filter emulation - +**Arguments**: -## StashList Objects +- `_in` _str_ - Input string +- `negative_clause` _bool_ - return negative branch + -```python -class StashList(UserList) -``` +**Returns**: -Extended list of Items. +- `str` - True argument of the conditional or None if not applicable - + -#### \_\_init\_\_ +#### bb\_utils\_contains ```python -def __init__(stash: 'Stash', items: Iterable[Item]) -> None +def bb_utils_contains(_in: str, negative_clause: bool = False) -> str ``` -StashList - Extended list of Items. +bb.utils.contains emulation **Arguments**: -- `stash` _Stash_ - Parent stash object -- `items` _Iterable_ - Iterable input +- `_in` _str_ - Input string +- `negative_clause` _bool_ - return negative branch + - +**Returns**: -#### insert +- `str` - True argument of the conditional or None if not applicable + + + +#### bb\_utils\_contains\_any ```python -def insert(index: int, item: Item) -> None +def bb_utils_contains_any(_in: str, negative_clause: bool = False) -> str ``` -Insert into list +bb.utils.contains_any emulation **Arguments**: -- `index` _int_ - index where to insert -- `item` _Item_ - object to insert +- `_in` _str_ - Input string +- `negative_clause` _bool_ - return negative branch + - +**Returns**: -#### append +- `str` - True argument of the conditional or None if not applicable + + + +#### oe\_utils\_conditional ```python -def append(item: Union[Item, Iterable[Item]]) -> None +def oe_utils_conditional(_in: str, negative_clause: bool = False) -> str ``` -Append to list +oe.utils.conditional emulation **Arguments**: -- `item` _Union[Item, Iterable[Item]]_ - Item or Iterable of Items +- `_in` _str_ - Input string +- `negative_clause` _bool_ - return negative branch + - +**Returns**: -#### extend +- `str` - True argument of the conditional or None if not applicable + + + +#### oe\_utils\_ifelse ```python -def extend(other: 'Stash.StashList') -> None +def oe_utils_ifelse(_in: str, negative_clause: bool = False) -> str ``` -Extend list +oe.utils.ifelse emulation **Arguments**: -- `other` _Stash.StashList_ - Other stash other +- `_in` _str_ - Input string +- `negative_clause` _bool_ - return negative branch + - +**Returns**: -#### remove +- `str` - True argument of the conditional or None if not applicable + + + +#### oe\_utils\_any\_distro\_features ```python -def remove(item: Union[Item, Iterable[Item]]) -> None +def oe_utils_any_distro_features(_in: str, + negative_clause: bool = False) -> str ``` -Remove from list +oe.utils.any_distro_features emulation **Arguments**: -- `item` _Item_ - Item(s) to remove +- `_in` _str_ - Input string +- `negative_clause` _bool_ - return negative branch + - +**Returns**: -#### reduce +- `str` - True argument of the conditional or None if not applicable -```python -def reduce(filename: str = None, - classifier: Union[Iterable[str], str] = None, - attribute: Union[Iterable[str], str] = None, - attributeValue: Union[Iterable[str], str] = None, - nolink: bool = False) -> 'Stash.StashList' -``` + -Filters the list. +#### oe\_utils\_all\_distro\_features -NOTE: This is a destructive operation. -If you want to have a copy returned use +```python +def oe_utils_all_distro_features(_in: str, + negative_clause: bool = False) -> str +``` -Stash.Reduce(,...) instead. +oe.utils.all_distro_features emulation **Arguments**: -- `filename` _str, optional_ - Full path to file. Defaults to None. -- `classifier` _Union[Iterable[str], str], optional_ - (iterable of) class specifier (e.g. Variable). Defaults to None. -- `attribute` _Union[Iterable[str], str], optional_ - (iterable of) class attribute name. Defaults to None. -- `attributeValue` _Union[Iterable[str], str], optional_ - (iterable of) value of the class attribute value. Defaults to None. -- `nolink` _bool, optional_ - Consider linked files. Defaults to False. +- `_in` _str_ - Input string +- `negative_clause` _bool_ - return negative branch **Returns**: -- `Stash.StashList` - self +- `str` - True argument of the conditional or None if not applicable - + -#### \_\_init\_\_ +#### oe\_utils\_vartrue ```python -def __init__(quiet: bool = False, - new_style_override_syntax: bool = False, - negative_inline: bool = False) -> None +def oe_utils_vartrue(_in: str, negative_clause: bool = False) -> str ``` -Stash object +oe.utils.vartrue emulation **Arguments**: -- `quiet` _bool, optional_ - No progress printing. Defaults to False. -- `new_style_override_syntax` _bool, optional_ - Enforce new override syntax. Defaults to False. -- `negative_inline` _bool, optional_ - Negative branch inline expansion. Defaults to False. +- `_in` _str_ - Input string +- `negative_clause` _bool_ - return negative branch + - +**Returns**: -#### AddFile +- `str` - True argument of the conditional or None if not applicable + + + +#### oe\_utils\_less\_or\_equal ```python -def AddFile(_file: str, - lineOffset: int = 0, - forcedLink: str = None) -> List[Item] +def oe_utils_less_or_equal(_in: str, negative_clause: bool = False) -> str ``` -Adds a file to the stash +oe.utils.less_or_equal emulation **Arguments**: -- `_file` _str_ - Full path to file +- `_in` _str_ - Input string +- `negative_clause` _bool_ - return negative branch +**Returns**: + +- `str` - True argument of the conditional or None if not applicable + + + +#### oe\_utils\_version\_less\_or\_equal + +```python +def oe_utils_version_less_or_equal(_in: str, + negative_clause: bool = False) -> str +``` + +oe.utils.version_less_or_equal emulation + **Arguments**: -- `lineOffset` _int_ - Line offset from the file that include this file (default: {0}) -- `forcedLink` _type_ - Force link against a file (default: {None}) +- `_in` _str_ - Input string +- `negative_clause` _bool_ - return negative branch **Returns**: -- `list` - List of {oelint_parser.cls_item.Item} +- `str` - True argument of the conditional or None if not applicable - + -#### FingerPrint +#### oe\_utils\_both\_contain ```python -@property -def FingerPrint() -> str +def oe_utils_both_contain(_in: str, negative_clause: bool = False) -> str ``` -Get the SHA1 fingerprint of the current Stash +oe.utils.both_contain emulation + +**Arguments**: + +- `_in` _str_ - Input string +- `negative_clause` _bool_ - return negative branch + **Returns**: -- `str` - hexdigest checksum +- `str` - True argument of the conditional or None if not applicable - + -#### Append +#### d\_getvar ```python -def Append(item: Union[Item, Iterable[Item]]) -> None +def d_getvar(_in: str) -> str ``` -appends one or mote items to the stash +d.getVar emulation in inline block **Arguments**: -- `item` _Item_ - Item(s) to append +- `_in` _str_ - Input string + - +**Returns**: -#### Remove +- `str` - Variable reference if found + + + +#### inlinerep ```python -def Remove(item: Union[Item, Iterable[Item]]) -> None +def inlinerep(_in: str, negative_clause: bool = False) -> str ``` -removes one or more items from the stash +Replaces inline code expressions **Arguments**: -- `item` _Item_ - Item(s) to remove +- `_in` _str_ - Input string +- `negative_clause` _bool_ - return negative branch + - +**Returns**: -#### AddDistroMachineFromLayer +- `str` - Expanded string or None, if not applicable -```python -def AddDistroMachineFromLayer(path: str) -> None -``` + -adds machine and distro configuration from the layer of the provided file +# oelint\_parser.cls\_item -**Arguments**: + -- `path` _str_ - Path to file +#### \_\_id\_regex\_\_ - +noqa: P103 -#### Finalize + + +## Item Objects ```python -def Finalize() -> None +class Item() ``` -finalize the dependencies within the stash +Base class for all Stash items - + -#### GetRecipes +#### \_\_init\_\_ ```python -@functools.cache -def GetRecipes() -> None +def __init__(origin: str, + line: int, + infileline: int, + rawtext: str, + realraw: str, + inline_blocks: List[Tuple[str, str]], + new_style_override_syntax: bool = False) -> None ``` -Get bb files in stash +constructor -**Returns**: +**Arguments**: -- `list` - List of bb files in stash +- `origin` _str_ - Full path of origin file +- `line` _int_ - Overall line counter +- `infileline` _int_ - Line number in file +- `rawtext` _str_ - Raw input string (except inline code blocks) +- `realraw` _str_ - Unprocessed input - +**Arguments**: -#### GetLoneAppends +- `new_style_override_syntax` _bool_ - Use ':' a override delimiter (default: {False}) + + + +#### Line ```python -@functools.cache -def GetLoneAppends() -> List[str] +@property +def Line() -> int ``` -Get bbappend without a matching bb +Overall line count **Returns**: -- `list` - list of bbappend without a matching bb +- `int` - overall line count of item - + -#### GetConfFiles +#### Raw ```python -@functools.cache -def GetConfFiles() -> List[str] +@property +def Raw() -> str ``` -Get configurations files +Raw string (without inline code blocks) **Returns**: -- `List[str]` - List of configuration files +- `str` - raw string of item - + -#### GetBBClasses +#### Origin ```python -@functools.cache -def GetBBClasses() -> List[str] +@property +def Origin() -> str ``` -Get bbclass files +origin of item **Returns**: -- `List[str]` - List of bbclass files +- `str` - full path of origin file - + -#### GetLinksForFile +#### InFileLine ```python -@functools.cache -def GetLinksForFile(filename: str) -> List[str] +@property +def InFileLine() -> int ``` -Get file which this file is linked against - -**Arguments**: - -- `filename` _str_ - full path to file - +Line count in file **Returns**: -- `list` - list of full paths the file is linked against +- `int` - [description] - + -#### Reduce +#### RealRaw ```python -def Reduce(in_list: Iterable[Item], - filename: str = None, - classifier: Union[Iterable[str], str] = None, - attribute: Union[Iterable[str], str] = None, - attributeValue: Union[Iterable[str], str] = None, - nolink: bool = False) -> List[Item] +@property +def RealRaw() -> str ``` -Reduce a list by filtering - -**Arguments**: - -- `in_list` _Stash.StashList_ - Input list. -- `filename` _str, optional_ - Full path to file. Defaults to None. -- `classifier` _Union[Iterable[str], str], optional_ - (iterable of) class specifier (e.g. Variable). Defaults to None. -- `attribute` _Union[Iterable[str], str], optional_ - (iterable of) class attribute name. Defaults to None. -- `attributeValue` _Union[Iterable[str], str], optional_ - (iterable of) value of the class attribute value. Defaults to None. -- `nolink` _bool, optional_ - Consider linked files. Defaults to False. - +Completely unprocessed raw text **Returns**: -- `List[Item]` - Returns a list of items fitting the set filters +- `str` - completely unprocessed raw text - + -#### GetItemsFor +#### IsFromClass ```python -def GetItemsFor(filename: str = None, - classifier: Union[Iterable[str], str] = None, - attribute: Union[Iterable[str], str] = None, - attributeValue: Union[Iterable[str], str] = None, - nolink: bool = False) -> 'Stash.StashList' +@property +def IsFromClass() -> bool ``` -Get items for filename - -**Arguments**: - -- `filename` _str, optional_ - Full path to file. Defaults to None. -- `classifier` _Union[Iterable[str], str], optional_ - (iterable of) class specifier (e.g. Variable). Defaults to None. -- `attribute` _Union[Iterable[str], str], optional_ - (iterable of) class attribute name. Defaults to None. -- `attributeValue` _Union[Iterable[str], str], optional_ - (iterable of) value of the class attribute value. Defaults to None. -- `nolink` _bool, optional_ - Consider linked files. Defaults to False. - +Item comes from a bbclass **Returns**: -- `Stash.StashList` - Returns a list of items fitting the set filters +- `bool` - if item was set in a bbclass - + -#### ExpandVar +#### OverrideDelimiter ```python -def ExpandVar(filename: str = None, - attribute: Union[Iterable[str], str] = None, - attributeValue: Union[Iterable[str], str] = None, - nolink: bool = False) -> dict +@property +def OverrideDelimiter() -> str ``` -Expand variable to dictionary - -**Arguments**: - -- `filename` _str_ - Full path to file (default: {None}) -- `attribute` _str_ - class attribute name (default: {None}) -- `attributeValue` _str_ - value of the class attribute name (default: {None}) -- `nolink` _bool_ - Consider linked files (default: {False}) - +Override delimiter **Returns**: -- `{dict}` - expanded variables from call + base set of variables +- `str` - Override delimiter - + -#### GetFiles +#### IsNewStyleOverrideSyntax ```python -@functools.cache -def GetFiles(_file: str, pattern: str) -> List[str] +@property +def IsNewStyleOverrideSyntax() -> bool ``` -Get files matching SRC_URI entries - -**Arguments**: - -- `_file` _str_ - Full path to filename -- `pattern` _str_ - glob pattern to apply - +New style override syntax detected **Returns**: -- `list` - list of files matching pattern +- `bool` - True if new style has been detected - + -#### GetLayerRoot +#### safe\_linesplit ```python -@functools.cache -def GetLayerRoot(name: str) -> str +@staticmethod +def safe_linesplit(string: str) -> List[str] ``` -Find the path to the layer root of a file +Safely split an input line to chunks **Arguments**: -- `name` _str_ - filename +- `string` _str_ - raw input string **Returns**: -- `str` - path to layer root or empty string +- `list` - list of chunks of original string - + -#### FindLocalOrLayer +#### get\_items ```python -@functools.cache -def FindLocalOrLayer(name: str, localdir: str) -> str +def get_items() -> List[str] ``` -Find file in local dir or in layer - -**Arguments**: - -- `name` _str_ - filename -- `localdir` _str_ - path to local dir - +Return single items **Returns**: -- `str` - path to found file or None +- `list` - lines of raw input - + -#### GetScrComponents +#### extract\_sub ```python -@functools.cache -def GetScrComponents(string: str) -> dict +def extract_sub(name: str) -> Tuple[List[str], List[str]] ``` -Return SRC_URI components +Extract modifiers **Arguments**: -- `string` _str_ - raw string +- `name` _str_ - input string **Returns**: -- `dict` - scheme: protocol used, src: source URI, options: parsed options +- `tuple` - clean variable name, modifiers, package specific modifiers - + -#### SafeLineSplit +#### extract\_sub\_func ```python -@functools.cache -def SafeLineSplit(string: str) -> List[str] +def extract_sub_func(name: str) -> Tuple[List[str], List[str]] ``` -Split line in a safe manner +Extract modifiers for functions **Arguments**: -- `string` _str_ - raw input +- `name` _str_ - input value **Returns**: -- `list` - safely split input +- `tuple` - clean function name, modifiers - + -#### GuessRecipeName +#### IsFromAppend ```python -@functools.cache -def GuessRecipeName(_file: str) -> str +def IsFromAppend() -> bool ``` -Get the recipe name from filename - -**Arguments**: - -- `_file` _str_ - filename - +Item originates from a bbappend **Returns**: -- `str` - recipe name +- `bool` - True if coming from a bbappend - + -#### GuessBaseRecipeName +#### GetAttributes ```python -@functools.cache -def GuessBaseRecipeName(_file: str) -> str +def GetAttributes() -> dict ``` -Get the base recipe name from filename (aka BPN) - -**Arguments**: - -- `_file` _str_ - filename - +Get all public attributes of this class **Returns**: -- `str` - recipe name +- `dict` - all public attributes and their values - + -#### GuessRecipeVersion +## Variable Objects ```python -@functools.cache -def GuessRecipeVersion(_file: str) -> str +class Variable(Item) ``` -Get recipe version from filename - -**Arguments**: - -- `_file` _str_ - filename - - -**Returns**: - -- `str` - recipe version +Items representing variables in bitbake. - + -#### ExpandTerm +#### \_\_init\_\_ ```python -def ExpandTerm(_file: str, - value: str, - spare: List[str] = None, - seen: List[str] = None, - objref: Variable = None) -> str +def __init__(name: str, value: str, operator: str, *args, **kwargs) -> None ``` -Expand a variable (replacing all variables by known content) +constructor **Arguments**: -- `_file` _str_ - Full path to file -- `value` _str_ - Variable value to expand -- `spare` _list[str]_ - items to keep unexpanded (default: None) -- `seen` _list[str]_ - seen items (default: None) -- `objref` _Variable_ - reference to the calling variable instance (default: None) - - -**Returns**: - -- `str` - expanded value +- `name` _str_ - Variable name +- `value` _str_ - Variable value +- `operator` _str_ - Operation performed to the variable - + -#### GetValidPackageNames +#### VarName ```python -@functools.cache -def GetValidPackageNames(_file: str, strippn: bool = False) -> List[str] +@property +def VarName() -> str ``` -Get known valid names for packages - -**Arguments**: - -- `_file` _str_ - Full path to file -- `strippn` _bool_ - strip the package name (default: False) - +Variable name **Returns**: -- `list` - list of valid package names +- `str` - name of variable - + -#### GetValidNamedResources +#### SubItem ```python -@functools.cache -def GetValidNamedResources(_file: str) -> List[str] +@property +def SubItem() -> str ``` -Get list of valid SRCREV resource names - -**Arguments**: - -- `_file` _str_ - Full path to file - +Variable modifiers **Returns**: -- `list` - list of valid SRCREV resource names +- `str` - variable modifiers like packages, machines, appends, prepends - + -#### IsImage +#### SubItems ```python -@functools.cache -def IsImage(_file: str) -> bool +@property +def SubItems() -> List[str] ``` -returns if the file is likely an image recipe or not - -**Arguments**: - -- `_file` _str_ - Full path to file - +Variable modifiers list **Returns**: -- `bool` - True if _file is an image recipe +- `list` - variable modifiers list like packages, machines, appends, prepends - + -#### IsPackageGroup +#### VarValue ```python -@functools.cache -def IsPackageGroup(_file: str) -> bool +@property +def VarValue() -> str ``` -returns if the file is likely a packagegroup recipe or not - -**Arguments**: - -- `_file` _str_ - Full path to file - +variable value **Returns**: -- `bool` - True if _file is a packagegroup recipe +- `str` - unstripped variable value - + -# oelint\_parser.cls\_item +#### VarOp - +```python +@property +def VarOp() -> str +``` -#### \_\_id\_regex\_\_ +Variable operation -noqa: P103 +**Returns**: - +- `str` - operation did on the variable -## Item Objects + + +#### VarNameComplete ```python -class Item() +@property +def VarNameComplete() -> str ``` -Base class for all Stash items +Complete variable name included overrides and flags - +**Returns**: -#### \_\_init\_\_ +- `str` - complete variable name -```python -def __init__(origin: str, - line: int, - infileline: int, - rawtext: str, - realraw: str, - inline_blocks: List[Tuple[str, str]], - new_style_override_syntax: bool = False) -> None -``` + -constructor +#### VarNameCompleteNoModifiers -**Arguments**: +```python +@property +def VarNameCompleteNoModifiers() -> str +``` -- `origin` _str_ - Full path of origin file -- `line` _int_ - Overall line counter -- `infileline` _int_ - Line number in file -- `rawtext` _str_ - Raw input string (except inline code blocks) -- `realraw` _str_ - Unprocessed input +Complete variable name included overrides but without modifiers like append, prepend and remove -**Arguments**: +**Returns**: -- `new_style_override_syntax` _bool_ - Use ':' a override delimiter (default: {False}) +- `str` - complete variable name - + -#### Line +#### RawVarName ```python @property -def Line() -> int +def RawVarName() -> str ``` -Overall line count +Variable name and flags combined **Returns**: -- `int` - overall line count of item +- `str` - raw representation of the variable name - + -#### Raw +#### VarValueStripped ```python @property -def Raw() -> str +def VarValueStripped() -> str ``` -Raw string (without inline code blocks) +Stripped variable value **Returns**: -- `str` - raw string of item +- `str` - stripped version of variable value - + -#### Origin +#### IsAppend ```python -@property -def Origin() -> str +def IsAppend() -> bool ``` -origin of item +Check if operation is an append **Returns**: -- `str` - full path of origin file +- `bool` - True is variable is appended - + -#### InFileLine +#### AppendOperation ```python -@property -def InFileLine() -> int +def AppendOperation() -> List[str] ``` -Line count in file +Get variable modifiers **Returns**: -- `int` - [description] +- `list` - list could contain any combination of 'append', ' += ', 'prepend' and 'remove' - + -#### RealRaw +#### get\_items ```python -@property -def RealRaw() -> str +def get_items(override: str = "", versioned: bool = False) -> List[str] ``` -Completely unprocessed raw text +Get items of variable value + +**Arguments**: + +- `override` _str_ - String to take instead of VarValue +- `versioned` _bool_ - items can be versioned (versions will be stripped in this case) + **Returns**: -- `str` - completely unprocessed raw text +- `list` - clean list of items in variable value - + -#### IsFromClass +#### IsMultiLine ```python -@property -def IsFromClass() -> bool +def IsMultiLine() -> bool ``` -Item comes from a bbclass +Check if variable has a multiline assignment **Returns**: -- `bool` - if item was set in a bbclass +- `bool` - True if multiline - + -#### OverrideDelimiter +#### GetDistroEntry ```python -@property -def OverrideDelimiter() -> str +def GetDistroEntry() -> str ``` -Override delimiter +Get distro specific entries in variable **Returns**: -- `str` - Override delimiter +- `str` - distro specific modifier of variable or "" - + -#### IsNewStyleOverrideSyntax +#### GetMachineEntry ```python -@property -def IsNewStyleOverrideSyntax() -> bool +def GetMachineEntry() -> str ``` -New style override syntax detected +Get machine specific entries in variable **Returns**: -- `bool` - True if new style has been detected +- `str` - machine specific modifier of variable or "" - + -#### safe\_linesplit +#### GetClassOverride ```python -@staticmethod -def safe_linesplit(string: str) -> List[str] +def GetClassOverride() -> str ``` -Safely split an input line to chunks - -**Arguments**: - -- `string` _str_ - raw input string - +Get class specific entries in variable **Returns**: -- `list` - list of chunks of original string +- `str` - class specific modifier of variable or "" - + -#### get\_items +#### IsImmediateModify ```python -def get_items() -> List[str] +def IsImmediateModify() -> bool ``` -Return single items +Variable operation is done immediately **Returns**: -- `list` - lines of raw input +- `bool` - true if it isn't a prepend/append or remove operation - + -#### extract\_sub +## Comment Objects ```python -def extract_sub(name: str) -> Tuple[List[str], List[str]] +class Comment(Item) ``` -Extract modifiers - -**Arguments**: - -- `name` _str_ - input string - - -**Returns**: - -- `tuple` - clean variable name, modifiers, package specific modifiers - - - -#### extract\_sub\_func - -```python -def extract_sub_func(name: str) -> Tuple[List[str], List[str]] -``` - -Extract modifiers for functions - -**Arguments**: - -- `name` _str_ - input value - - -**Returns**: - -- `tuple` - clean function name, modifiers +Items representing comments in bitbake. - + -#### IsFromAppend +#### \_\_init\_\_ ```python -def IsFromAppend() -> bool +def __init__(*args, **kwargs) -> None ``` -Item originates from a bbappend - -**Returns**: - -- `bool` - True if coming from a bbappend +constructor - + -#### GetAttributes +#### get\_items ```python -def GetAttributes() -> dict +def get_items() -> List[str] ``` -Get all public attributes of this class +Get single lines of block **Returns**: -- `dict` - all public attributes and their values +- `list` - single lines of comment block - + -## Variable Objects +## Include Objects ```python -class Variable(Item) +class Include(Item) ``` -Items representing variables in bitbake. +Items that representing include/require statements. - + #### \_\_init\_\_ ```python -def __init__(name: str, value: str, operator: str, *args, **kwargs) -> None +def __init__(incname: str, fileincluded: str, statement: str, *args, + **kwargs) -> None ``` constructor **Arguments**: -- `name` _str_ - Variable name -- `value` _str_ - Variable value -- `operator` _str_ - Operation performed to the variable +- `incname` _str_ - raw name of the include file +- `fileincluded` _str_ - path of the file included +- `statement` _str_ - either include or require - + -#### VarName +#### IncName ```python @property -def VarName() -> str +def IncName() -> str ``` -Variable name +Include name **Returns**: -- `str` - name of variable +- `str` - name of the file to include/require - + -#### SubItem +#### Statement ```python @property -def SubItem() -> str +def Statement() -> str ``` -Variable modifiers +statement either include or require **Returns**: -- `str` - variable modifiers like packages, machines, appends, prepends +- `str` - include or require - + -#### SubItems +#### FileIncluded ```python @property -def SubItems() -> List[str] +def FileIncluded() -> str ``` -Variable modifiers list +The file included **Returns**: -- `list` - variable modifiers list like packages, machines, appends, prepends +- `str` - path to file - + -#### VarValue +#### get\_items ```python -@property -def VarValue() -> str +def get_items() -> Tuple[str, str] ``` -variable value +Get items **Returns**: -- `str` - unstripped variable value +- `list` - include name, include statement - + -#### VarOp +## Export Objects ```python -@property -def VarOp() -> str +class Export(Item) ``` -Variable operation - -**Returns**: - -- `str` - operation did on the variable +Items representing export statements in bitbake. - + -#### VarNameComplete +#### \_\_init\_\_ ```python -@property -def VarNameComplete() -> str +def __init__(name: str, value: str, *args, **kwargs) -> None ``` -Complete variable name included overrides and flags - -**Returns**: - -- `str` - complete variable name - - - -#### VarNameCompleteNoModifiers +constructor -```python -@property -def VarNameCompleteNoModifiers() -> str -``` +**Arguments**: -Complete variable name included overrides but without modifiers like append, prepend and remove +- `name` _str_ - variable name of the export +- `value` _str_ - (optional) value of the export + -**Returns**: +**Arguments**: -- `str` - complete variable name +- `new_style_override_syntax` _bool_ - Use ':' a override delimiter (default: {False}) - + -#### RawVarName +#### Name ```python @property -def RawVarName() -> str +def Name() -> str ``` -Variable name and flags combined +Name of the exported var **Returns**: -- `str` - raw representation of the variable name +- `str` - name of the exported var - + -#### VarValueStripped +#### Value ```python @property -def VarValueStripped() -> str +def Value() -> str ``` -Stripped variable value +value of the export **Returns**: -- `str` - stripped version of variable value +- `str` - optional value of the export - + -#### IsAppend +#### get\_items ```python -def IsAppend() -> bool +def get_items() -> Tuple[str, str] ``` -Check if operation is an append +Get items **Returns**: -- `bool` - True is variable is appended +- `list` - include name, include statement - + -#### AppendOperation +## Function Objects ```python -def AppendOperation() -> List[str] +class Function(Item) ``` -Get variable modifiers - -**Returns**: - -- `list` - list could contain any combination of 'append', ' += ', 'prepend' and 'remove' +Items representing task definitions in bitbake. - + -#### get\_items +#### \_\_init\_\_ ```python -def get_items(override: str = "", versioned: bool = False) -> List[str] +def __init__(name: str, + body: str, + python: bool = False, + fakeroot: bool = False, + *args, + **kwargs) -> None ``` -Get items of variable value +[summary] **Arguments**: -- `override` _str_ - String to take instead of VarValue -- `versioned` _bool_ - items can be versioned (versions will be stripped in this case) +- `name` _str_ - Raw function name +- `body` _str_ - Function body -**Returns**: +**Arguments**: -- `list` - clean list of items in variable value +- `python` _bool_ - python function according to parser (default: {False}) +- `fakeroot` _bool_ - uses fakeroot (default: {False}) - + -#### IsMultiLine +#### IsPython ```python -def IsMultiLine() -> bool +@property +def IsPython() -> bool ``` -Check if variable has a multiline assignment +Is python function **Returns**: -- `bool` - True if multiline +- `bool` - is a python function - + -#### GetDistroEntry +#### IsFakeroot ```python -def GetDistroEntry() -> str +@property +def IsFakeroot() -> bool ``` -Get distro specific entries in variable +Is fakeroot function **Returns**: -- `str` - distro specific modifier of variable or "" +- `bool` - is a python function - + -#### GetMachineEntry +#### FuncName ```python -def GetMachineEntry() -> str +@property +def FuncName() -> str ``` -Get machine specific entries in variable +Function name **Returns**: -- `str` - machine specific modifier of variable or "" +- `str` - name of function - + -#### GetClassOverride +#### FuncNameComplete ```python -def GetClassOverride() -> str +@property +def FuncNameComplete() -> str ``` -Get class specific entries in variable +Complete function name (including overrides) **Returns**: -- `str` - class specific modifier of variable or "" +- `str` - complete name of function - + -#### IsImmediateModify +#### SubItem ```python -def IsImmediateModify() -> bool +@property +def SubItem() -> str ``` -Variable operation is done immediately +Function modifiers **Returns**: -- `bool` - true if it isn't a prepend/append or remove operation +- `str` - function modifiers like packages, machines, appends, prepends - + -## Comment Objects +#### SubItems ```python -class Comment(Item) +@property +def SubItems() -> List[str] ``` -Items representing comments in bitbake. - - - -#### \_\_init\_\_ +Function modifiers list -```python -def __init__(*args, **kwargs) -> None -``` +**Returns**: -constructor +- `list` - function modifiers list like packages, machines, appends, prepends - + -#### get\_items +#### FuncBody ```python -def get_items() -> List[str] +@property +def FuncBody() -> str ``` -Get single lines of block +Function body **Returns**: -- `list` - single lines of comment block +- `str` - function body text - + -## Include Objects +#### FuncBodyStripped ```python -class Include(Item) +@property +def FuncBodyStripped() -> str ``` -Items that representing include/require statements. +Stripped function body - +**Returns**: -#### \_\_init\_\_ +- `str` - stripped function body text + + + +#### FuncBodyRaw ```python -def __init__(incname: str, fileincluded: str, statement: str, *args, - **kwargs) -> None +@property +def FuncBodyRaw() -> str ``` -constructor +Raw function body (including brackets) -**Arguments**: +**Returns**: -- `incname` _str_ - raw name of the include file -- `fileincluded` _str_ - path of the file included -- `statement` _str_ - either include or require +- `str` - raw function body text - + -#### IncName +#### GetDistroEntry ```python -@property -def IncName() -> str +def GetDistroEntry() -> str ``` -Include name +Get distro specific modifiers **Returns**: -- `str` - name of the file to include/require +- `str` - distro specific modifier or "" - + -#### Statement +#### GetMachineEntry ```python -@property -def Statement() -> str +def GetMachineEntry() -> str ``` -statement either include or require +Get machine specific modifiers **Returns**: -- `str` - include or require +- `str` - machine specific modifier or "" - + -#### FileIncluded +#### IsAppend ```python -@property -def FileIncluded() -> str +def IsAppend() -> bool ``` -The file included +Return if function appends another function **Returns**: -- `str` - path to file +- `bool` - True is append or prepend operation - + #### get\_items ```python -def get_items() -> Tuple[str, str] +def get_items() -> List[str] ``` -Get items +Get items of function body **Returns**: -- `list` - include name, include statement +- `list` - single lines of function body - + -## Export Objects +## PythonBlock Objects ```python -class Export(Item) +class PythonBlock(Item) ``` -Items representing export statements in bitbake. +Items representing python functions in bitbake. - + #### \_\_init\_\_ ```python -def __init__(name: str, value: str, *args, **kwargs) -> None +def __init__(name: str, *args, **kwargs) -> None ``` constructor **Arguments**: -- `name` _str_ - variable name of the export -- `value` _str_ - (optional) value of the export - - -**Arguments**: - -- `new_style_override_syntax` _bool_ - Use ':' a override delimiter (default: {False}) - - - -#### Name - -```python -@property -def Name() -> str -``` - -Name of the exported var - -**Returns**: - -- `str` - name of the exported var +- `name` _str_ - Function name - + -#### Value +#### FuncName ```python @property -def Value() -> str +def FuncName() -> str ``` -value of the export +Function name **Returns**: -- `str` - optional value of the export +- `str` - name of function - + #### get\_items ```python -def get_items() -> Tuple[str, str] +def get_items() -> List[str] ``` -Get items +Get lines of function body **Returns**: -- `list` - include name, include statement +- `list` - lines of function body - + -## Function Objects +## FlagAssignment Objects ```python -class Function(Item) +class FlagAssignment(Item) ``` -Items representing task definitions in bitbake. +Items representing flag assignments in bitbake. - + #### \_\_init\_\_ ```python -def __init__(name: str, - body: str, - python: bool = False, - fakeroot: bool = False, - *args, +def __init__(name: str, ident: str, value: str, varop: str, *args, **kwargs) -> None ``` -[summary] - -**Arguments**: - -- `name` _str_ - Raw function name -- `body` _str_ - Function body - +constructor **Arguments**: -- `python` _bool_ - python function according to parser (default: {False}) -- `fakeroot` _bool_ - uses fakeroot (default: {False}) +- `name` _str_ - name of task to be modified +- `ident` _str_ - task flag +- `value` _str_ - value of modification +- `varop` _str_ - variable operation - + -#### IsPython +#### VarName ```python @property -def IsPython() -> bool +def VarName() -> str ``` -Is python function +Variable name **Returns**: -- `bool` - is a python function +- `str` - name of variable - + -#### IsFakeroot +#### Flag ```python @property -def IsFakeroot() -> bool +def Flag() -> str ``` -Is fakeroot function +Flag name **Returns**: -- `bool` - is a python function +- `str` - Flag name - + -#### FuncName +#### VarOp ```python @property -def FuncName() -> str +def VarOp() -> str ``` -Function name +Modifier operation **Returns**: -- `str` - name of function +- `str` - used modifier in operation - + -#### FuncNameComplete +#### Value ```python @property -def FuncNameComplete() -> str +def Value() -> str ``` -Complete function name (including overrides) +Value **Returns**: -- `str` - complete name of function +- `str` - value set - + -#### SubItem +#### ValueStripped ```python @property -def SubItem() -> str +def ValueStripped() -> str ``` -Function modifiers +Value stripped of the quotes **Returns**: -- `str` - function modifiers like packages, machines, appends, prepends +- `str` - value set - + -#### SubItems +#### get\_items ```python -@property -def SubItems() -> List[str] +def get_items() -> Tuple[str, str, str, str] ``` -Function modifiers list +Get items **Returns**: -- `list` - function modifiers list like packages, machines, appends, prepends +- `list` - variable name, flag, variable operation, modification value - + -#### FuncBody +## FunctionExports Objects ```python -@property -def FuncBody() -> str +class FunctionExports(Item) ``` -Function body - -**Returns**: - -- `str` - function body text +Items representing EXPORT_FUNCTIONS in bitbake. - + -#### FuncBodyStripped +#### \_\_init\_\_ ```python -@property -def FuncBodyStripped() -> str +def __init__(name: str, *args, **kwargs) -> None ``` -Stripped function body +constructor -**Returns**: +**Arguments**: -- `str` - stripped function body text +- `name` _str_ - name of function to be exported - + -#### FuncBodyRaw +#### FuncNames ```python @property -def FuncBodyRaw() -> str +def FuncNames() -> str ``` -Raw function body (including brackets) +Function name **Returns**: -- `str` - raw function body text +- `str` - names of exported functions - + -#### GetDistroEntry +#### get\_items ```python -def GetDistroEntry() -> str +def get_items() -> List[str] ``` -Get distro specific modifiers +Get items **Returns**: -- `str` - distro specific modifier or "" +- `list` - function names - + -#### GetMachineEntry +#### get\_items\_unaliased ```python -def GetMachineEntry() -> str +def get_items_unaliased() -> List[str] ``` -Get machine specific modifiers +Get items with their bbclass scope names **Returns**: -- `str` - machine specific modifier or "" +- `list` - function names in the scope of a bbclass (foo becomes classname-foo in this case) - + -#### IsAppend +## TaskAdd Objects ```python -def IsAppend() -> bool +class TaskAdd(Item) ``` -Return if function appends another function +Items representing addtask statements in bitbake. -**Returns**: + -- `bool` - True is append or prepend operation +#### \_\_init\_\_ - +```python +def __init__(name: str, + before: str = "", + after: str = "", + comment: str = "", + *args, + **kwargs) -> None +``` -#### get\_items +constructor + +**Arguments**: + +- `name` _str_ - name of task to be executed + + +**Arguments**: + +- `before` _str_ - before statement (default: {""}) +- `after` _str_ - after statement (default: {""}) +- `comment` _str_ - optional comment (default: {""}) + + + +#### FuncName ```python -def get_items() -> List[str] +@property +def FuncName() -> str ``` -Get items of function body +Function name **Returns**: -- `list` - single lines of function body +- `str` - name of function - + -## PythonBlock Objects +#### Before ```python -class PythonBlock(Item) +@property +def Before() -> List[str] ``` -Items representing python functions in bitbake. +Tasks executed before - +**Returns**: -#### \_\_init\_\_ +- `list` - tasks to be executed before + + + +#### After ```python -def __init__(name: str, *args, **kwargs) -> None +@property +def After() -> List[str] ``` -constructor +Tasks executed after -**Arguments**: +**Returns**: -- `name` _str_ - Function name +- `list` - tasks to be executed after - + -#### FuncName +#### Comment ```python @property -def FuncName() -> str +def Comment() -> str ``` -Function name +Comment **Returns**: -- `str` - name of function +- `str` - comment if any - + #### get\_items @@ -2519,416 +2497,393 @@ Function name def get_items() -> List[str] ``` -Get lines of function body +get items **Returns**: -- `list` - lines of function body +- `list` - function name, all before statements, all after statements - + -## FlagAssignment Objects +## TaskDel Objects ```python -class FlagAssignment(Item) +class TaskDel(Item) ``` -Items representing flag assignments in bitbake. +Items representing deltask statements in bitbake. - + #### \_\_init\_\_ ```python -def __init__(name: str, ident: str, value: str, varop: str, *args, - **kwargs) -> None +def __init__(name: str, comment: str, *args, **kwargs) -> None ``` constructor **Arguments**: -- `name` _str_ - name of task to be modified -- `ident` _str_ - task flag -- `value` _str_ - value of modification -- `varop` _str_ - variable operation +- `name` _str_ - name of task to be executed +- `comment` _str_ - optional comment - + -#### VarName +#### FuncName ```python @property -def VarName() -> str +def FuncName() -> str ``` -Variable name +Function name **Returns**: -- `str` - name of variable +- `str` - name of function - + -#### Flag +#### Comment ```python @property -def Flag() -> str +def Comment() -> str ``` -Flag name +Comment **Returns**: -- `str` - Flag name +- `str` - comment if any - + -#### VarOp +#### get\_items ```python -@property -def VarOp() -> str +def get_items() -> List[str] ``` -Modifier operation +get items **Returns**: -- `str` - used modifier in operation +- `list` - function name - + -#### Value +## MissingFile Objects ```python -@property -def Value() -> str +class MissingFile(Item) ``` -Value +Items representing missing files found while parsing. -**Returns**: + -- `str` - value set +#### \_\_init\_\_ - +```python +def __init__(filename: str, statement: str, *args, **kwargs) -> None +``` -#### ValueStripped +constructor + +**Arguments**: + +- `filename` _str_ - filename of the file that can't be found +- `statement` _str_ - either include or require + + + +#### Filename ```python @property -def ValueStripped() -> str +def Filename() -> str ``` -Value stripped of the quotes +Filename of the file missing **Returns**: -- `str` - value set +- `str` - filename that can't be resolved - + -#### get\_items +#### Statement ```python -def get_items() -> Tuple[str, str, str, str] +@property +def Statement() -> str ``` -Get items +statement either include or require **Returns**: -- `list` - variable name, flag, variable operation, modification value +- `str` - include or require - + -## FunctionExports Objects +## AddPylib Objects ```python -class FunctionExports(Item) +class AddPylib(Item) ``` -Items representing EXPORT_FUNCTIONS in bitbake. +Items representing addpylib statements in bitbake. - + #### \_\_init\_\_ ```python -def __init__(name: str, *args, **kwargs) -> None +def __init__(path: str, namespace: str, *args, **kwargs) -> None ``` constructor **Arguments**: -- `name` _str_ - name of function to be exported +- `path` _str_ - path to the namespace +- `namespace` _str_ - namespace name - + -#### FuncNames +#### Path ```python @property -def FuncNames() -> str +def Path() -> str ``` -Function name +Path of the library addition **Returns**: -- `str` - names of exported functions +- `str` - path of the library addition - + -#### get\_items +#### Namespace ```python -def get_items() -> List[str] +@property +def Namespace() -> str ``` -Get items +Namespace of the addition **Returns**: -- `list` - function names +- `str` - Namespace of the addition - + -#### get\_items\_unaliased +#### get\_items ```python -def get_items_unaliased() -> List[str] +def get_items() -> Tuple[str, str] ``` -Get items with their bbclass scope names +Get items **Returns**: -- `list` - function names in the scope of a bbclass (foo becomes classname-foo in this case) +- `list` - library path, library namespace - + -## TaskAdd Objects +## AddFragements Objects ```python -class TaskAdd(Item) +class AddFragements(Item) ``` -Items representing addtask statements in bitbake. +Items representing addfragment statements in bitbake. - + #### \_\_init\_\_ ```python -def __init__(name: str, - before: str = "", - after: str = "", - comment: str = "", - *args, - **kwargs) -> None +def __init__(path: str, variable: str, flagged: str, *args, **kwargs) -> None ``` constructor **Arguments**: -- `name` _str_ - name of task to be executed - - -**Arguments**: - -- `before` _str_ - before statement (default: {""}) -- `after` _str_ - after statement (default: {""}) -- `comment` _str_ - optional comment (default: {""}) - - - -#### FuncName - -```python -@property -def FuncName() -> str -``` - -Function name - -**Returns**: - -- `str` - name of function +- `path` _str_ - path to the namespace +- `variable` _str_ - variable name +- `flagged` _str_ - flagged variable name(s) - + -#### Before +#### Path ```python @property -def Before() -> List[str] +def Path() -> str ``` -Tasks executed before +Path of the fragment **Returns**: -- `list` - tasks to be executed before +- `str` - path of the fragment - + -#### After +#### Variable ```python @property -def After() -> List[str] +def Variable() -> str ``` -Tasks executed after +Variable of the fragment **Returns**: -- `list` - tasks to be executed after +- `str` - Variable of the fragment - + -#### Comment +#### Flagged ```python @property -def Comment() -> str +def Flagged() -> str ``` -Comment +Flagged variables of the fragment **Returns**: -- `str` - comment if any +- `str` - Flagged variables of the fragment - + #### get\_items ```python -def get_items() -> List[str] +def get_items() -> Tuple[str, str] ``` -get items +Get items **Returns**: -- `list` - function name, all before statements, all after statements +- `list` - library path, variable, flagged - + -## TaskDel Objects +## IncludeAll Objects ```python -class TaskDel(Item) +class IncludeAll(Item) ``` -Items representing deltask statements in bitbake. +Items representing include_all statements in bitbake. - + #### \_\_init\_\_ ```python -def __init__(name: str, comment: str, *args, **kwargs) -> None +def __init__(file: str, *args, **kwargs) -> None ``` constructor **Arguments**: -- `name` _str_ - name of task to be executed -- `comment` _str_ - optional comment - - - -#### FuncName - -```python -@property -def FuncName() -> str -``` - -Function name - -**Returns**: - -- `str` - name of function +- `file` _str_ - path to the file - + -#### Comment +#### File ```python @property -def Comment() -> str +def File() -> str ``` -Comment +Path to include **Returns**: -- `str` - comment if any +- `str` - Path to include - + #### get\_items ```python -def get_items() -> List[str] +def get_items() -> Tuple[str, str] ``` -get items +Get items **Returns**: -- `list` - function name +- `list` - file - + -## MissingFile Objects +## Inherit Objects ```python -class MissingFile(Item) +class Inherit(Item) ``` -Items representing missing files found while parsing. +Items that representing inherit(_defer) statements. - + #### \_\_init\_\_ ```python -def __init__(filename: str, statement: str, *args, **kwargs) -> None +def __init__(statement: str, + classes: str, + inherit_file_paths: Set[str] = None, + *args, + **kwargs) -> None ``` constructor **Arguments**: -- `filename` _str_ - filename of the file that can't be found -- `statement` _str_ - either include or require +- `class` _str_ - class code to inherit +- `statement` _str_ - inherit statement (INHERIT, inherit or inherit_defer) + - +**Arguments**: -#### Filename +- `inherit_file_paths` _Set[str]_ - Paths of the identified inherited classes + + + +#### Class ```python @property -def Filename() -> str +def Class() -> str ``` -Filename of the file missing +Class(es) to inherit **Returns**: -- `str` - filename that can't be resolved +- `str` - class(es) to inherit - + #### Statement @@ -2937,537 +2892,625 @@ Filename of the file missing def Statement() -> str ``` -statement either include or require +inherit statement **Returns**: -- `str` - include or require +- `str` - inherit or inherit_defer - + -## AddPylib Objects +#### FilePaths ```python -class AddPylib(Item) +@property +def FilePaths() -> Set[str] ``` -Items representing addpylib statements in bitbake. - - - -#### \_\_init\_\_ - -```python -def __init__(path: str, namespace: str, *args, **kwargs) -> None -``` +File paths to identified bbclasses -constructor +As some classes might not be resolvable in the current context +the order doesn't necessarily reflect the order of the +inherit statements -**Arguments**: +**Returns**: -- `path` _str_ - path to the namespace -- `namespace` _str_ - namespace name +- `Set[str]` - File paths to identified bbclasses - + -#### Path +#### get\_items ```python -@property -def Path() -> str +def get_items() -> List[str] ``` -Path of the library addition +Get items **Returns**: -- `str` - path of the library addition +- `list` - parsed Class items - + -#### Namespace +## Unset Objects ```python -@property -def Namespace() -> str +class Unset(Item) ``` -Namespace of the addition - -**Returns**: +Items representing unset statements in bitbake. -- `str` - Namespace of the addition + - +#### \_\_init\_\_ + +```python +def __init__(name: str, flag: str = "", *args, **kwargs) -> None +``` + +constructor + +**Arguments**: + +- `name` _str_ - name of variable to be unset + + +**Arguments**: + +- `flag` _str_ - Flag to unset + + + +#### VarName + +```python +@property +def VarName() -> str +``` + +Variable name + +**Returns**: + +- `str` - name of the variable + + + +#### Flag + +```python +@property +def Flag() -> str +``` + +Variable flag + +**Returns**: + +- `str` - name of the variable flag + + #### get\_items ```python -def get_items() -> Tuple[str, str] +def get_items() -> List[str] ``` -Get items +get items **Returns**: -- `list` - library path, library namespace +- `list` - variable name, variable flag - + -## AddFragements Objects +# oelint\_parser.rpl\_regex + + + +## RegexRpl Objects ```python -class AddFragements(Item) +class RegexRpl() ``` -Items representing addfragment statements in bitbake. +Safe regex replacements - + -#### \_\_init\_\_ +#### search ```python -def __init__(path: str, variable: str, flagged: str, *args, **kwargs) -> None +@staticmethod +def search(pattern: str, + string: str, + timeout: int = 5, + default: object = None, + **kwargs) -> Union[Match, None] ``` -constructor +replacement for re.search **Arguments**: -- `path` _str_ - path to the namespace -- `variable` _str_ - variable name -- `flagged` _str_ - flagged variable name(s) +- `pattern` _str_ - regex pattern +- `string` _str_ - input string +- `timeout` _int, optional_ - Timeout for operation. On timeout `default` will be returned. Defaults to 5. +- `default` __type_, optional_ - Default to return on timeout. Defaults to None. + - +**Returns**: -#### Path +- `Match` - Match object or None + + + +#### split ```python -@property -def Path() -> str +@staticmethod +def split(pattern: str, + string: str, + timeout: int = 5, + default: object = None, + **kwargs) -> List[str] ``` -Path of the fragment +replacement for re.split + +**Arguments**: + +- `pattern` _str_ - regex pattern +- `string` _str_ - input string +- `timeout` _int, optional_ - Timeout for operation. On timeout `default` will be returned. Defaults to 5. +- `default` __type_, optional_ - Default to return on timeout. Defaults to None. + **Returns**: -- `str` - path of the fragment +- `list` - list object or None - + -#### Variable +#### match ```python -@property -def Variable() -> str +@staticmethod +def match(pattern: str, + string: str, + timeout: int = 5, + default: object = None, + **kwargs) -> Union[Match, None] ``` -Variable of the fragment +replacement for re.match + +**Arguments**: + +- `pattern` _str_ - regex pattern +- `string` _str_ - input string +- `timeout` _int, optional_ - Timeout for operation. On timeout `default` will be returned. Defaults to 5. +- `default` __type_, optional_ - Default to return on timeout. Defaults to None. + **Returns**: -- `str` - Variable of the fragment +- `Match` - Match object or None - + -#### Flagged +#### sub ```python -@property -def Flagged() -> str +@staticmethod +def sub(pattern: str, + repl: str, + string: str, + timeout: int = 5, + default: str = '', + **kwargs) -> str ``` -Flagged variables of the fragment +replacement for re.sub + +**Arguments**: + +- `pattern` _str_ - regex pattern +- `repl` _str_ - replacement string +- `string` _str_ - input string +- `timeout` _int, optional_ - Timeout for operation. On timeout `default` will be returned. Defaults to 5. +- `default` __type_, optional_ - Default to return on timeout. Defaults to ''. + **Returns**: -- `str` - Flagged variables of the fragment +- `str` - string - + -#### get\_items +#### finditer ```python -def get_items() -> Tuple[str, str] +@staticmethod +def finditer(pattern: str, + string: str, + timeout: int = 5, + default: object = None, + **kwargs) -> Scanner ``` -Get items +replacement for re.finditer + +**Arguments**: + +- `pattern` _str_ - regex pattern +- `string` _str_ - input string +- `timeout` _int, optional_ - Timeout for operation. On timeout `default` will be returned. Defaults to 5. +- `default` __type_, optional_ - Default to return on timeout. Defaults to None. + **Returns**: -- `list` - library path, variable, flagged +- `Scanner` - Scanner object or None - + -## IncludeAll Objects +# oelint\_parser.parser + + + +#### get\_full\_scope ```python -class IncludeAll(Item) +def get_full_scope(_string: str, offset: int, _sstart: int, _send: int) -> str ``` -Items representing include_all statements in bitbake. +get full block of an inline statement - +**Arguments**: -#### \_\_init\_\_ +- `_string` _str_ - input string +- `offset` _int_ - offset in string +- `_sstart` _int_ - block start index +- `_send` _int_ - block end index + + +**Returns**: + +- `str` - full block on inline statement + + + +#### prepare\_lines\_subparser ```python -def __init__(file: str, *args, **kwargs) -> None +def prepare_lines_subparser(_iter: Iterable, + lineOffset: int, + num: int, + line: int, + raw_line: str = None, + negative: bool = False) -> tuple[dict, str, int] ``` -constructor +preprocess raw input **Arguments**: -- `file` _str_ - path to the file +- `_iter` _iterator_ - line interator object +- `lineOffset` _int_ - current line index +- `num` _int_ - internal line counter +- `line` _int_ - input string +- `raw_line` _string, optional_ - internal line representation. Defaults to None. +- `negative` _bool_ - Negative branch inline expansion. Defaults to False + - +**Returns**: -#### File + tuple[dict, str, int]: preproccessed chunk, buffer for next iteration, number of lines + + + +#### prepare\_lines ```python -@property -def File() -> str +def prepare_lines(_file: str, + lineOffset: int = 0, + negative: bool = False) -> List[str] ``` -Path to include +break raw file input into preprocessed chunks + +**Arguments**: + +- `_file` _string_ - Full path to file +- `lineOffset` _int, optional_ - line offset counter. Defaults to 0. +- `negative` _bool_ - Negative branch inline expansion. Defaults to False + **Returns**: -- `str` - Path to include +- `list` - preprocessed list of chunks - + #### get\_items ```python -def get_items() -> Tuple[str, str] +def get_items(stash: object, + _file: str, + lineOffset: int = 0, + new_style_override_syntax: bool = False, + negative: bool = False) -> List[Item] ``` -Get items +parses file + +**Arguments**: + +- `stash` _oelint_parser.cls_stash.Stash_ - Stash object +- `_file` _string_ - Full path to file +- `lineOffset` _int, optional_ - line offset counter. Defaults to 0. +- `new_style_override_syntax` _bool, optional_ - default to new override syntax (default: False) +- `negative` _bool, optional_ - Negative branch inline expansion (default: False) + **Returns**: -- `list` - file +- `list` - List of oelint_parser.cls_item.* representations - + -## Inherit Objects +# oelint\_parser.constants + + + +## Constants Objects ```python -class Inherit(Item) +class Constants() ``` -Items that representing inherit(_defer) statements. +Interface for constants - + #### \_\_init\_\_ ```python -def __init__(statement: str, - classes: str, - inherit_file_paths: Set[str] = None, - *args, - **kwargs) -> None +def __init__(file_: str = DEFAULT_DB) -> None ``` -constructor - -**Arguments**: - -- `class` _str_ - class code to inherit -- `statement` _str_ - inherit statement (INHERIT, inherit or inherit_defer) - +Constants interface **Arguments**: -- `inherit_file_paths` _Set[str]_ - Paths of the identified inherited classes +- `file_` _str, optional_ - File to load. Defaults to DEFAULT_DB. - + -#### Class +#### GetByPath ```python -@property -def Class() -> str +def GetByPath(path: str) -> Union[Dict, List] ``` -Class(es) to inherit +Get constant from path + +**Arguments**: + +- `path` _str_ - / joined path in the constant structure + **Returns**: -- `str` - class(es) to inherit + Union[Dict, List]: Item in structure or empty dictionary - + -#### Statement +#### AddConstants ```python -@property -def Statement() -> str +def AddConstants(_dict: dict) -> None ``` -inherit statement +Add constants to the existing -**Returns**: +**Arguments**: -- `str` - inherit or inherit_defer +- `dict` _dict_ - constant dictionary to add - + -#### FilePaths +#### RemoveConstants ```python -@property -def FilePaths() -> Set[str] +def RemoveConstants(_dict: dict) -> None ``` -File paths to identified bbclasses - -As some classes might not be resolvable in the current context -the order doesn't necessarily reflect the order of the -inherit statements +Remove constants from the existing -**Returns**: +**Arguments**: -- `Set[str]` - File paths to identified bbclasses +- `dict` _dict_ - constant dictionary to remove - + -#### get\_items +#### OverrideConstants ```python -def get_items() -> List[str] +def OverrideConstants(_dict: dict) -> None ``` -Get items +Override constants in the existing db -**Returns**: +**Arguments**: -- `list` - parsed Class items +- `dict` _dict]_ - constant dictionary with override values - + -## Unset Objects +#### FunctionsKnown ```python -class Unset(Item) +@property +def FunctionsKnown() -> List[str] ``` -Items representing unset statements in bitbake. +Return known functions - +**Returns**: -#### \_\_init\_\_ +- `list` - list of known functions -```python -def __init__(name: str, flag: str = "", *args, **kwargs) -> None -``` + -constructor +#### FunctionsOrder -**Arguments**: +```python +@property +def FunctionsOrder() -> List[str] +``` -- `name` _str_ - name of variable to be unset - +Return function order -**Arguments**: +**Returns**: -- `flag` _str_ - Flag to unset +- `list` - List of functions to order in their designated order - + -#### VarName +#### MirrorsKnown ```python @property -def VarName() -> str +def MirrorsKnown() -> Dict[str, str] ``` -Variable name +Return known mirrors and their replacements **Returns**: -- `str` - name of the variable +- `dict` - Dict of known mirrors and their replacements - + -#### Flag +#### VariablesKnown ```python @property -def Flag() -> str +def VariablesKnown() -> List[str] ``` -Variable flag +Known variables **Returns**: -- `str` - name of the variable flag +- `list` - List of known variables - + -#### get\_items +#### DistrosKnown ```python -def get_items() -> List[str] +@property +def DistrosKnown() -> List[str] ``` -get items +Known distros **Returns**: -- `list` - variable name, variable flag - - - -# oelint\_parser.rpl\_regex +- `list` - List of known distros - + -## RegexRpl Objects +#### MachinesKnown ```python -class RegexRpl() +@property +def MachinesKnown() -> List[str] ``` -Safe regex replacements +Known machines - +**Returns**: -#### search +- `list` - List of known machines -```python -@staticmethod -def search(pattern: str, - string: str, - timeout: int = 5, - default: object = None, - **kwargs) -> Union[Match, None] -``` + -replacement for re.search +#### ImagesClasses -**Arguments**: +```python +@property +def ImagesClasses() -> List[str] +``` -- `pattern` _str_ - regex pattern -- `string` _str_ - input string -- `timeout` _int, optional_ - Timeout for operation. On timeout `default` will be returned. Defaults to 5. -- `default` __type_, optional_ - Default to return on timeout. Defaults to None. - +Classes that are used in images **Returns**: -- `Match` - Match object or None +- `list` - Classes that are used in images - + -#### split +#### ImagesVariables ```python -@staticmethod -def split(pattern: str, - string: str, - timeout: int = 5, - default: object = None, - **kwargs) -> List[str] +@property +def ImagesVariables() -> List[str] ``` -replacement for re.split - -**Arguments**: - -- `pattern` _str_ - regex pattern -- `string` _str_ - input string -- `timeout` _int, optional_ - Timeout for operation. On timeout `default` will be returned. Defaults to 5. -- `default` __type_, optional_ - Default to return on timeout. Defaults to None. - +Variables that are used in images **Returns**: -- `list` - list object or None +- `list` - Variables that are used in images - + -#### match +#### SetsBase ```python -@staticmethod -def match(pattern: str, - string: str, - timeout: int = 5, - default: object = None, - **kwargs) -> Union[Match, None] +@property +def SetsBase() -> Dict[str, str] ``` -replacement for re.match - -**Arguments**: - -- `pattern` _str_ - regex pattern -- `string` _str_ - input string -- `timeout` _int, optional_ - Timeout for operation. On timeout `default` will be returned. Defaults to 5. -- `default` __type_, optional_ - Default to return on timeout. Defaults to None. - +Base variable set **Returns**: -- `Match` - Match object or None +- `dict` - dictionary with base variable set - + -#### sub +#### ClassIgnore ```python -@staticmethod -def sub(pattern: str, - repl: str, - string: str, - timeout: int = 5, - default: str = '', - **kwargs) -> str +@property +def ClassIgnore() -> List[str] ``` -replacement for re.sub - -**Arguments**: - -- `pattern` _str_ - regex pattern -- `repl` _str_ - replacement string -- `string` _str_ - input string -- `timeout` _int, optional_ - Timeout for operation. On timeout `default` will be returned. Defaults to 5. -- `default` __type_, optional_ - Default to return on timeout. Defaults to ''. - +_summary_ **Returns**: -- `str` - string +- `List[str]` - List of classes to ignore - + -#### finditer +#### IncludeIgnore ```python -@staticmethod -def finditer(pattern: str, - string: str, - timeout: int = 5, - default: object = None, - **kwargs) -> Scanner +@property +def IncludeIgnore() -> List[str] ``` -replacement for re.finditer - -**Arguments**: - -- `pattern` _str_ - regex pattern -- `string` _str_ - input string -- `timeout` _int, optional_ - Timeout for operation. On timeout `default` will be returned. Defaults to 5. -- `default` __type_, optional_ - Default to return on timeout. Defaults to None. - +Includes to ignore **Returns**: -- `Scanner` - Scanner object or None +- `List[str]` - List of paths to ignore