summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/utils.py
Commit message (Collapse)AuthorAgeFilesLines
...
* vercmp: don't choke on empty first version componentsChris Larson2011-01-041-1/+1
| | | | | | | (Bitbake rev: e75aa94e9477933c5a40021b2a8e844db54f29da) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Prefer xrange over range for small performance gain.Bob Foerster2011-01-041-5/+5
| | | | | | | | | | | | | | range() allocates an actual list when called. xrange() is just an iterator and creates the next range item on demand. This provides a slight performance increase. In python 3, range will do what xrange does currently, but the upgrade will be handled by the 2to3 tool. (Bitbake rev: 73b40f06444cb877a5960b2aa66abf7dacbd88f0) Signed-off-by: Bob Foerster <robert@erafx.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Don't show tracebacks for SystemExit or KeyboardInterruptChris Larson2011-01-041-1/+1
| | | | | | | (Bitbake rev: d71984b3934c3dd9791c3bc00f332b79a1985a05) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Switch bitbake internals to use logging directly rather than bb.msgChris Larson2011-01-041-21/+26
| | | | | | | | | | | | | | We use a custom Logger subclass for our loggers This logger provides: - 'debug' method which accepts a debug level - 'plain' method which bypasses log formatting - 'verbose' method which is more detail than info, but less than debug (Bitbake rev: 3b2c1fe5ca56daebb24073a9dd45723d3efd2a8d) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Use the python logging module under the hood for bb.msgChris Larson2011-01-041-6/+5
| | | | | | | (Bitbake rev: 47ca82397bc395b598c6b68b24cdee9e0d8a76d8) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Make realfile optional for better_exec, using the existing fn in the code objectChris Larson2011-01-041-2/+4
| | | | | | | (Bitbake rev: 499a2d28d578cdd6df7cd30ccb79cc2b2796fb65) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bb.utils: check if lock file is writable, to fix bug 606Yu Ke2010-12-301-0/+4
| | | | | | | | | | | | | | | | | | | | | Bug 606 report that if $DL_DIR is read-only, do_fetch will simply hang without any error message. The root cause is that: bb.fetch.go()->bb.utils.lockfile() will try to lock file ${DL_DIR}/xxxxx.lock. Since ${DL_DIR} is read-only, it will cause IOError exception. Although lockfile() can catch the exception, currently code simply ignore all the exception and continue the loop. it make sense if the exception is caused by locking contention, but in the read-only $DL_DIR case, it cause endless waiting unfortunately. So this patch add read-only check for lockfile to avoid the silent hang. Fix [BUGID #606] Signed-off-by: Yu Ke <ke.yu@intel.com>
* bitbake: Overhaul environment handlingRichard Purdie2010-12-091-15/+33
| | | | | | | | | | | | | | Currently, anything whitelisted in the environment makes it into the worker processes. This is undesireable and the worker environment should be as clean as possible. This patch adapts bitbake sosme variables are loaded into bitbake's datastore but not exported by default. Any variable can be exported by setting its export flag. Currently, this code only finalises the environment in he worker as doing so in the server means variables are unavailable in the worker. If we switch back to fork() calls instead of exec() this code will need revisting. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake/utils.py: Improve traceback to be more helpful/clear to usersRichard Purdie2010-12-051-7/+23
| | | | Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake/utils.py: Ensure the last lines of functions are printed in tracebacksRichard Purdie2010-12-051-2/+5
| | | | Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake: Implement signaturesRichard Purdie2010-09-031-0/+1
| | | | | | Includes functionality to find out what changes between two different singature data dumps. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* utils.py: Fix bb.copyfile to change the permissions of the file back correctlyRichard Purdie2010-08-231-2/+4
| | | | Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* utils.py: Add a new extend_deps() to easily merge two dependency listsMark Hatle2010-08-201-0/+11
| | | | | | | | Add a new extend_deps function to more easily merge two dependency lists. This avoids adding duplicates, unless the value of the dependency is different. Signed-off-by: Mark Hatle <mhatle@windriver.com>
* bitbake/utils.py: Allow copyfile to copy files which aren't readableRichard Purdie2010-08-201-0/+3
| | | | Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake/utils.py: Improve better_exec debug outputRichard Purdie2010-08-201-5/+9
| | | | Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake/utils.py: Give useful debug information when no lineno information ↵Richard Purdie2010-08-191-7/+10
| | | | | | is available Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake/utils.py: Allow explode_dep_versions to handle the commas join_deps ↵Richard Purdie2010-08-171-1/+1
| | | | | | can introduce into strings Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* *: Fix typo in documentationBernhard Reutner-Fischer2010-08-041-1/+1
| | | | | | | | | s/dictonary/dictionary/ (Bitbake rev: 0cc632761e75f66a8ce5ca2fe370f7551ccbfdf0) Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* utils: Fix number of arguments to bb.msg functionsBernhard Reutner-Fischer2010-08-031-2/+2
| | | | | | | | | | | | the 'fn' argument of them is not used, should be removed anytime: sed -i -e '/^def.*fn/s/,[[:space:]]*fn[[:space:]]*=[[:space:]]*None[[:space:]]*)/)/g' lib/bb/msg.py (Bitbake rev: 1cb72e371322c271ee7f2d008c6f7899fb38b4fd) Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Apply some 2to3 refactoringsChris Larson2010-07-021-2/+2
| | | | Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Kill unnecessary usages of the types moduleChris Larson2010-07-021-3/+3
| | | | | | | | | | | | | types.IntType -> int types.StringType -> basestring ... Also moves our ImmutableTypes tuple into our own namespace. (Bitbake rev: 83674a3a5564ecb1f9d2c9b2d5b1eeb3c31272ab) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Apply some 2to3 transforms that don't cause issues in 2.6Chris Larson2010-07-021-16/+16
| | | | | | | (Bitbake rev: d39ab776e7ceaefc8361150151cf0892dcb70d9c) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Apply the 2to3 print function transformChris Larson2010-07-021-11/+11
| | | | | | | (Bitbake rev: ff2e28d0d9723ccd0e9dd635447b6d889cc9f597) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Drop some unused varsChris Larson2010-07-021-1/+1
| | | | | | | (Bitbake rev: b79ca5f1cc2d262de877047769ce25279ba26672) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Import fixupsChris Larson2010-07-021-14/+9
| | | | | | | (Bitbake rev: 4fa052f426e3205ebace713eaa22deddc0420e8a) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Formatting cleanupsChris Larson2010-07-021-92/+93
| | | | | | | (Bitbake rev: 2caf134b43a44dad30af4fbe33033b3c58deee57) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Drop doctest, as we aren't utilizing itChris Larson2010-07-021-19/+1
| | | | | | | | | | | We should add back in some proper unit testing. Doctest is rather limited, and we haven't actually made use of it since the original implementation of the datastore when the project started, as far as I'm aware. (Bitbake rev: 3a11c2807972bbbddffde2fa67fc380d159da467) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Implement bb.msg.domain as a named tuple, drop the Enum classChris Larson2010-07-021-40/+0
| | | | | | | | | Also fixes some bb.msg references from within bb.msg. (Bitbake rev: db95af590f742c8186e84046ad9704fae1733720) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Ensure we always utilize the correct messaging domainsChris Larson2010-07-021-3/+3
| | | | | | | (Bitbake rev: 92a2e2e90981c0615171abe03645a772d84f6986) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Resurrect the old bb.vercmp as bb.utils.vercmp, and its depsChris Larson2010-07-021-0/+143
| | | | | | | | | | This is just for compatibility. We may drop it in the future, or rewrite it, as it's not particularly pythonic. (Bitbake rev: c4e31d7fe1d15a1e3ef2a453e7c7812d403d22cb) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Add & utilize a simple_exec utility functionChris Larson2010-07-021-0/+3
| | | | | | | (Bitbake rev: 5ead16f14f996bcbb2fb14277b8ce5a9317b8160) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Consolidate the exec/eval bits, switch anonfunc to better_exec, etcChris Larson2010-07-021-4/+14
| | | | | | | | | | | | The methodpool, ${@} expansions, anonymous python functions, event handlers now all run with the same global context, ensuring a consistent environment for them. Added a bb.utils.better_eval function which does an eval() with the same globals as better_exec. (Bitbake rev: 424d7e267b009cc19b8503eadab782736d9597d0) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake: Add bb.utils.join_deps to handle creation of dependency strings ↵Richard Purdie2010-06-301-0/+12
| | | | | | with versions Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake: Move the logger initialization from cooker to utilsJeff Dike2010-06-291-0/+16
| | | | | | | | | | | | | | In order to move the environment cleaning, which wants to log a message, before cooker creation, the logging facility initialization needs to happen earlier. So, it is now in init_logger in utils.py and called from bitbake before the creation of the data object. It also seems more correct to initialize a global facility like this from a more global context than the creation of an object, of which there could theoretically be many. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Fix 7 references to undefined variables, as spotted by pyflakesChris Larson2010-03-251-4/+3
| | | | | | | (Bitbake rev: e1e4ccf203e38070eeafd31a622671996cff61a1) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bb.utils: remove old portage remnantsChris Larson2010-03-251-571/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The following utility functions were removed. Note that in this particular case we're bypassing a proper deprecation process, as these functions are clearly not utilized, are obvious remnants of old ways of doing things, and some of which do not even function properly. - tokenize - evaluate - flatten - relparse - ververify - isjustname - isspecific - catpkgsplit - pkgsplit - pkgcmp - dep_parenreduce - dep_opconvert (Bitbake rev: 62983ad9b151ee8d51e8cf9a31c736c7813edf16) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bb.utils: utilize string.letters and string.digitsChris Larson2010-03-251-5/+3
| | | | | | | (Bitbake rev: 7af05cba87ec9f3ea5e53689b3d9f0a63784d1b5) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bb.which: fix broken direction/reverse argumentChris Larson2010-03-251-1/+1
| | | | | | | (Bitbake rev: 4725d83f532cad96168aa9affdedb33b6fc897b7) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* utils: improve wording of error messageBernhard Reutner-Fischer2010-03-251-1/+1
| | | | | | | | (Bitbake rev: b2486ec57c6a7adf09d0960fdf6727881b324d2f) Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Chris Larson <clarson@kergoth.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Fix msg usage in the moved utility functions.Chris Larson2010-03-221-15/+15
| | | | | | | (Bitbake rev: 686288444d22091dee66e20ec49b9c53f8c980b7) Signed-off-by: Chris Larson <clarson@kergoth.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* Move most utility functions from bb into bb.utils.Chris Larson2010-03-221-0/+759
| | | | | | | (Bitbake rev: ff720ec59b30671c951dbf3b96df10ef56b8b505) Signed-off-by: Chris Larson <clarson@kergoth.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake: utils.py: Don't error if an exported environment variable is unset ↵Richard Purdie2010-02-121-1/+1
| | | | | | (i.e. None) Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake: Switch to bitbake-dev version (bitbake master upstream)Richard Purdie2010-01-201-3/+17
| | | | Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake: Add build_environment function for building an environment based on ↵Richard Purdie2009-07-021-0/+10
| | | | | | the data dictonary Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
* bitbake: Add bb.utils.prune_suffix()Richard Purdie2008-12-311-0/+11
|
* bitbake/bitbake-dev: Sync with upstreamRichard Purdie2008-12-061-1/+0
|
* bitbake utils.py: Merge prunedir symlink fix from bitbake upstreamRichard Purdie2008-10-201-1/+4
| | | | git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5551 311d38ba-8fff-0310-9ca6-ca027cbcb966
* bitbake: Add some sanity checks to the lockfile functionsRichard Purdie2008-10-171-0/+6
| | | | git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5534 311d38ba-8fff-0310-9ca6-ca027cbcb966
* bitbake: Refactor the environment variable handlingRobert Bradford2008-10-171-0/+22
| | | | | | | Refactor the environment variable handling so that it more closes matches the changes that have been made in bitbake-dev. git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5527 311d38ba-8fff-0310-9ca6-ca027cbcb966
* bitbake utils.py: Fix ocassional locking glitch with a better retrying mechanismRichard Purdie2008-10-061-9/+12
| | | | git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5415 311d38ba-8fff-0310-9ca6-ca027cbcb966