Skip to content

Latest commit

 

History

History
3871 lines (2431 loc) · 77.5 KB

api-documentation.md

File metadata and controls

3871 lines (2431 loc) · 77.5 KB

Table of Contents

oelint_parser

oelint_parser is a library to parse bitbake files.

oelint_parser.cls_stash

Stash Objects

class Stash()

The Stash object is the central storage for extracting the bitbake information.

StashList Objects

class StashList(UserList)

Extended list of Items.

__init__

def __init__(stash: 'Stash', items: Iterable[Item]) -> None

StashList - Extended list of Items.

Arguments:

  • stash Stash - Parent stash object
  • items Iterable - Iterable input

insert

def insert(index: int, item: Item) -> None

Insert into list

Arguments:

  • index int - index where to insert
  • item Item - object to insert

append

def append(item: Union[Item, Iterable[Item]]) -> None

Append to list

Arguments:

  • item Union[Item, Iterable[Item]] - Item or Iterable of Items

extend

def extend(other: 'Stash.StashList') -> None

Extend list

Arguments:

  • other Stash.StashList - Other stash other

remove

def remove(item: Union[Item, Iterable[Item]]) -> None

Remove from list

Arguments:

  • item Item - Item(s) to remove

reduce

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.

NOTE: This is a destructive operation. If you want to have a copy returned use

Stash.Reduce(,...) instead.

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.

Returns:

  • Stash.StashList - self

__init__

def __init__(quiet: bool = False,
             new_style_override_syntax: bool = False,
             negative_inline: bool = False) -> None

Stash object

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.

AddFile

def AddFile(_file: str,
            lineOffset: int = 0,
            forcedLink: str = None) -> List[Item]

Adds a file to the stash

Arguments:

  • _file str - Full path to file

Arguments:

  • lineOffset int - Line offset from the file that include this file (default: {0})
  • forcedLink type - Force link against a file (default: {None})

Returns:

  • list - List of {oelint_parser.cls_item.Item}

FingerPrint

@property
def FingerPrint() -> str

Get the SHA1 fingerprint of the current Stash

Returns:

  • str - hexdigest checksum

Append

def Append(item: Union[Item, Iterable[Item]]) -> None

appends one or mote items to the stash

Arguments:

  • item Item - Item(s) to append

Remove

def Remove(item: Union[Item, Iterable[Item]]) -> None

removes one or more items from the stash

Arguments:

  • item Item - Item(s) to remove

AddDistroMachineFromLayer

def AddDistroMachineFromLayer(path: str) -> None

adds machine and distro configuration from the layer of the provided file

Arguments:

  • path str - Path to file

Finalize

def Finalize() -> None

finalize the dependencies within the stash

GetRecipes

@functools.cache
def GetRecipes() -> None

Get bb files in stash

Returns:

  • list - List of bb files in stash

GetLoneAppends

@functools.cache
def GetLoneAppends() -> List[str]

Get bbappend without a matching bb

Returns:

  • list - list of bbappend without a matching bb

GetConfFiles

@functools.cache
def GetConfFiles() -> List[str]

Get configurations files

Returns:

  • List[str] - List of configuration files

GetLinksForFile

@functools.cache
def GetLinksForFile(filename: str) -> List[str]

Get file which this file is linked against

Arguments:

  • filename str - full path to file

Returns:

  • list - list of full paths the file is linked against

Reduce

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]

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.

Returns:

  • List[Item] - Returns a list of items fitting the set filters

GetItemsFor

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'

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.

Returns:

  • Stash.StashList - Returns a list of items fitting the set filters

ExpandVar

def ExpandVar(filename: str = None,
              attribute: Union[Iterable[str], str] = None,
              attributeValue: Union[Iterable[str], str] = None,
              nolink: bool = False) -> dict

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})

Returns:

  • {dict} - expanded variables from call + base set of variables

GetFiles

@functools.cache
def GetFiles(_file: str, pattern: str) -> List[str]

Get files matching SRC_URI entries

Arguments:

  • _file str - Full path to filename
  • pattern str - glob pattern to apply

Returns:

  • list - list of files matching pattern

GetLayerRoot

@functools.cache
def GetLayerRoot(name: str) -> str

Find the path to the layer root of a file

Arguments:

  • name str - filename

Returns:

  • str - path to layer root or empty string

FindLocalOrLayer

@functools.cache
def FindLocalOrLayer(name: str, localdir: str) -> str

Find file in local dir or in layer

Arguments:

  • name str - filename
  • localdir str - path to local dir

Returns:

  • str - path to found file or None

GetScrComponents

@functools.cache
def GetScrComponents(string: str) -> dict

Return SRC_URI components

Arguments:

  • string str - raw string

Returns:

  • dict - scheme: protocol used, src: source URI, options: parsed options

SafeLineSplit

@functools.cache
def SafeLineSplit(string: str) -> List[str]

Split line in a safe manner

Arguments:

  • string str - raw input

Returns:

  • list - safely split input

GuessRecipeName

@functools.cache
def GuessRecipeName(_file: str) -> str

Get the recipe name from filename

Arguments:

  • _file str - filename

Returns:

  • str - recipe name

GuessBaseRecipeName

@functools.cache
def GuessBaseRecipeName(_file: str) -> str

Get the base recipe name from filename (aka BPN)

Arguments:

  • _file str - filename

Returns:

  • str - recipe name

GuessRecipeVersion

@functools.cache
def GuessRecipeVersion(_file: str) -> str

Get recipe version from filename

Arguments:

  • _file str - filename

Returns:

  • str - recipe version

ExpandTerm

def ExpandTerm(_file: str,
               value: str,
               spare: List[str] = None,
               seen: List[str] = None) -> str

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)

Returns:

  • str - expanded value

GetValidPackageNames

@functools.cache
def GetValidPackageNames(_file: str, strippn: bool = False) -> List[str]

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 valid package names

GetValidNamedResources

@functools.cache
def GetValidNamedResources(_file: str) -> List[str]

Get list of valid SRCREV resource names

Arguments:

  • _file str - Full path to file

Returns:

  • list - list of valid SRCREV resource names

IsImage

@functools.cache
def IsImage(_file: str) -> bool

returns if the file is likely an image recipe or not

Arguments:

  • _file str - Full path to file

Returns:

  • bool - True if _file is an image recipe

IsPackageGroup

@functools.cache
def IsPackageGroup(_file: str) -> bool

returns if the file is likely a packagegroup recipe or not

Arguments:

  • _file str - Full path to file

Returns:

  • bool - True if _file is a packagegroup recipe

oelint_parser.parser

get_full_scope

def get_full_scope(_string: str, offset: int, _sstart: int, _send: int) -> str

get full block of an inline statement

Arguments:

  • _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

def prepare_lines_subparser(_iter: Iterable,
                            lineOffset: int,
                            num: int,
                            line: int,
                            raw_line: str = None,
                            negative: bool = False) -> List[str]

preprocess raw input

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:

  • list - list of preproccessed chunks

prepare_lines

def prepare_lines(_file: str,
                  lineOffset: int = 0,
                  negative: bool = False) -> List[str]

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:

  • list - preprocessed list of chunks

get_items

def get_items(stash: object,
              _file: str,
              lineOffset: int = 0,
              new_style_override_syntax: bool = False,
              negative: bool = False) -> List[Item]

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 - List of oelint_parser.cls_item.* representations

oelint_parser.cls_item

Item Objects

class Item()

Base class for all Stash items

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             realraw: str,
             new_style_override_syntax: bool = False) -> None

constructor

Arguments:

  • 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:

  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})

Line

@property
def Line() -> int

Overall line count

Returns:

  • int - overall line count of item

Raw

@property
def Raw() -> str

Raw string (without inline code blocks)

Returns:

  • str - raw string of item

Origin

@property
def Origin() -> str

origin of item

Returns:

  • str - full path of origin file

InFileLine

@property
def InFileLine() -> int

Line count in file

Returns:

  • int - [description]

RealRaw

@property
def RealRaw() -> str

Completely unprocessed raw text

Returns:

  • str - completely unprocessed raw text

IsFromClass

@property
def IsFromClass() -> bool

Item comes from a bbclass

Returns:

  • bool - if item was set in a bbclass

OverrideDelimiter

@property
def OverrideDelimiter() -> str

Override delimiter

Returns:

  • str - Override delimiter

IsNewStyleOverrideSyntax

@property
def IsNewStyleOverrideSyntax() -> bool

New style override syntax detected

Returns:

  • bool - True if new style has been detected

safe_linesplit

@staticmethod
def safe_linesplit(string: str) -> List[str]

Safely split an input line to chunks

Arguments:

  • string str - raw input string

Returns:

  • list - list of chunks of original string

get_items

def get_items() -> List[str]

Return single items

Returns:

  • list - lines of raw input

extract_sub

def extract_sub(name: str) -> Tuple[List[str], List[str]]

Extract modifiers

Arguments:

  • name str - input string

Returns:

  • tuple - clean variable name, modifiers, package specific modifiers

extract_sub_func

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

IsFromAppend

def IsFromAppend() -> bool

Item originates from a bbappend

Returns:

  • bool - True if coming from a bbappend

GetAttributes

def GetAttributes() -> dict

Get all public attributes of this class

Returns:

  • dict - all public attributes and their values

Variable Objects

class Variable(Item)

Items representing variables in bitbake.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             name: str,
             value: str,
             operator: str,
             realraw: str,
             new_style_override_syntax: bool = False) -> None

constructor

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • rawtext str - Raw input string (except inline code blocks)
  • realraw str - Unprocessed input
  • name str - Variable name
  • value str - Variable value
  • operator str - Operation performed to the variable

Arguments:

  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})

VarName

@property
def VarName() -> str

Variable name

Returns:

  • str - name of variable

SubItem

@property
def SubItem() -> str

Variable modifiers

Returns:

  • str - variable modifiers like packages, machines, appends, prepends

SubItems

@property
def SubItems() -> List[str]

Variable modifiers list

Returns:

  • list - variable modifiers list like packages, machines, appends, prepends

VarValue

@property
def VarValue() -> str

variable value

Returns:

  • str - unstripped variable value

Flag

@property
@deprecated(version='3.0.0',
            reason='Flag values are now part of FlagAssignment class')
def Flag() -> str

Flag value (deprecated)

Use FlagAssignment class instead.

Returns:

  • str - Empty string.

VarOp

@property
def VarOp() -> str

Variable operation

Returns:

  • str - operation did on the variable

VarNameComplete

@property
def VarNameComplete() -> str

Complete variable name included overrides and flags

Returns:

  • str - complete variable name

VarNameCompleteNoModifiers

@property
def VarNameCompleteNoModifiers() -> str

Complete variable name included overrides but without modifiers like append, prepend and remove

Returns:

  • str - complete variable name

RawVarName

@property
def RawVarName() -> str

Variable name and flags combined

Returns:

  • str - raw representation of the variable name

VarValueStripped

@property
def VarValueStripped() -> str

Stripped variable value

Returns:

  • str - stripped version of variable value

IsAppend

def IsAppend() -> bool

Check if operation is an append

Returns:

  • bool - True is variable is appended

AppendOperation

def AppendOperation() -> List[str]

Get variable modifiers

Returns:

  • list - list could contain any combination of 'append', ' += ', 'prepend' and 'remove'

get_items

def get_items(override: str = "", versioned: bool = False) -> List[str]

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:

  • list - clean list of items in variable value

IsMultiLine

def IsMultiLine() -> bool

Check if variable has a multiline assignment

Returns:

  • bool - True if multiline

GetDistroEntry

def GetDistroEntry() -> str

Get distro specific entries in variable

Returns:

  • str - distro specific modifier of variable or ""

GetMachineEntry

def GetMachineEntry() -> str

Get machine specific entries in variable

Returns:

  • str - machine specific modifier of variable or ""

GetClassOverride

def GetClassOverride() -> str

Get class specific entries in variable

Returns:

  • str - class specific modifier of variable or ""

IsImmediateModify

def IsImmediateModify() -> bool

Variable operation is done immediately

Returns:

  • bool - true if it isn't a prepend/append or remove operation

Comment Objects

class Comment(Item)

Items representing comments in bitbake.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             realraw: str,
             new_style_override_syntax: bool = False) -> None

constructor

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • rawtext str - Raw input string (except inline code blocks)
  • realraw str - Unprocessed input

Arguments:

  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})

get_items

def get_items() -> List[str]

Get single lines of block

Returns:

  • list - single lines of comment block

Include Objects

class Include(Item)

Items that representing include/require statements.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             incname: str,
             statement: str,
             realraw: str,
             new_style_override_syntax: bool = False) -> None

constructor

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • rawtext str - Raw input string (except inline code blocks)
  • realraw str - Unprocessed input
  • incname str - raw name of the include file
  • statement str - either include or require

Arguments:

  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})

IncName

@property
def IncName() -> str

Include name

Returns:

  • str - name of the file to include/require

Statement

@property
def Statement() -> str

statement either include or require

Returns:

  • str - include or require

get_items

def get_items() -> Tuple[str, str]

Get items

Returns:

  • list - include name, include statement

Export Objects

class Export(Item)

Items representing export statements in bitbake.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             name: str,
             value: str,
             realraw: str,
             new_style_override_syntax: bool = False) -> None

constructor

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • rawtext str - Raw input string (except inline code blocks)
  • realraw str - Unprocessed input
  • 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

@property
def Name() -> str

Name of the exported var

Returns:

  • str - name of the exported var

Value

@property
def Value() -> str

value of the export

Returns:

  • str - optional value of the export

get_items

def get_items() -> Tuple[str, str]

Get items

Returns:

  • list - include name, include statement

Function Objects

class Function(Item)

Items representing task definitions in bitbake.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             name: str,
             body: str,
             realraw: str,
             python: bool = False,
             fakeroot: bool = False,
             new_style_override_syntax: bool = False) -> None

[summary]

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • rawtext str - Raw input string (except inline code blocks)
  • realraw str - Unprocessed input
  • name str - Raw function name
  • body str - Function body

Arguments:

  • python bool - python function according to parser (default: {False})
  • fakeroot bool - uses fakeroot (default: {False})
  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})

IsPython

@property
def IsPython() -> bool

Is python function

Returns:

  • bool - is a python function

IsFakeroot

@property
def IsFakeroot() -> bool

Is fakeroot function

Returns:

  • bool - is a python function

FuncName

@property
def FuncName() -> str

Function name

Returns:

  • str - name of function

FuncNameComplete

@property
def FuncNameComplete() -> str

Complete function name (including overrides)

Returns:

  • str - complete name of function

SubItem

@property
def SubItem() -> str

Function modifiers

Returns:

  • str - function modifiers like packages, machines, appends, prepends

SubItems

@property
def SubItems() -> List[str]

Function modifiers list

Returns:

  • list - function modifiers list like packages, machines, appends, prepends

FuncBody

@property
def FuncBody() -> str

Function body

Returns:

  • str - function body text

FuncBodyStripped

@property
def FuncBodyStripped() -> str

Stripped function body

Returns:

  • str - stripped function body text

FuncBodyRaw

@property
def FuncBodyRaw() -> str

Raw function body (including brackets)

Returns:

  • str - raw function body text

GetDistroEntry

def GetDistroEntry() -> str

Get distro specific modifiers

Returns:

  • str - distro specific modifier or ""

GetMachineEntry

def GetMachineEntry() -> str

Get machine specific modifiers

Returns:

  • str - machine specific modifier or ""

IsAppend

def IsAppend() -> bool

Return if function appends another function

Returns:

  • bool - True is append or prepend operation

get_items

def get_items() -> List[str]

Get items of function body

Returns:

  • list - single lines of function body

PythonBlock Objects

class PythonBlock(Item)

Items representing python functions in bitbake.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             name: str,
             realraw: str,
             new_style_override_syntax: bool = False) -> None

constructor

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • rawtext str - Raw input string (except inline code blocks)
  • realraw str - Unprocessed input
  • name str - Function name

Arguments:

  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})

FuncName

@property
def FuncName() -> str

Function name

Returns:

  • str - name of function

get_items

def get_items() -> List[str]

Get lines of function body

Returns:

  • list - lines of function body

FlagAssignment Objects

class FlagAssignment(Item)

Items representing flag assignments in bitbake.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             name: str,
             ident: str,
             value: str,
             varop: str,
             realraw: str,
             new_style_override_syntax: bool = False) -> None

constructor

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • rawtext str - Raw input string (except inline code blocks)
  • realraw str - Unprocessed input
  • name str - name of task to be modified
  • ident str - task flag
  • value str - value of modification
  • varop str - variable operation

Arguments:

  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})

VarName

@property
def VarName() -> str

Variable name

Returns:

  • str - name of variable

Flag

@property
def Flag() -> str

Flag name

Returns:

  • str - Flag name

VarOp

@property
def VarOp() -> str

Modifier operation

Returns:

  • str - used modifier in operation

Value

@property
def Value() -> str

Value

Returns:

  • str - value set

ValueStripped

@property
def ValueStripped() -> str

Value stripped of the quotes

Returns:

  • str - value set

get_items

def get_items() -> Tuple[str, str, str, str]

Get items

Returns:

  • list - variable name, flag, variable operation, modification value

FunctionExports Objects

class FunctionExports(Item)

Items representing EXPORT_FUNCTIONS in bitbake.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             name: str,
             realraw: str,
             new_style_override_syntax: bool = False) -> None

constructor

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • rawtext str - Raw input string (except inline code blocks)
  • realraw str - Unprocessed input
  • name str - name of function to be exported

Arguments:

  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})

FuncNames

@property
def FuncNames() -> str

Function name

Returns:

  • str - names of exported functions

get_items

def get_items() -> List[str]

Get items

Returns:

  • list - function names

get_items_unaliased

def get_items_unaliased() -> List[str]

Get items with their bbclass scope names

Returns:

  • list - function names in the scope of a bbclass (foo becomes classname-foo in this case)

TaskAdd Objects

class TaskAdd(Item)

Items representing addtask statements in bitbake.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             name: str,
             realraw: str,
             before: str = "",
             after: str = "",
             comment: str = "",
             new_style_override_syntax: bool = False) -> None

constructor

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • rawtext str - Raw input string (except inline code blocks)
  • realraw str - Unprocessed input
  • name str - name of task to be executed

Arguments:

  • before str - before statement (default: {""})
  • after str - after statement (default: {""})
  • comment str - optional comment (default: {""})
  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})

FuncName

@property
def FuncName() -> str

Function name

Returns:

  • str - name of function

Before

@property
def Before() -> List[str]

Tasks executed before

Returns:

  • list - tasks to be executed before

After

@property
def After() -> List[str]

Tasks executed after

Returns:

  • list - tasks to be executed after

Comment

@property
def Comment() -> str

Comment

Returns:

  • str - comment if any

get_items

def get_items() -> List[str]

get items

Returns:

  • list - function name, all before statements, all after statements

TaskDel Objects

class TaskDel(Item)

Items representing deltask statements in bitbake.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             name: str,
             comment: str,
             realraw: str,
             new_style_override_syntax: bool = False) -> None

constructor

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • rawtext str - Raw input string (except inline code blocks)
  • realraw str - Unprocessed input
  • name str - name of task to be executed
  • comment str - optional comment

Arguments:

  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})

FuncName

@property
def FuncName() -> str

Function name

Returns:

  • str - name of function

Comment

@property
def Comment() -> str

Comment

Returns:

  • str - comment if any

get_items

def get_items() -> List[str]

get items

Returns:

  • list - function name

MissingFile Objects

class MissingFile(Item)

Items representing missing files found while parsing.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             filename: str,
             statement: str,
             new_style_override_syntax: bool = False) -> None

constructor

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • filename str - filename of the file that can't be found
  • statement str - either include or require

Arguments:

  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})

Filename

@property
def Filename() -> str

Filename of the file missing

Returns:

  • str - filename that can't be resolved

Statement

@property
def Statement() -> str

statement either include or require

Returns:

  • str - include or require

TaskAssignment Objects

@deprecated(version='3.0.0', reason='TaskAssignment is now part of FlagAssignment class')
class TaskAssignment(Item)

Deprecated. Use FlagAssignment class instead.

FuncName

@property
def FuncName() -> str

Deprecated.

Use FlagAssignment class instead

Returns:

  • str - Empty string

VarValue

@property
def VarValue() -> str

Deprecated.

Use FlagAssignment class instead

Returns:

  • str - Empty string

VarName

@property
def VarName() -> str

Deprecated.

Use FlagAssignment class instead

Returns:

  • str - Empty string

get_items

def get_items() -> List

Deprecated.

Use FlagAssignment class instead

Returns:

  • list - Empty list

AddPylib Objects

class AddPylib(Item)

Items representing addpylib statements in bitbake.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             path: str,
             namespace: str,
             realraw: str,
             new_style_override_syntax: bool = False) -> None

constructor

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • rawtext str - Raw input string (except inline code blocks)
  • realraw str - Unprocessed input
  • path str - path to the namespace
  • namespace str - namespace name

Arguments:

  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})

Path

@property
def Path() -> str

Path of the library addition

Returns:

  • str - path of the library addition

Namespace

@property
def Namespace() -> str

Namespace of the addition

Returns:

  • str - Namespace of the addition

get_items

def get_items() -> Tuple[str, str]

Get items

Returns:

  • list - library path, library namespace

Inherit Objects

class Inherit(Item)

Items that representing inherit(_defer) statements.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             statement: str,
             classes: str,
             realraw: str,
             new_style_override_syntax: bool = False,
             inherit_file_paths: Set[str] = None) -> None

constructor

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • rawtext str - Raw input string (except inline code blocks)
  • realraw str - Unprocessed input
  • class str - class code to inherit
  • statement str - inherit statement (INHERIT, inherit or inherit_defer)

Arguments:

  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})
  • inherit_file_paths Set[str] - Paths of the identified inherited classes

Class

@property
def Class() -> str

Class(es) to inherit

Returns:

  • str - class(es) to inherit

Statement

@property
def Statement() -> str

inherit statement

Returns:

  • str - inherit or inherit_defer

FilePaths

@property
def FilePaths() -> Set[str]

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

Returns:

  • Set[str] - File paths to identified bbclasses

get_items

def get_items() -> List[str]

Get items

Returns:

  • list - parsed Class items

Unset Objects

class Unset(Item)

Items representing unset statements in bitbake.

__init__

def __init__(origin: str,
             line: int,
             infileline: int,
             rawtext: str,
             name: str,
             realraw: str,
             flag: str = "",
             new_style_override_syntax: bool = False) -> None

constructor

Arguments:

  • origin str - Full path to file of origin
  • line int - Overall line counter
  • infileline int - Line counter in the particular file
  • rawtext str - Raw input string (except inline code blocks)
  • realraw str - Unprocessed input
  • name str - name of variable to be unset

Arguments:

  • flag str - Flag to unset
  • new_style_override_syntax bool - Use ':' a override delimiter (default: {False})

VarName

@property
def VarName() -> str

Variable name

Returns:

  • str - name of the variable

Flag

@property
def Flag() -> str

Variable flag

Returns:

  • str - name of the variable flag

get_items

def get_items() -> List[str]

get items

Returns:

  • list - variable name, variable flag

oelint_parser.helper_files

get_files

@deprecated(version='3.0.0', reason='Use Stash.GetFiles instead')
def get_files(stash: Stash, *args, **kwargs)

Legacy interface get_files.

Use Stash.GetFiles instead.

Arguments:

  • stash Stash - Stash object

Returns:

  • Stash.GetFiles - .

get_layer_root

@deprecated(version='3.0.0', reason='Use Stash.GetLayerRoot instead')
def get_layer_root(*args, **kwargs)

Legacy interface get_layer_root

Use Stash.GetLayerRoot instead.

Returns:

  • Stash.GetLayerRoot - .

find_local_or_in_layer

@deprecated(version='3.0.0', reason='Use Stash.FindLocalOrLayer instead')
def find_local_or_in_layer(*args, **kwargs)

Legacy interface find_local_or_in_layer

Use Stash.FindLocalOrLayer instead.

Returns:

  • Stash.FindLocalOrLayer - .

get_scr_components

@deprecated(version='3.0.0', reason='Use Stash.GetScrComponents instead')
def get_scr_components(*args, **kwargs)

Legacy interface get_scr_components

Use Stash.GetScrComponents instead

Returns:

  • Stash.GetScrComponents - .

safe_linesplit

@deprecated(version='3.0.0', reason='Use Stash.SafeLineSplit instead')
def safe_linesplit(*args, **kwargs)

Legacy interface safe_linesplit

Use Stash.SafeLineSplit instead

Returns:

  • Stash.SafeLineSplit - .

guess_recipe_name

@deprecated(version='3.0.0', reason='Use Stash.GuessRecipeName instead')
def guess_recipe_name(*args, **kwargs)

Legacy interface guess_recipe_name

Use Stash.GuessRecipeName instead

Returns:

  • Stash.GuessBaseRecipeName - .

guess_base_recipe_name

@deprecated(version='3.0.0', reason='Use Stash.GuessBaseRecipeName instead')
def guess_base_recipe_name(*args, **kwargs)

Legacy interface guess_base_recipe_name

Use Stash.GuessBaseRecipeName instead

Returns:

  • Stash.GuessBaseRecipeName - .

guess_recipe_version

@deprecated(version='3.0.0', reason='Use Stash.GuessRecipeVersion instead')
def guess_recipe_version(*args, **kwargs)

Legacy interface guess_recipe_version

Use Stash.GuessRecipeVersion instead

Returns:

  • Stash.GuessRecipeVersion - .

expand_term

@deprecated(version='3.0.0', reason='Use Stash.ExpandTerm instead')
def expand_term(stash: Stash, *args, **kwargs)

Legacy interface expand_term

Use Stash.ExpandTerm instead

Arguments:

  • stash Stash - Stash object

Returns:

  • Stash.ExpandTerm - .

get_valid_package_names

@deprecated(version='3.0.0', reason='Use Stash.GetValidPackageNames instead')
def get_valid_package_names(stash: Stash, *args, **kwargs)

Legacy interface get_valid_package_names

Use Stash.GetValidPackageNames instead

Arguments:

  • stash Stash - Stash object

Returns:

  • Stash.GetValidPackageNames - .

get_valid_named_resources

@deprecated(version='3.0.0', reason='Use Stash.GetValidNamedResources instead')
def get_valid_named_resources(stash: Stash, *args, **kwargs)

Legacy interface get_valid_named_resources

Use Stash.GetValidNamedResources instead

Arguments:

  • stash Stash - Stash object

Returns:

  • Stash.GetValidNamedResources - .

is_image

@deprecated(version='3.0.0', reason='Use Stash.IsImage instead')
def is_image(stash: Stash, *args, **kwargs)

Legacy interface is_image

Use Stash.IsImage instead

Arguments:

  • stash Stash - Stash object

Returns:

  • Stash.IsImage - .

is_packagegroup

@deprecated(version='3.0.0', reason='Use Stash.IsPackageGroup instead')
def is_packagegroup(stash: Stash, *args, **kwargs)

Legacy interface is_packagegroup

Use Stash.IsPackageGroup instead

Arguments:

  • stash Stash - Stash object

Returns:

  • Stash.IsPackageGroup - .

oelint_parser.rpl_regex

RegexRpl Objects

class RegexRpl()

Safe regex replacements

search

@staticmethod
def search(pattern: str,
           string: str,
           timeout: int = 5,
           default: object = None,
           **kwargs) -> Union[Match, None]

replacement for re.search

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:

  • Match - Match object or None

split

@staticmethod
def split(pattern: str,
          string: str,
          timeout: int = 5,
          default: object = None,
          **kwargs) -> 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.

Returns:

  • list - list object or None

match

@staticmethod
def match(pattern: str,
          string: str,
          timeout: int = 5,
          default: object = None,
          **kwargs) -> Union[Match, None]

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:

  • Match - Match object or None

sub

@staticmethod
def sub(pattern: str,
        repl: str,
        string: str,
        timeout: int = 5,
        default: str = '',
        **kwargs) -> 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 ''.

Returns:

  • str - string

finditer

@staticmethod
def finditer(pattern: str,
             string: str,
             timeout: int = 5,
             default: object = None,
             **kwargs) -> Scanner

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:

  • Scanner - Scanner object or None

oelint_parser.constants

Constants Objects

class Constants()

Interface for constants

GetByPath

def GetByPath(path: str) -> Union[Dict, List]

Get constant from path

Arguments:

  • path str - / joined path in the constant structure

Returns:

Union[Dict, List]: Item in structure or empty dictionary

AddConstants

def AddConstants(_dict: dict) -> None

Add constants to the existing

Arguments:

  • dict dict - constant dictionary to add

RemoveConstants

def RemoveConstants(_dict: dict) -> None

Remove constants from the existing

Arguments:

  • dict dict - constant dictionary to remove

OverrideConstants

def OverrideConstants(_dict: dict) -> None

Override constants in the existing db

Arguments:

  • dict dict] - constant dictionary with override values

FunctionsKnown

@property
def FunctionsKnown() -> List[str]

Return known functions

Returns:

  • list - list of known functions

FunctionsOrder

@property
def FunctionsOrder() -> List[str]

Return function order

Returns:

  • list - List of functions to order in their designated order

VariablesMandatory

@property
def VariablesMandatory() -> List[str]

Return mandatory variables

Returns:

  • list - List of mandatory variables

VariablesSuggested

@property
def VariablesSuggested() -> List[str]

Return suggested variables

Returns:

  • list - List of suggested variables

MirrorsKnown

@property
def MirrorsKnown() -> Dict[str, str]

Return known mirrors and their replacements

Returns:

  • dict - Dict of known mirrors and their replacements

VariablesProtected

@property
def VariablesProtected() -> List[str]

Return protected variables

Returns:

  • list - List of protected variables

VariablesProtectedAppend

@property
def VariablesProtectedAppend() -> List[str]

Return protected variables in bbappend files

Returns:

  • list - List of protected variables in bbappend files

VariablesOrder

@property
def VariablesOrder() -> List[str]

Variable order

Returns:

  • list - List of variables to order in their designated order

VariablesKnown

@property
def VariablesKnown() -> List[str]

Known variables

Returns:

  • list - List of known variables

DistrosKnown

@property
def DistrosKnown() -> List[str]

Known distros

Returns:

  • list - List of known distros

MachinesKnown

@property
def MachinesKnown() -> List[str]

Known machines

Returns:

  • list - List of known machines

ImagesClasses

@property
def ImagesClasses() -> List[str]

Classes that are used in images

Returns:

  • list - Classes that are used in images

ImagesVariables

@property
def ImagesVariables() -> List[str]

Variables that are used in images

Returns:

  • list - Variables that are used in images

SetsBase

@property
def SetsBase() -> Dict[str, str]

Base variable set

Returns:

  • dict - dictionary with base variable set

oelint_parser.inlinerep

bb_utils_filter

def bb_utils_filter(_in: str, negative_clause: bool = False) -> str

bb.utils.filter emulation

Arguments:

  • _in str - Input string
  • negative_clause bool - return negative branch

Returns:

  • str - True argument of the conditional or None if not applicable

bb_utils_contains

def bb_utils_contains(_in: str, negative_clause: bool = False) -> str

bb.utils.contains emulation

Arguments:

  • _in str - Input string
  • negative_clause bool - return negative branch

Returns:

  • str - True argument of the conditional or None if not applicable

bb_utils_contains_any

def bb_utils_contains_any(_in: str, negative_clause: bool = False) -> str

bb.utils.contains_any emulation

Arguments:

  • _in str - Input string
  • negative_clause bool - return negative branch

Returns:

  • str - True argument of the conditional or None if not applicable

oe_utils_conditional

def oe_utils_conditional(_in: str, negative_clause: bool = False) -> str

oe.utils.conditional emulation

Arguments:

  • _in str - Input string
  • negative_clause bool - return negative branch

Returns:

  • str - True argument of the conditional or None if not applicable

oe_utils_ifelse

def oe_utils_ifelse(_in: str, negative_clause: bool = False) -> str

oe.utils.ifelse emulation

Arguments:

  • _in str - Input string
  • negative_clause bool - return negative branch

Returns:

  • str - True argument of the conditional or None if not applicable

oe_utils_any_distro_features

def oe_utils_any_distro_features(_in: str,
                                 negative_clause: bool = False) -> str

oe.utils.any_distro_features emulation

Arguments:

  • _in str - Input string
  • negative_clause bool - return negative branch

Returns:

  • str - True argument of the conditional or None if not applicable

oe_utils_all_distro_features

def oe_utils_all_distro_features(_in: str,
                                 negative_clause: bool = False) -> str

oe.utils.all_distro_features emulation

Arguments:

  • _in str - Input string
  • negative_clause bool - return negative branch

Returns:

  • str - True argument of the conditional or None if not applicable

oe_utils_vartrue

def oe_utils_vartrue(_in: str, negative_clause: bool = False) -> str

oe.utils.vartrue emulation

Arguments:

  • _in str - Input string
  • negative_clause bool - return negative branch

Returns:

  • str - True argument of the conditional or None if not applicable

oe_utils_less_or_equal

def oe_utils_less_or_equal(_in: str, negative_clause: bool = False) -> str

oe.utils.less_or_equal emulation

Arguments:

  • _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

def oe_utils_version_less_or_equal(_in: str,
                                   negative_clause: bool = False) -> str

oe.utils.version_less_or_equal emulation

Arguments:

  • _in str - Input string
  • negative_clause bool - return negative branch

Returns:

  • str - True argument of the conditional or None if not applicable

oe_utils_both_contain

def oe_utils_both_contain(_in: str, negative_clause: bool = False) -> str

oe.utils.both_contain emulation

Arguments:

  • _in str - Input string
  • negative_clause bool - return negative branch

Returns:

  • str - True argument of the conditional or None if not applicable

inlinerep

def inlinerep(_in: str, negative_clause: bool = False) -> str

Replaces inline code expressions

Arguments:

  • _in str - Input string
  • negative_clause bool - return negative branch

Returns:

  • str - Expanded string or None, if not applicable