- oelint_parser
- oelint_parser.const_vars
- oelint_parser.cls_stash
- oelint_parser.rpl_regex
- oelint_parser.const_func
- oelint_parser.inlinerep
- oelint_parser.helper_files
- oelint_parser.constants
- Constants
- AddConstants
- RemoveConstants
- OverrideConstants
- AddFromRuleFile
- AddFromConstantFile
- FunctionsKnown
- FunctionsOrder
- VariablesMandatory
- VariablesSuggested
- MirrorsKnown
- VariablesProtected
- VariablesProtectedAppend
- VariablesOrder
- VariablesKnown
- DistrosKnown
- MachinesKnown
- ImagesClasses
- ImagesVariables
- SetsBase
- Constants
- oelint_parser.cls_item
- oelint_parser.parser
def set_constantfile(obj)
set constants
Arguments:
obj
dict - dictionary with constants
def set_rulefile(obj)
set rules
Arguments:
obj
dict - dictionary with rule definitions
def get_mandatory_vars()
get mandatory variables
Returns:
list
- list of mandatory variable names
def get_suggested_vars()
get suggested variables
Returns:
list
- list of suggested variable names
def get_known_mirrors()
get known mirror replacements
Returns:
dict
- dictionary of known mirror replacements
def get_protected_vars()
get protected variables
Returns:
list
- list of protected variables
def get_protected_append_vars()
get protected variables in bbappends
Returns:
list
- list of protected variables
def get_known_vars()
get list of known variables
Returns:
list
- list of known variable names
def get_known_distros()
get known distros
Returns:
list
- list of known distro names
def get_known_machines()
get known machines
Returns:
list
- list of known machine names
def get_image_classes()
get known classes used exclusively in an image
Returns:
list
- list of known class names
def get_image_variables()
get known variables used exclusively in an image
Returns:
list
- list of known variable names
def get_base_varset()
get variable baseset Set includes basic package definitions
Returns:
dict
- base variable set
class Stash()
def __init__(quiet=False)
constructor
def AddFile(_file, lineOffset=0, forcedLink=None)
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}
def Append(item)
appends one or mote items to the stash
Arguments:
item
Item - Item(s) to append
def Remove(item)
removes one or more items from the stash
Arguments:
item
Item - Item(s) to remove
def GetRecipes()
Get bb files in stash
Returns:
list
- List of bb files in stash
def GetLoneAppends()
Get bbappend without a matching bb
Returns:
list
- list of bbappend without a matching bb
def GetLinksForFile(filename)
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
def GetItemsFor(filename=None,
classifier=None,
attribute=None,
attributeValue=None,
nolink=False)
Get items for filename
Arguments:
filename
str - Full path to file (default: {None})classifier
str - class specifier (e.g. Variable) (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:
[type]
- [description]
def ExpandVar(filename=None,
attribute=None,
attributeValue=None,
nolink=False)
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
class RegexRpl()
Safe regex replacements
@staticmethod
def search(pattern, string, timeout=5, default=None, *args, **kwargs)
replacement for re.search
Arguments:
pattern
str - regex patternstring
str - input stringtimeout
int, optional - Timeout for operation. On timeoutdefault
will be returned. Defaults to 5.default
type, optional - Default to return on timeout. Defaults to None.
Returns:
Match
- Match object or None
@staticmethod
def split(pattern, string, timeout=5, default=None, *args, **kwargs)
replacement for re.split
Arguments:
pattern
str - regex patternstring
str - input stringtimeout
int, optional - Timeout for operation. On timeoutdefault
will be returned. Defaults to 5.default
type, optional - Default to return on timeout. Defaults to None.
Returns:
list
- list object or None
@staticmethod
def match(pattern, string, timeout=5, default=None, *args, **kwargs)
replacement for re.match
Arguments:
pattern
str - regex patternstring
str - input stringtimeout
int, optional - Timeout for operation. On timeoutdefault
will be returned. Defaults to 5.default
type, optional - Default to return on timeout. Defaults to None.
Returns:
Match
- Match object or None
@staticmethod
def sub(pattern, repl, string, timeout=5, default='', *args, **kwargs)
replacement for re.sub
Arguments:
pattern
str - regex patternrepl
str - replacement stringstring
str - input stringtimeout
int, optional - Timeout for operation. On timeoutdefault
will be returned. Defaults to 5.default
type, optional - Default to return on timeout. Defaults to ''.
Returns:
str
- string
@staticmethod
def finditer(pattern, string, timeout=5, default=None, *args, **kwargs)
replacement for re.finditer
Arguments:
pattern
str - regex patternstring
str - input stringtimeout
int, optional - Timeout for operation. On timeoutdefault
will be returned. Defaults to 5.default
type, optional - Default to return on timeout. Defaults to None.
Returns:
Scanner
- Scanner object or None
def get_files(stash, _file, pattern)
Get files matching SRC_URI entries
Arguments:
stash
oelint_parser.cls_stash.Stash - current stash_file
str - Full path to filenamepattern
str - glob pattern to apply
Returns:
list
- list of files matching pattern
def get_layer_root(name)
Find the path to the layer root of a file
Arguments:
name
str - filename
Returns:
str
- path to layer root or empty string
def find_local_or_in_layer(name, localdir)
Find file in local dir or in layer
Arguments:
name
str - filenamelocaldir
str - path to local dir
Returns:
str
- path to found file or None
def get_scr_components(string)
Return SRC_URI components
Arguments:
string
str - raw string
Returns:
dict
- scheme: protocol used, src: source URI, options: parsed options
def safe_linesplit(string)
Split line in a safe manner
Arguments:
string
str - raw input
Returns:
list
- safely split input
def guess_recipe_name(_file)
Get the recipe name from filename
Arguments:
_file
str - filename
Returns:
str
- recipe name
def guess_base_recipe_name(_file)
Get the base recipe name from filename (aka BPN)
Arguments:
_file
str - filename
Returns:
str
- recipe name
def guess_recipe_version(_file)
Get recipe version from filename
Arguments:
_file
str - filename
Returns:
str
- recipe version
def expand_term(stash, _file, value, spare=None, seen=None)
Expand a variable (replacing all variables by known content)
Arguments:
stash
oelint_parser.cls_stash.Stash - current stash_file
str - Full path to filevalue
str - Variable value to expand
Returns:
str
- expanded value
def get_valid_package_names(stash, _file, strippn=False)
Get known valid names for packages
Arguments:
stash
oelint_parser.cls_stash.Stash - current stash_file
str - Full path to file
Returns:
list
- list of valid package names
def get_valid_named_resources(stash, _file)
Get list of valid SRCREV resource names
Arguments:
stash
oelint_parser.cls_stash.Stash - current stash_file
str - Full path to file
Returns:
list
- list of valid SRCREV resource names
def is_image(stash, _file)
returns if the file is likely an image recipe or not
Arguments:
stash
oelint_parser.cls_stash.Stash - current stash_file
str - Full path to file
Returns:
bool
- True if _file is an image recipe
def is_packagegroup(stash, _file)
returns if the file is likely a packagegroup recipe or not
Arguments:
stash
oelint_parser.cls_stash.Stash - current stash_file
str - Full path to file
Returns:
bool
- True if _file is a packagegroup recipe
class Constants()
Interface for constants
def AddConstants(_dict)
Add constants to the existing
Arguments:
dict
dict - constant dictionary to add
def RemoveConstants(_dict)
Remove constants from the existing
Arguments:
dict
dict - constant dictionary to remove
def OverrideConstants(_dict)
Override constants in the existing db
Arguments:
dict
dict] - constant dictionary with override values
def AddFromRuleFile(_dict)
Legacy interface to support rule files
Arguments:
dict
dict - rule file dictionary
def AddFromConstantFile(_dict)
Legacy interface to support constant files
Arguments:
dict
dict - constant file dictionary
@property
def FunctionsKnown()
Return known functions
Returns:
list
- list of known functions
@property
def FunctionsOrder()
Return function order
Returns:
list
- List of functions to order in their designated order
@property
def VariablesMandatory()
Return mandatory variables
Returns:
list
- List of mandatory variables
@property
def VariablesSuggested()
Return suggested variables
Returns:
list
- List of suggested variables
@property
def MirrorsKnown()
Return known mirrors and their replacements
Returns:
dict
- Dict of known mirrors and their replacements
@property
def VariablesProtected()
Return protected variables
Returns:
list
- List of protected variables
@property
def VariablesProtectedAppend()
Return protected variables in bbappend files
Returns:
list
- List of protected variables in bbappend files
@property
def VariablesOrder()
Variable order
Returns:
list
- List of variables to order in their designated order
@property
def VariablesKnown()
Known variables
Returns:
list
- List of known variables
@property
def DistrosKnown()
Known distros
Returns:
list
- List of known distros
@property
def MachinesKnown()
Known machines
Returns:
list
- List of known machines
@property
def ImagesClasses()
Classes that are used in images
Returns:
list
- Classes that are used in images
@property
def ImagesVariables()
Variables that are used in images
Returns:
list
- Variables that are used in images
@property
def SetsBase()
Base variable set
Returns:
dict
- dictionary with base variable set
class Item()
Base class for all Stash items
def __init__(origin, line, infileline, rawtext, realraw)
constructor
Arguments:
origin
str - Full path of origin fileline
int - Overall line counterinfileline
int - Line number in filerawtext
str - Raw input string (except inline code blocks)realraw
str - Unprocessed input
@property
def Line()
Overall line count
Returns:
int
- overall line count of item
@property
def Raw()
Raw string (without inline code blocks)
Returns:
str
- raw string of item
@property
def Links()
Linked files
Returns:
list
- list of full path of linked files
@property
def Origin()
origin of item
Returns:
str
- full path of origin file
@property
def InFileLine()
Line count in file
Returns:
int
- [description]
@property
def IncludedFrom()
Files include this item
Returns:
list
- list of files including this item
@property
def RealRaw()
Completely unprocessed raw text
Returns:
str
- completely unprocessed raw text
@property
def IsFromClass()
Item comes from a bbclass
Returns:
bool
- if item was set in a bbclass
@property
def OverrideDelimiter()
Override delimiter
Returns:
str
- Override delimiter
@staticmethod
def safe_linesplit(string)
Safely split an input line to chunks
Arguments:
string
str - raw input string
Returns:
list
- list of chunks of original string
def get_items()
Return single items
Returns:
list
- lines of raw input
def extract_sub(name)
Extract modifiers
Arguments:
name
str - input string
Returns:
tuple
- clean variable name, modifiers, package specific modifiers
def extract_sub_func(name)
Extract modifiers for functions
Arguments:
name
str - input value
Returns:
tuple
- clean function name, modifiers
def IsFromAppend()
Item originates from a bbappend
Returns:
bool
- True if coming from a bbappend
def AddLink(_file)
Links files to each other in stash
Arguments:
_file
str - Full path of file to link against
def GetAttributes()
Get all public attributes of this class
Returns:
dict
- all public attributes and their values
class Variable(Item)
Stash item for variables
def __init__(origin, line, infileline, rawtext, name, value, operator, flag,
realraw)
constructor
Arguments:
origin
str - Full path to file of originline
int - Overall line counterinfileline
int - Line counter in the particular filerawtext
str - Raw input string (except inline code blocks)realraw
str - Unprocessed inputname
str - Variable namevalue
str - Variable valueoperator
str - Operation performed to the variableflag
str - Optional variable flag
@property
def VarName()
Variable name
Returns:
str
- name of variable
@property
def SubItem()
Variable modifiers
Returns:
str
- variable modifiers like packages, machines, appends, prepends
@property
def SubItems()
Variable modifiers list
Returns:
list
- variable modifiers list like packages, machines, appends, prepends
@property
def VarValue()
variable value
Returns:
str
- unstripped variable value
@property
def VarOp()
Variable operation
Returns:
str
- operation did on the variable
@property
def Flag()
Variable flag like PACKAGECONFIG[xyz]
Returns:
str
- variable sub flags
@property
def VarNameComplete()
Complete variable name included overrides and flags
Returns:
str
- complete variable name
@property
def RawVarName()
Variable name and flags combined
Returns:
str
- raw representation of the variable name
@property
def VarValueStripped()
Stripped variable value
Returns:
str
- stripped version of variable value
def IsAppend()
Check if operation is an append
Returns:
bool
- True is variable is appended
def AppendOperation()
Get variable modifiers
Returns:
list
- list could contain any combination of 'append', ' += ', 'prepend' and 'remove'
def get_items(override="", versioned=False)
Get items of variable value
Arguments:
override
str - String to take instead of VarValueversioned
bool - items can be versioned (versions will be stripped in this case)
Returns:
list
- clean list of items in variable value
def IsMultiLine()
Check if variable has a multiline assignment
Returns:
bool
- True if multiline
def GetDistroEntry()
Get distro specific entries in variable
Returns:
str
- distro specific modifier of variable or ""
def GetMachineEntry()
Get machine specific entries in variable
Returns:
str
- machine specific modifier of variable or ""
def GetClassOverride()
Get class specific entries in variable
Returns:
str
- class specific modifier of variable or ""
class Comment(Item)
def __init__(origin, line, infileline, rawtext, realraw)
constructor
Arguments:
origin
str - Full path to file of originline
int - Overall line counterinfileline
int - Line counter in the particular filerawtext
str - Raw input string (except inline code blocks)realraw
str - Unprocessed input
def get_items()
Get single lines of block
Returns:
list
- single lines of comment block
class Include(Item)
def __init__(origin, line, infileline, rawtext, incname, statement, realraw)
constructor
Arguments:
origin
str - Full path to file of originline
int - Overall line counterinfileline
int - Line counter in the particular filerawtext
str - Raw input string (except inline code blocks)realraw
str - Unprocessed inputincname
str - raw name of the include filestatement
str - either include or require
@property
def IncName()
Include name
Returns:
str
- name of the file to include/require
@property
def Statement()
statement either include or require
Returns:
str
- include or require
def get_items()
Get items
Returns:
list
- include name, include statement
class Export(Item)
def __init__(origin, line, infileline, rawtext, name, value, realraw)
constructor
Arguments:
origin
str - Full path to file of originline
int - Overall line counterinfileline
int - Line counter in the particular filerawtext
str - Raw input string (except inline code blocks)realraw
str - Unprocessed inputname
str - variable name of the exportvalue
str - (optional) value of the export
@property
def Name()
Name of the exported var
Returns:
str
- name of the exported var
@property
def Value()
value of the export
Returns:
str
- optional value of the export
def get_items()
Get items
Returns:
list
- include name, include statement
class Function(Item)
def __init__(origin,
line,
infileline,
rawtext,
name,
body,
realraw,
python=False,
fakeroot=False)
[summary]
Arguments:
origin
str - Full path to file of originline
int - Overall line counterinfileline
int - Line counter in the particular filerawtext
str - Raw input string (except inline code blocks)realraw
str - Unprocessed inputname
str - Raw function namebody
str - Function body
Arguments:
python
bool - python function according to parser (default: {False})fakeroot
bool - uses fakeroot (default: {False})
@property
def IsPython()
Is python function
Returns:
bool
- is a python function
@property
def IsFakeroot()
Is fakeroot function
Returns:
bool
- is a python function
@property
def FuncName()
Function name
Returns:
str
- name of function
@property
def FuncNameComplete()
Complete function name (including overrides)
Returns:
str
- complete name of function
@property
def SubItem()
Function modifiers
Returns:
str
- function modifiers like packages, machines, appends, prepends
@property
def SubItems()
Function modifiers list
Returns:
list
- function modifiers list like packages, machines, appends, prepends
@property
def FuncBody()
Function body
Returns:
str
- function body text
@property
def FuncBodyStripped()
Stripped function body
Returns:
str
- stripped function body text
@property
def FuncBodyRaw()
Raw function body (including brackets)
Returns:
str
- raw function body text
def GetDistroEntry()
Get distro specific modifiers
Returns:
str
- distro specific modifier or ""
def GetMachineEntry()
Get machine specific modifiers
Returns:
str
- machine specific modifier or ""
def IsAppend()
Return if function appends another function
Returns:
bool
- True is append or prepend operation
def get_items()
Get items of function body
Returns:
list
- single lines of function body
class PythonBlock(Item)
def __init__(origin, line, infileline, rawtext, name, realraw)
constructor
Arguments:
origin
str - Full path to file of originline
int - Overall line counterinfileline
int - Line counter in the particular filerawtext
str - Raw input string (except inline code blocks)realraw
str - Unprocessed inputname
str - Function name
@property
def FuncName()
Function name
Returns:
str
- name of function
def get_items()
Get lines of function body
Returns:
list
- lines of function body
class TaskAssignment(Item)
def __init__(origin, line, infileline, rawtext, name, ident, value, realraw)
constructor
Arguments:
origin
str - Full path to file of originline
int - Overall line counterinfileline
int - Line counter in the particular filerawtext
str - Raw input string (except inline code blocks)realraw
str - Unprocessed inputname
str - name of task to be modifiedident
str - task flagvalue
str - value of modification
@property
def FuncName()
Function name
Returns:
str
- name of function
@property
def VarValue()
Task flag value
Returns:
str
- Task flag value
@property
def VarName()
Task flag name
Returns:
str
- name of task flag
def get_items()
Get items
Returns:
list
- function name, flag, modification value
class FunctionExports(Item)
def __init__(origin, line, infileline, rawtext, name, realraw)
constructor
Arguments:
origin
str - Full path to file of originline
int - Overall line counterinfileline
int - Line counter in the particular filerawtext
str - Raw input string (except inline code blocks)realraw
str - Unprocessed inputname
str - name of function to be exported
@property
def FuncNames()
Function name
Returns:
str
- names of exported functions
def get_items()
Get items
Returns:
list
- function names
def get_items_unaliased()
Get items with their bbclass scope names
Returns:
list
- function names in the scope of a bbclass (foo becomes classname-foo in this case)
class TaskAdd(Item)
def __init__(origin,
line,
infileline,
rawtext,
name,
realraw,
before="",
after="")
constructor
Arguments:
origin
str - Full path to file of originline
int - Overall line counterinfileline
int - Line counter in the particular filerawtext
str - Raw input string (except inline code blocks)realraw
str - Unprocessed inputname
str - name of task to be executed
Arguments:
before
str - before statement (default: {""})after
str - after statement (default: {""})
@property
def FuncName()
Function name
Returns:
str
- name of function
@property
def Before()
Tasks executed before
Returns:
list
- tasks to be executed before
@property
def After()
Tasks executed after
Returns:
list
- tasks to be executed after
def get_items()
get items
Returns:
list
- function name, all before statements, all after statements
class MissingFile(Item)
def __init__(origin, line, infileline, filename, statement)
constructor
Arguments:
origin
str - Full path to file of originline
int - Overall line counterinfileline
int - Line counter in the particular filefilename
str - filename of the file that can't be foundstatement
str - either include or require
@property
def Filename()
Filename of the file missing
Returns:
str
- filename that can't be resolved
@property
def Statement()
statement either include or require
Returns:
str
- include or require
def get_full_scope(_string, offset, _sstart, _send)
get full block of an inline statement
Arguments:
_string
str - input stringoffset
int - offset in string_sstart
int - block start index_send
int - block end index
Returns:
str
- full block on inline statement
def prepare_lines_subparser(_iter, lineOffset, num, line, raw_line=None)
preprocess raw input
Arguments:
_iter
interator - line interator objectlineOffset
int - current line indexnum
int - internal line counterline
int - input stringraw_line
string, optional - internal line representation. Defaults to None.
Returns:
list
- list of preproccessed chunks
def prepare_lines(_file, lineOffset=0)
break raw file input into preprocessed chunks
Arguments:
_file
string - Full path to filelineOffset
int, optional - line offset counter. Defaults to 0.
Returns:
list
- preprocessed list of chunks
def get_items(stash, _file, lineOffset=0)
parses file
Arguments:
stash
oelint_parser.cls_stash.Stash - Stash object_file
string - Full path to filelineOffset
int, optional - line offset counter. Defaults to 0.
Returns:
list
- List of oelint_parser.cls_item.* representations