ref-manual: added new section library-functions
PATCH v2 1/1 ref-manual: added new section library-functions
A number of functions in lib/bb/utils.py are used throughout the meta*/ recipe and bbclass files. Unfortunately the methods for the class are not documented.
Added a new "library functions" section to the manual in the reference manual in the yocto-docs repository and document the utils functions to start with.
See Yocto Bug [#9612] for the details.
--- documentation/ref-manual/index.rst | 1 + documentation/ref-manual/library-functions.rst | 467 +++++++++++++++++++++++++ 2 files changed, 468 insertions(+) create mode 100644 documentation/ref-manual/library-functions.rst
documentation/ref-manual/index.rst +1 -0
@@ -17,6 +17,7 @@ Yocto Project Reference Manual structure classes tasks + library-functions devtool-reference kickstart qa-checks
documentation/ref-manual/library-functions.rst new file +467 -0
467 lines not on this page · raw message
Signature · 1 line
2.7.4
Add: [email protected]
and ping since Milan asked about this in:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=9612
../Randy
Quoted 502 lines · Milan Shah
Added a new "library functions" section to the manual in the reference manual in the yocto-docs repository and document the utils functions to start with.
See Yocto Bug [#9612] for the details.
Signed-off-by Milan Shah <[email protected]>--- documentation/ref-manual/index.rst | 1 + documentation/ref-manual/library-functions.rst | 467 +++++++++++++++++++++++++ 2 files changed, 468 insertions(+)create mode 100644
documentation/ref-manual/library-functions.rstdocumentation/ref-manual/index.rst +1
-0@@ -17,6 +17,7 @@ Yocto Project Reference Manual structure classes tasks + library-functions devtool-reference kickstart qa-checksdocumentation/ref-manual/library-functions.rst new file +467
-0@@ -0,0 +1,467 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +***************** +Library Functions +***************** + +utils functions +=============== + +The Bitbake Utility Functions ``utils.py`` provides some useful python +functions that are typically used in ``meta/classes/utils.bbclass``. + +See :ref:`ref-manual/migration-1.6:Python Definition substitutions` for the +reference of some python definitions. + +``approved_variables`` +---------------------- + +Determine and return the list of whitelisted variables which are approved to +remain in the environment. + +``better_compile`` +------------------ + +A better compile method. This method will print the offending lines. + +``better_exec`` +--------------- + +Similiar to ``better_compile``, ``better_exec`` will print the lines that are +responsible for the error. + +``break_hardlinks`` +------------------- + +Ensures ``src`` is the only hardlink to this file. Other hardlinks, if any, +are not affected (other than in their st_nlink value, of course). + +Returns `true` on success and `false` on failure. + +``build_environment`` +--------------------- + +Build an environment from all exported variables. + +``clean_environment`` +--------------------- + +Clean up any spurious environment variables. This will remove any variables +the user has not chosen to preserve. + +``contains`` +------------ + +Check if a variable contains all the values specified. + +:: + + Arguments: + + `variable` -- the variable name. This will be fetched and expanded + (using d.getVar(variable)) and then split into a set. + + `checkvalues` -- if this is a string it is split on whitespace into a + set, otherwise coerced directly into a set. + + `truevalue` -- the value to return if checkvalues is a subset of variable. + + `falsevalue` -- the value to return if variable is empty or if checkvalues + is not a subset of variable. + + `d` -- the data store. + +See the occurrence in :term:`TUNE_ASARGS`, :term:`TUNE_LDARGS`, +:ref:`image_types.bbclass <ref-classes-image_types>`, and +:ref:`migration-1.8-bluez` sections. + +``contains_any`` +---------------- + +Check if a variable contains any values specified. + +:: + + Arguments: + + `variable` -- the variable name. This will be fetched and expanded + (using d.getVar(variable)) and then split into a set. + + `checkvalues` -- if this is a string it is split on whitespace into a + set, otherwise coerced directly into a set. + + `truevalue` -- the value to return if checkvalues is a subset of variable. + + `falsevalue` -- the value to return if variable is empty or if checkvalues + is not a subset of variable. + + `d` -- the data store. + +See the occurrence in :ref:`image_types.bbclass <ref-classes-image_types>` +section. + +``copyfile`` +------------ + +Copies a file from src to dest, preserving all permissions and attributes; +mtime will be preserved even when moving across filesystems. + +Returns `true` on success and `false` on failure. + +``edit_bblayers_conf`` +---------------------- + +Edit ``bblayers.conf``, adding and/or removing layers + +:: + + Parameters: + + `bblayers_conf` -- path to bblayers.conf file to edit + + `add` -- layer path (or list of layer paths) to add; None or empty list + to add nothing + + `remove` -- layer path (or list of layer paths) to remove; None or + empty list to remove nothing + + `edit_cb` -- optional callback function that will be called after + processing adds/removes once per existing entry. + + Returns a tuple: + + `notadded` -- list of layers specified to be added but were not + (because they were already in the list) + + `notremoved` -- list of layers that were specified to be removed but + were not (because they were not in the list) + +``edit_metadata`` +----------------- + +Edit lines from a recipe or config file and modify one or more specified +variable values set in the file using a specified callback function. +Lines are expected to have trailing newlines. + +:: + + Parameters: + + `meta_lines` -- lines from the file; can be a list or an iterable + (e.g. file pointer) + + `variables` -- a list of variable names to look for. + Functions may also be specified, but must be specified with '()' + at the end of the name. Note that the function does not have any intrinsic + understanding of _append, _prepend, _remove, or overrides, + so these are considered as part of the name. These values go into + a regular expression, so regular expression syntax is allowed. + + `varfunc` -- callback function called for every variable matching + one of the entries in the variables parameter. + + The function should take four arguments: + + `varname` -- name of variable matched + + `origvalue` -- current value in file + + `op` -- the operator (e.g. '+-') + + `newlines` -- list of lines up to this point. + You can use this to prepend lines before this variable setting + if you wish. + + and should return a four-element tuple: + + `newvalue` -- new value to substitute in, or None to drop the + variable setting entirely. (If the removal results in two + consecutive blank lines, one of the blank lines will also + dropped). + + `newop` -- the operator to use - if you specify None here, + the original operation will be used. + + `indent` -- number of spaces to indent multi-line entries, + or -1 to indent up to the level of the assignment and opening + quote, or a string to use as the indent. + + `minbreak` -- True to allow the first element of a multi-line + value to continue on the same line as the assignment, + False to indent before the first element. + + To clarify, if you wish not to change the value, then you would return + like this: return origvalue, None, 0, True + match_overrides: True to match items with _overrides on the end, + False otherwise + + Returns a tuple: + + `updated`: + True if changes were made, False otherwise. + `newlines`: + Lines after processing + +``edit_metadata_file`` +---------------------- + +Edit a recipe or config file and modify one or more specified variable values +set in the file using a specified callback function. The file is only written +to if the value(s) actually change. +This is basically the file version of ``edit_metadata``, see that function's +description for parameter/usage information. + +Returns `True` if the file was written to, `False` otherwise. + +``empty_environment`` +--------------------- + +Remove all variables from the environment. + +``exec_flat_python_func`` +------------------------- + +Execute a flat python function (defined with def funcname(args):...) + +``explode_deps`` +---------------- + +Take an RDEPENDS style string of format: +:: + + "DEPEND1 (optional version) DEPEND2 (optional version) ..." + +and return a list of dependencies. Version information is ignored. + +``explode_dep_versions`` +------------------------ + +Take an RDEPENDS style string of format: +:: + + "DEPEND1 (optional version) DEPEND2 (optional version) ..." + +skip null value and items appeared in dependancy string multiple times and +return a dictionary of dependencies and versions. + +``explode_dep_versions2`` +------------------------- + +Take an RDEPENDS style string of format: +:: + + "DEPEND1 (optional version) DEPEND2 (optional version) ..." + +and return a dictionary of dependencies and versions. + +``export_proxies`` +------------------ + +export common proxies variables from datastore to environment. + +``fileslocked`` +--------------- + +Context manager for locking and unlocking file locks. + +``filter`` +---------- + +Return all words in the variable that are present in the checkvalues. + +:: + + Arguments: + + `variable` -- the variable name. This will be fetched and expanded + (using d.getVar(variable)) and then split into a set. + + `checkvalues` -- if this is a string it is split on whitespace into a + set, otherwise coerced directly into a set. + + `d` -- the data store. + +``filter_environment`` +---------------------- + +Create a pristine environment for Bitbake. This will remove variables that are +not known and may influence the build in a negative way. + +``get_file_layer`` +------------------ + +Determine the collection (as defined by a layer's ``layer.conf`` file) +containing the specified file. + +``get_referenced_vars`` +----------------------- + +Return names of vars referenced in `start_expr` (recursively), +in quasi-BFS order (variables within the same level are ordered arbitrarily) + +``is_semver`` +------------- + +Is the version string following the semver semantic? + + https://semver.org/spec/v2.0.0.html + +``join_deps`` +------------- + +Take the result from ``explode_dep_versions`` and generate a dependency string. + +``lockfile`` +------------ + +Use the specified file as a lock file, return when the lock has been acquired. +Returns a variable to pass to ``unlockfile``. + +:: + + Parameters: + + `retry`: `True` to re-try locking if it fails, `False` otherwise + + `block`: `True` to block until the lock succeeds, `False` otherwise + +The `retry` and `block` parameters are kind of equivalent unless you consider +the possibility of sending a signal to the process to breakout - at which point +you want block-True rather than retry-True. + +``md5_file`` +------------ + +Return the hex string representation of the MD5 checksum of filename. + +``mkdirhier`` +------------- + +Create a directory like 'mkdir -p', but does not complain if directory already +exists like os.makedirs + +``movefile`` +------------ + +Moves a file from ``src`` to `dest`, preserving all permissions and attributes; +``mtime`` will be preserved even when moving across filesystems. + +Returns `true` on success and `false` on failure. Move is atomic. + +``preserved_envvars`` +--------------------- + +Variables which are taken from the environment and placed in the metadata. + +``preserved_envvars_exported`` +------------------------------ + +Variables which are taken from the environment and placed in and exported from +the metadata. + +``prunedir`` +------------ + +Delete everything reachable from the directory named in `'topdir'`. + +``prune_suffix`` +---------------- + +See if var ends with any of the suffixes listed and remove it if found . + +``remove`` +---------- + +Equivalent to rm -f ``xx`` or rm -rf ``xx``. + +``sha1_file`` +------------- + +Return the hex string representation of the SHA1 checksum of the filename. + +``sha256_file`` +--------------- + +Return the hex string representation of the 256-bit SHA checksum of filename. + +``sha384_file`` +--------------- + +Return the hex string representation of the SHA384 checksum of the filename. + +``sha512_file`` +--------------- + +Return the hex string representation of the SHA512 checksum of the filename. + +``signal_on_parent_exit`` +------------------------- + +Trigger signame to be sent when the parent process dies. + +``split_version`` +----------------- + +Split a version string into its constituent parts +(:term:`PE`, :term:`PV`, :term:`PR`). + +``to_boolean`` +-------------- + +Check input string and return boolean value True/False/None depending upon the +checks. + +``umask`` +--------- + +Context manager to set the umask to a specific mask, and restore it afterwards. + +``unlockfile`` +-------------- + +Unlock a file locked using ``lockfile``. + +``vercmp_string`` +----------------- + +Split version strings and compare them. + +``vercmp_string_op`` +-------------------- + +Compare two versions and check if the specified comparison operator matches +the result of the comparison. This function is fairly liberal about what +operators it will accept since there are a variety of styles depending on +the context. + +``VersionStringException`` +-------------------------- + +Exception raised when an invalid version specification is found. + +``which`` +--------- + +Locate `item` in the list of paths `path` (colon separated string like $PATH). +If `direction` is non-zero then the list is reversed. +If `history` is True then the list of candidates also returned as result, +history. +If `executable` is True then the candidate has to be an executable file, +otherwise the candidate simply has to exist. + +``_check_unsafe_delete_path`` +----------------------------- + +Basic safeguard against recursively deleting something we should not. +If it returns True, the caller should raise an exception with +an appropriate message. + +.. note:: + + This is NOT meant to be a security mechanism - + just a guard against silly mistakes with potentially disastrous results. + +``_print_trace`` +---------------- + +Print the Environment of a Text Body.
Signature · 2 lines
# Randy MacLeod # Wind River Linux
Hello All,
My Patch-v2 has not been reviewed yet. Looking forward to see some updates on it.
https://lists.yoctoproject.org/g/docs/message/903
https://bugzilla.yoctoproject.org/show_bug.cgi?id=9612
Thanks & Regards,
Milan Shah
<https://www.mvista.com/>
*Milan Shah* * | Software Engineer*
*a: * MontaVista Software, LLC | Bangalore, India
*e:* [email protected] | *w:* www.mvista.com/
*p:* +91-80-4939-5000
Quoted 581 lines · Randy MacLeod
Add: [email protected]
and ping since Milan asked about this in:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=9612../Randy
Quoted 1 line · Milan Shah
Added a new "library functions" section to the manual in the reference
manual
Quoted 1 line
in the yocto-docs repository and document the utils functions to start
with.
Quoted 7 lines
See Yocto Bug [#9612] for the details.
Signed-off-by Milan Shah <[email protected]>--- documentation/ref-manual/index.rst | 1 + documentation/ref-manual/library-functions.rst | 467+++++++++++++++++++++++++
Review
Quoted 4 lines
2 files changed, 468 insertions(+)create mode 100644
documentation/ref-manual/library-functions.rst(quoted diff) +0
-0
b/documentation/ref-manual/index.rstReview
Quoted 12 lines
index deb0383..e351142 100644
documentation/ref-manual/index.rst +1
-0@@ -17,6 +17,7 @@ Yocto Project Reference Manual structure classes tasks + library-functions devtool-reference kickstart qa-checks(quoted diff) +0
-0
b/documentation/ref-manual/library-functions.rstQuoted 8 lines
new file mode 100644
index 0000000..55c8339documentation/ref-manual/library-functions.rst new file +3
-0@@ -0,0 +1,467 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +*****************documentation/ref-manual/library-functions.rst line 13
Quoted 10 lines
documentation/ref-manual/library-functions.rst new file +10
-0+Library Functions +***************** + +utils functions +=============== + +The Bitbake Utility Functions ``utils.py`` provides some useful python +functions that are typically used in ``meta/classes/utils.bbclass``. + +See :ref:`ref-manual/migration-1.6:Python Definition substitutions` forthe
documentation/ref-manual/library-functions.rst
Quoted 6 lines
documentation/ref-manual/library-functions.rst new file +6
-0+reference of some python definitions. + +``approved_variables`` +---------------------- + +Determine and return the list of whitelisted variables which areapproved to
documentation/ref-manual/library-functions.rst
Quoted 11 lines
documentation/ref-manual/library-functions.rst new file +11
-0+remain in the environment. + +``better_compile`` +------------------ + +A better compile method. This method will print the offending lines. + +``better_exec`` +--------------- + +Similiar to ``better_compile``, ``better_exec`` will print the linesthat are
documentation/ref-manual/library-functions.rst
Quoted 6 lines
documentation/ref-manual/library-functions.rst new file +6
-0+responsible for the error. + +``break_hardlinks`` +------------------- + +Ensures ``src`` is the only hardlink to this file. Other hardlinks, ifany,
documentation/ref-manual/library-functions.rst
Quoted 13 lines
documentation/ref-manual/library-functions.rst new file +13
-0+are not affected (other than in their st_nlink value, of course). + +Returns `true` on success and `false` on failure. + +``build_environment`` +--------------------- + +Build an environment from all exported variables. + +``clean_environment`` +--------------------- + +Clean up any spurious environment variables. This will remove anyvariables
documentation/ref-manual/library-functions.rst
Quoted 12 lines
documentation/ref-manual/library-functions.rst new file +12
-0+the user has not chosen to preserve. + +``contains`` +------------ + +Check if a variable contains all the values specified. + +:: + + Arguments: + + `variable` -- the variable name. This will be fetched andexpanded
documentation/ref-manual/library-functions.rst
Quoted 3 lines
documentation/ref-manual/library-functions.rst new file +3
-0+ (using d.getVar(variable)) and then split into a set. + + `checkvalues` -- if this is a string it is split on whitespaceinto a
documentation/ref-manual/library-functions.rst
Quoted 3 lines
documentation/ref-manual/library-functions.rst new file +3
-0+ set, otherwise coerced directly into a set. + + `truevalue` -- the value to return if checkvalues is a subsetof variable.
documentation/ref-manual/library-functions.rst line 69
Quoted 2 lines
documentation/ref-manual/library-functions.rst new file +2
-0+ + `falsevalue` -- the value to return if variable is empty or ifcheckvalues
Quoted 8 lines
documentation/ref-manual/library-functions.rst new file +8
-0+ is not a subset of variable. + + `d` -- the data store. + +See the occurrence in :term:`TUNE_ASARGS`, :term:`TUNE_LDARGS`, +:ref:`image_types.bbclass <ref-classes-image_types>`, and +:ref:`migration-1.8-bluez` sections. +documentation/ref-manual/library-functions.rst
Quoted 10 lines
documentation/ref-manual/library-functions.rst new file +10
-0+``contains_any`` +---------------- + +Check if a variable contains any values specified. + +:: + + Arguments: + + `variable` -- the variable name. This will be fetched andexpanded
documentation/ref-manual/library-functions.rst
Quoted 3 lines
documentation/ref-manual/library-functions.rst new file +3
-0+ (using d.getVar(variable)) and then split into a set. + + `checkvalues` -- if this is a string it is split on whitespaceinto a
documentation/ref-manual/library-functions.rst
Quoted 3 lines
documentation/ref-manual/library-functions.rst new file +3
-0+ set, otherwise coerced directly into a set. + + `truevalue` -- the value to return if checkvalues is a subsetof variable.
documentation/ref-manual/library-functions.rst line 95
Quoted 2 lines
documentation/ref-manual/library-functions.rst new file +2
-0+ + `falsevalue` -- the value to return if variable is empty or ifcheckvalues
documentation/ref-manual/library-functions.rst
Quoted 5 lines
documentation/ref-manual/library-functions.rst new file +5
-0+ is not a subset of variable. + + `d` -- the data store. + +See the occurrence in :ref:`image_types.bbclass<ref-classes-image_types>`
documentation/ref-manual/library-functions.rst
Quoted 6 lines
documentation/ref-manual/library-functions.rst new file +6
-0+section. + +``copyfile`` +------------ + +Copies a file from src to dest, preserving all permissions andattributes;
Quoted 6 lines
documentation/ref-manual/library-functions.rst new file +6
-0+mtime will be preserved even when moving across filesystems. + +Returns `true` on success and `false` on failure. + +``edit_bblayers_conf`` +----------------------documentation/ref-manual/library-functions.rst
Quoted 10 lines
documentation/ref-manual/library-functions.rst new file +10
-0+ +Edit ``bblayers.conf``, adding and/or removing layers + +:: + + Parameters: + + `bblayers_conf` -- path to bblayers.conf file to edit + + `add` -- layer path (or list of layer paths) to add; None orempty list
documentation/ref-manual/library-functions.rst
Quoted 3 lines
documentation/ref-manual/library-functions.rst new file +3
-0+ to add nothing + + `remove` -- layer path (or list of layer paths) to remove; Noneor
documentation/ref-manual/library-functions.rst
Quoted 3 lines
documentation/ref-manual/library-functions.rst new file +3
-0+ empty list to remove nothing + + `edit_cb` -- optional callback function that will be calledafter
documentation/ref-manual/library-functions.rst
Quoted 8 lines
documentation/ref-manual/library-functions.rst new file +8
-0+ processing adds/removes once per existing entry. + + Returns a tuple: + + `notadded` -- list of layers specified to be added but were not + (because they were already in the list) + + `notremoved` -- list of layers that were specified to beremoved but
Quoted 4 lines
documentation/ref-manual/library-functions.rst new file +4
-0+ were not (because they were not in the list) + +``edit_metadata`` +-----------------documentation/ref-manual/library-functions.rst
Quoted 10 lines
documentation/ref-manual/library-functions.rst new file +10
-0+ +Edit lines from a recipe or config file and modify one or more specified +variable values set in the file using a specified callback function. +Lines are expected to have trailing newlines. + +:: + + Parameters: + + `meta_lines` -- lines from the file; can be a list or aniterable
documentation/ref-manual/library-functions.rst
Quoted 5 lines
documentation/ref-manual/library-functions.rst new file +5
-0+ (e.g. file pointer) + + `variables` -- a list of variable names to look for. + Functions may also be specified, but must be specified with '()' + at the end of the name. Note that the function does not haveany intrinsic
documentation/ref-manual/library-functions.rst line 157
Quoted 2 lines
documentation/ref-manual/library-functions.rst new file +2
-0+ understanding of _append, _prepend, _remove, or overrides, + so these are considered as part of the name. These values gointo
documentation/ref-manual/library-functions.rst
Quoted 3 lines
documentation/ref-manual/library-functions.rst new file +3
-0+ a regular expression, so regular expression syntax is allowed. + + `varfunc` -- callback function called for every variablematching
documentation/ref-manual/library-functions.rst
Quoted 12 lines
documentation/ref-manual/library-functions.rst new file +12
-0+ one of the entries in the variables parameter. + + The function should take four arguments: + + `varname` -- name of variable matched + + `origvalue` -- current value in file + + `op` -- the operator (e.g. '+-') + + `newlines` -- list of lines up to this point. + You can use this to prepend lines before this variablesetting
documentation/ref-manual/library-functions.rst
Quoted 5 lines
documentation/ref-manual/library-functions.rst new file +5
-0+ if you wish. + + and should return a four-element tuple: + + `newvalue` -- new value to substitute in, or None todrop the
documentation/ref-manual/library-functions.rst line 178
Quoted 1 line
documentation/ref-manual/library-functions.rst new file +1
-0+ variable setting entirely. (If the removal results intwo
documentation/ref-manual/library-functions.rst line 179
Quoted 1 line
documentation/ref-manual/library-functions.rst new file +1
-0+ consecutive blank lines, one of the blank lines willalso
documentation/ref-manual/library-functions.rst
Quoted 3 lines
documentation/ref-manual/library-functions.rst new file +3
-0+ dropped). + + `newop` -- the operator to use - if you specify Nonehere,
documentation/ref-manual/library-functions.rst
Quoted 3 lines
documentation/ref-manual/library-functions.rst new file +3
-0+ the original operation will be used. + + `indent` -- number of spaces to indent multi-lineentries,
documentation/ref-manual/library-functions.rst line 186
Quoted 1 line
documentation/ref-manual/library-functions.rst new file +1
-0+ or -1 to indent up to the level of the assignment andopening
documentation/ref-manual/library-functions.rst
Quoted 3 lines
documentation/ref-manual/library-functions.rst new file +3
-0+ quote, or a string to use as the indent. + + `minbreak` -- True to allow the first element of amulti-line
documentation/ref-manual/library-functions.rst
Quoted 4 lines
documentation/ref-manual/library-functions.rst new file +4
-0+ value to continue on the same line as the assignment, + False to indent before the first element. + + To clarify, if you wish not to change the value, then you wouldreturn
Quoted 5 lines
documentation/ref-manual/library-functions.rst new file +5
-0+ like this: return origvalue, None, 0, True + match_overrides: True to match items with _overrides on the end, + False otherwise + + Returns a tuple:documentation/ref-manual/library-functions.rst
Quoted 10 lines
documentation/ref-manual/library-functions.rst new file +10
-0+ + `updated`: + True if changes were made, False otherwise. + `newlines`: + Lines after processing + +``edit_metadata_file`` +---------------------- + +Edit a recipe or config file and modify one or more specified variablevalues
documentation/ref-manual/library-functions.rst line 209
Quoted 1 line
documentation/ref-manual/library-functions.rst new file +1
-0+set in the file using a specified callback function. The file is onlywritten
documentation/ref-manual/library-functions.rst line 211
Quoted 2 lines
documentation/ref-manual/library-functions.rst new file +2
-0+to if the value(s) actually change. +This is basically the file version of ``edit_metadata``, see thatfunction's
Quoted 23 lines
documentation/ref-manual/library-functions.rst new file +23
-0+description for parameter/usage information. + +Returns `True` if the file was written to, `False` otherwise. + +``empty_environment`` +--------------------- + +Remove all variables from the environment. + +``exec_flat_python_func`` +------------------------- + +Execute a flat python function (defined with def funcname(args):...) + +``explode_deps`` +---------------- + +Take an RDEPENDS style string of format: +:: + + "DEPEND1 (optional version) DEPEND2 (optional version) ..." + +and return a list of dependencies. Version information is ignored.documentation/ref-manual/library-functions.rst
Quoted 10 lines
documentation/ref-manual/library-functions.rst new file +10
-0+ +``explode_dep_versions`` +------------------------ + +Take an RDEPENDS style string of format: +:: + + "DEPEND1 (optional version) DEPEND2 (optional version) ..." + +skip null value and items appeared in dependancy string multiple timesand
Quoted 22 lines
documentation/ref-manual/library-functions.rst new file +22
-0+return a dictionary of dependencies and versions. + +``explode_dep_versions2`` +------------------------- + +Take an RDEPENDS style string of format: +:: + + "DEPEND1 (optional version) DEPEND2 (optional version) ..." + +and return a dictionary of dependencies and versions. + +``export_proxies`` +------------------ + +export common proxies variables from datastore to environment. + +``fileslocked`` +--------------- + +Context manager for locking and unlocking file locks. +documentation/ref-manual/library-functions.rst
Quoted 10 lines
documentation/ref-manual/library-functions.rst new file +10
-0+``filter`` +---------- + +Return all words in the variable that are present in the checkvalues. + +:: + + Arguments: + + `variable` -- the variable name. This will be fetched andexpanded
documentation/ref-manual/library-functions.rst
Quoted 3 lines
documentation/ref-manual/library-functions.rst new file +3
-0+ (using d.getVar(variable)) and then split into a set. + + `checkvalues` -- if this is a string it is split on whitespaceinto a
documentation/ref-manual/library-functions.rst
Quoted 8 lines
documentation/ref-manual/library-functions.rst new file +8
-0+ set, otherwise coerced directly into a set. + + `d` -- the data store. + +``filter_environment`` +---------------------- + +Create a pristine environment for Bitbake. This will remove variablesthat are
documentation/ref-manual/library-functions.rst
Quoted 13 lines
documentation/ref-manual/library-functions.rst new file +13
-0+not known and may influence the build in a negative way. + +``get_file_layer`` +------------------ + +Determine the collection (as defined by a layer's ``layer.conf`` file) +containing the specified file. + +``get_referenced_vars`` +----------------------- + +Return names of vars referenced in `start_expr` (recursively), +in quasi-BFS order (variables within the same level are orderedarbitrarily)
documentation/ref-manual/library-functions.rst
Quoted 12 lines
documentation/ref-manual/library-functions.rst new file +12
-0+ +``is_semver`` +------------- + +Is the version string following the semver semantic? + + https://semver.org/spec/v2.0.0.html + +``join_deps`` +------------- + +Take the result from ``explode_dep_versions`` and generate a dependencystring.
documentation/ref-manual/library-functions.rst
Quoted 5 lines
documentation/ref-manual/library-functions.rst new file +5
-0+ +``lockfile`` +------------ + +Use the specified file as a lock file, return when the lock has beenacquired.
documentation/ref-manual/library-functions.rst
Quoted 9 lines
documentation/ref-manual/library-functions.rst new file +9
-0+Returns a variable to pass to ``unlockfile``. + +:: + + Parameters: + + `retry`: `True` to re-try locking if it fails, `False` otherwise + + `block`: `True` to block until the lock succeeds, `False`otherwise
documentation/ref-manual/library-functions.rst line 328
Quoted 2 lines
documentation/ref-manual/library-functions.rst new file +2
-0+ +The `retry` and `block` parameters are kind of equivalent unless youconsider
documentation/ref-manual/library-functions.rst line 329
Quoted 1 line
documentation/ref-manual/library-functions.rst new file +1
-0+the possibility of sending a signal to the process to breakout - atwhich point
documentation/ref-manual/library-functions.rst
Quoted 11 lines
documentation/ref-manual/library-functions.rst new file +11
-0+you want block-True rather than retry-True. + +``md5_file`` +------------ + +Return the hex string representation of the MD5 checksum of filename. + +``mkdirhier`` +------------- + +Create a directory like 'mkdir -p', but does not complain if directoryalready
documentation/ref-manual/library-functions.rst
Quoted 6 lines
documentation/ref-manual/library-functions.rst new file +6
-0+exists like os.makedirs + +``movefile`` +------------ + +Moves a file from ``src`` to `dest`, preserving all permissions andattributes;
documentation/ref-manual/library-functions.rst
Quoted 8 lines
documentation/ref-manual/library-functions.rst new file +8
-0+``mtime`` will be preserved even when moving across filesystems. + +Returns `true` on success and `false` on failure. Move is atomic. + +``preserved_envvars`` +--------------------- + +Variables which are taken from the environment and placed in themetadata.
documentation/ref-manual/library-functions.rst
Quoted 5 lines
documentation/ref-manual/library-functions.rst new file +5
-0+ +``preserved_envvars_exported`` +------------------------------ + +Variables which are taken from the environment and placed in andexported from
Quoted 11 lines
documentation/ref-manual/library-functions.rst new file +11
-0+the metadata. + +``prunedir`` +------------ + +Delete everything reachable from the directory named in `'topdir'`. + +``prune_suffix`` +---------------- + +See if var ends with any of the suffixes listed and remove it if found .documentation/ref-manual/library-functions.rst
Quoted 10 lines
documentation/ref-manual/library-functions.rst new file +10
-0+ +``remove`` +---------- + +Equivalent to rm -f ``xx`` or rm -rf ``xx``. + +``sha1_file`` +------------- + +Return the hex string representation of the SHA1 checksum of thefilename.
documentation/ref-manual/library-functions.rst
Quoted 5 lines
documentation/ref-manual/library-functions.rst new file +5
-0+ +``sha256_file`` +--------------- + +Return the hex string representation of the 256-bit SHA checksum offilename.
documentation/ref-manual/library-functions.rst
Quoted 5 lines
documentation/ref-manual/library-functions.rst new file +5
-0+ +``sha384_file`` +--------------- + +Return the hex string representation of the SHA384 checksum of thefilename.
documentation/ref-manual/library-functions.rst
Quoted 5 lines
documentation/ref-manual/library-functions.rst new file +5
-0+ +``sha512_file`` +--------------- + +Return the hex string representation of the SHA512 checksum of thefilename.
Quoted 6 lines
documentation/ref-manual/library-functions.rst new file +6
-0+ +``signal_on_parent_exit`` +------------------------- + +Trigger signame to be sent when the parent process dies. +documentation/ref-manual/library-functions.rst
Quoted 10 lines
documentation/ref-manual/library-functions.rst new file +10
-0+``split_version`` +----------------- + +Split a version string into its constituent parts +(:term:`PE`, :term:`PV`, :term:`PR`). + +``to_boolean`` +-------------- + +Check input string and return boolean value True/False/None dependingupon the
documentation/ref-manual/library-functions.rst
Quoted 6 lines
documentation/ref-manual/library-functions.rst new file +6
-0+checks. + +``umask`` +--------- + +Context manager to set the umask to a specific mask, and restore itafterwards.
Quoted 5 lines
documentation/ref-manual/library-functions.rst new file +5
-0+ +``unlockfile`` +-------------- + +Unlock a file locked using ``lockfile``.documentation/ref-manual/library-functions.rst
Quoted 10 lines
documentation/ref-manual/library-functions.rst new file +10
-0+ +``vercmp_string`` +----------------- + +Split version strings and compare them. + +``vercmp_string_op`` +-------------------- + +Compare two versions and check if the specified comparison operatormatches
documentation/ref-manual/library-functions.rst line 434
Quoted 2 lines
documentation/ref-manual/library-functions.rst new file +2
-0+the result of the comparison. This function is fairly liberal about what +operators it will accept since there are a variety of styles dependingon
documentation/ref-manual/library-functions.rst
Quoted 11 lines
documentation/ref-manual/library-functions.rst new file +11
-0+the context. + +``VersionStringException`` +-------------------------- + +Exception raised when an invalid version specification is found. + +``which`` +--------- + +Locate `item` in the list of paths `path` (colon separated string like$PATH).
documentation/ref-manual/library-functions.rst line 447
Quoted 2 lines
documentation/ref-manual/library-functions.rst new file +2
-0+If `direction` is non-zero then the list is reversed. +If `history` is True then the list of candidates also returned asresult,
Quoted 5 lines
documentation/ref-manual/library-functions.rst new file +5
-0+history. +If `executable` is True then the candidate has to be an executable file, +otherwise the candidate simply has to exist. + +``_check_unsafe_delete_path``documentation/ref-manual/library-functions.rst
Quoted 10 lines
documentation/ref-manual/library-functions.rst new file +10
-0+----------------------------- + +Basic safeguard against recursively deleting something we should not. +If it returns True, the caller should raise an exception with +an appropriate message. + +.. note:: + + This is NOT meant to be a security mechanism - + just a guard against silly mistakes with potentially disastrousresults.
documentation/ref-manual/library-functions.rst line 467
Quoted 10 lines
documentation/ref-manual/library-functions.rst new file +5
-0+ +``_print_trace`` +---------------- + +Print the Environment of a Text Body.--
# Randy MacLeod
# Wind River Linux
Hi Milan,
Quoted 8 lines · Milan Shah
Hello All,
My Patch-v2 has not been reviewed yet. Looking forward to see some updates on it.
https://lists.yoctoproject.org/g/docs/message/903
<https://lists.yoctoproject.org/g/docs/message/903>
https://bugzilla.yoctoproject.org/show_bug.cgi?id=9612
<https://bugzilla.yoctoproject.org/show_bug.cgi?id=9612>
My apologies for the very late reply !
However, I don't see that you took Quentin and Nicolas' final remarks into account. Rather than copying documentation from the source code, it would be much cheaper and more reliable to extract such documentation from comments in the sources. This seems like the way to go.
Did I miss anything?
Anyway, I agree that such information would be useful to include in the BitBake manual.
Kind regards,
Michael.
Signature · 3 lines
Michael Opdenacker, Bootlin Embedded Linux and Kernel engineering https://bootlin.com