summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/main.py
Commit message (Collapse)AuthorAgeFilesLines
* bitbake: main: Improve -v and -D option documentationDiana Thayer2017-03-271-2/+13
| | | | | | | | | | | | Expanded and clarify documentation for the -v, --verbose and -D, --debug options. [YOCTO #9962] (Bitbake rev: 921592026c69287cdb40ffd90944d5944f28e2c3) Signed-off-by: Diana Thayer <garbados@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: runqueue: add option to run all tasks in specific build targetMatthew McClintock2017-03-131-0/+3
| | | | | | | | | | | | | | | | | | | | For example: $ bitbake core-image-minimal --runall unpack ... NOTE: Tasks Summary: Attempted 326 tasks of which 88 didn't need to be rerun and all succeeded. $ bitbake core-image-minimal --runall patch NOTE: Tasks Summary: Attempted 453 tasks of which 332 didn't need to be rerun and all succeeded. This can replace fetchall as well: $ bitbake core-image-minimal --runall fetch NOTE: Tasks Summary: Attempted 135 tasks of which 119 didn't need to be rerun and all succeeded. (Bitbake rev: 7c0fa6ba66cdb956b37d94055307cde857633df9) Signed-off-by: Matthew McClintock <msm-oss@mcclintock.net> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/main.py: Shutdown cooker when server isn't foregroundAníbal Limón2017-01-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | The cooker is added to the BBServer and then detached creating a copy of the cooker in the process, if the server isn't in foreground it cause fd leaks on inotify this can be see using many instances of tinfoil. Example: from bb.tinfoil import Tinfoil while True: with Tinfoil() as tinfoil: input("Pre\n") tinfoil.prepare(config_only=True) input("Post\n") [YOCTO #10873] (Bitbake rev: 2ada2efb057a291eb34c66d975eb339232137956) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tinfoil: rewrite as a wrapper around the UIPaul Eggleton2016-12-141-34/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite tinfoil as a wrapper around the UI, instead of the earlier approach of starting up just enough of cooker to do what we want. This has several advantages: * It now works when bitbake is memory-resident instead of failing with "ERROR: Only one copy of bitbake should be run against a build directory". * We can now connect an actual UI, thus you get things like the recipe parsing / cache loading progress bar and parse error handling for free * We can now handle events generated by the server if we wish to do so * We can potentially extend this to do more stuff, e.g. actually running build operations - this needs to be made more practical before we can use it though (since you effectively have to become the UI yourself for this at the moment.) The downside is that tinfoil no longer has direct access to cooker, the global datastore, or the cache. To mitigate this I have extended data_smart to provide remote access capability for the datastore, and created "fake" cooker and cooker.recipecache / cooker.collection adapter objects in order to avoid breaking too many tinfoil-using scripts that might be out there (we've never officially documented tinfoil or BitBake's internal code, but we can still make accommodations where practical). I've at least gone far enough to support all of the utilities that use tinfoil in OE-Core with some changes, but I know there are scripts such as Chris Larson's "bb" out there that do make other calls into BitBake code that I'm not currently providing access to through the adapters. Part of the fix for [YOCTO #5470]. (Bitbake rev: 3bbf8d611c859f74d563778115677a04f5c4ab43) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: knotty: make quiet option a level optionPaul Eggleton2016-12-141-2/+2
| | | | | | | | | | | | | | | | | Allow you to specify -q / --quiet more than once to reduce the messages even further. It will now operate as follows: Level Option Result ----- ------ ---------------------------------------- 0 Print usual output 1 -q Only show progress and warnings or above 2 -qq Only show warnings or above 3+ -qqq Only show errors (Bitbake rev: 6cf2582e17c28ca04f5cfb59858c4a9778c700d4) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: main: Check bitbake server-only port is a numberBenjamin Esquivel2016-10-091-0/+7
| | | | | | | | | | | | | | | | Either using the memres script or the bitbake call with --server-only if the port is a string instead of a number then the process hangs indefinitely causing a loop that never ends. Add a check at the beginning for the port being a number otherwise show an error message and exit cleanly. [YOCTO #10397] (Bitbake rev: 35927a98daeeb854ef5782e900206af6cd96b3d7) Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: implement idle timeout for xmlrpc serverEd Bartosh2016-07-211-1/+6
| | | | | | | | | | | | | | Idle timeout can be specified either by -T/--idle-timeout option or by sessing BBTIMEOUT environment variable. Bitbake xmlrpc server will unload itself when timeout exprired, i.e. when server is idle for more than <idle timeout> seconds. [YOCTO #5534] (Bitbake rev: 5fa0b3a19e7d0f40790f737abeddf499d53f1f6a) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: implement --foreground command line optionEd Bartosh2016-07-211-1/+11
| | | | | | | | | | This option makes bitbake xmlrpc server to run in foreground. It should be useful for debugging purposes. (Bitbake rev: 9d4254be5853a546a346bf0d19919dcfba12773d) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: main: implement server autostart featureEd Bartosh2016-07-201-5/+16
| | | | | | | | | | | | | | | | If environment variable BBSERVER == 'autostart' bitbake will automatically load server if it's not running yet. If host and port are in bitbake.lock then bitbake tries to check if server is running and responses to commands and starts new server only if this check fails. [YOCTO #5534] (Bitbake rev: 89c6e625d47303b2aad8e6645762f17aee01b2d4) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: knotty: add quiet output modePaul Eggleton2016-07-081-0/+9
| | | | | | | | | | | | | | | | | | | | | Quiet output mode disables printing most messages (below warnings) to the console; however these messages still go to the console log file. This is primarily for cases where bitbake is being launched interactively from some other process, but where full console output is not needed. Because of the need to keep logging all normal events to the console log, this functionality was implemented within the knotty UI rather than in bb.msg (where verbose mode is implemented). We don't currently have a means of registering command line options from the UI end, thus the option actually has to be registered in main.py regardless of the UI, however I didn't feel like it was worth setting up such a mechanism just for this option. (Bitbake rev: db95cdef08e339dec7462bfde3ad7d75c1c60dd8) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/main.py: Fix use of BBPOSTCONF and BBPRECONFMariano Lopez2016-06-091-2/+2
| | | | | | | | | | | | | | The functionality of BBPOSTCONF and BBPRECONF was added in commit 21b314d4d1e5b8fbeb4cc57006f0a110f0b3aa8f but there was a typo in the variable name that raises an exception in bitbake. [YOCTO #9235] (Bitbake rev: 6d1379c8818400e5cdc442e6142f08a110fd5b95) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Convert to python 3Richard Purdie2016-06-021-5/+6
| | | | | | | | | Various misc changes to convert bitbake to python3 which don't warrant separation into separate commits. (Bitbake rev: d0f904d407f57998419bd9c305ce53e5eaa36b24) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: main: Ensure exceptions are correctly displayedRichard Purdie2016-05-131-2/+1
| | | | | | | | | | If the cooker fails to start, ensure a correct exception is displayed to the user. After handling any queued events simply re-raise the original exception else the output can be unclear. (Bitbake rev: 9a4db1aa608c17d31bf5ea1cab5a99beb565dd83) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: main: Change warn() -> warning()Richard Purdie2016-05-131-1/+1
| | | | | | | | This avoids a deprecation warning in python 3. (Bitbake rev: bf1a92d0c002d73e8a34472dced1343dc4a4251a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitake: main: fix line-too-long pytling warningsEd Bartosh2016-05-061-39/+82
| | | | | | | | | Wrapped long lines to fix "Line too long" pylint warnings. (Bitbake rev: e329a932e14d002a561245b5026f974897f64598) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: main: fix bad-continuation warningsEd Bartosh2016-05-061-66/+69
| | | | | | | | | Fixed pylint warning 'Wrong continued indentation'. (Bitbake rev: 5bfc8c0dc70abd6462a6df4ce905173d9f2cdc07) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: main: fix bad-witespace pylint warningsEd Bartosh2016-05-061-69/+69
| | | | | | | | | | | | Fixed pylint warnings: No space allowed around keyword argument assignment No space allowed after bracket No space allowed before bracket (Bitbake rev: c39770239f7b61217501782b9c5e9d3211355d42) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: main: set defaults from env variablesEd Bartosh2016-05-061-18/+6
| | | | | | | | | | | | | | | | | | Environment variables BBSERVER, BBTOKEN and BBEVENTLOG silently overwrite bitbake command line arguments. This is confusing and can cause issues that are difficult to debug. It's better to use them as default values instead. Used environment variables BBSERVER, BBTOKEN and BBEVENTLOG to set default values for command line arguments. Changed setting default value of --ui command line argument from BITBAKE_UI to look similar way. (Bitbake rev: 87040be4ff54cd460961318224deef8f2ea4c85a) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: main: add 2 environment variablesEd Bartosh2016-05-061-0/+6
| | | | | | | | | | | | | | | | | | Bitbake uses set of environment variables to set command line options, e.g. seeting BBTOKEN variable has the same effect as using --token command line option. Added new environment variables BBPRECONF and BBPOSTCONF that are equivalents of --read and --postread command line options. They can be used by high level scripts to append or prepend configuration files to conf/local.conf [YOCTO #9235] (Bitbake rev: bf604ec1ca4eb4d0b22bcc72249963e6d7445f34) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: main: fix processing of BBEVENTLOGEd Bartosh2016-04-191-1/+1
| | | | | | | | | | | Fixed typo that caused incorrect processing of BBEVENTLOG environment variable. Even if variable is set it was ignored by bitbake. (Bitbake rev: 2705b5f59aef4a070e2df2752d27bd04ea747057) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: xmlrpc: set single use mode differentlyEd Bartosh2016-03-241-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently xmlrpc server implicitly sets itself into single use mode when bitbake server is started with anonymous port (0) or no port is provided in command line. In this mode bitbake shuts down xmlrpc server after build is done. This assumption is incorrect in some cases. For example Toaster uses bitbake in this mode and expects xmlrpc server to stay in memory. Till recent changes single use mode was always unset due to the bug. When the bug was fixed it broke toaster builds as Toaster couldn't communicate with bitbake server in single use mode. Reimplemented logic of setting single use mode. The mode is explicity set when --server-only command line parameter is not provided to bitbake. It doesn't depend on the port number anymore. [YOCTO #9275] [YOCTO #9240] [YOCTO #9252] (Bitbake rev: afc0dd5c532684f6201b1e12bbf4c226ea19062d) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: main/runqueue: Add --setscene-only option to bitbakeRichard Purdie2016-01-111-0/+3
| | | | | | | | | | | | | Its turning out that we really need a way to have bitbake just run the setscene tasks but not any real tasks, particularly for SDK operations. Add an option for this since its pretty straight forward. This allows various nasty workarounds in OE-Core to be removed. (Bitbake rev: e4a2aafa1650a227a04d92a8a0b31efaed2c310e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: main: kill server without queue setupEd Bartosh2016-01-061-6/+7
| | | | | | | | | | | | | | | | | | | | | | Setup of event queue includes registering of UI handler. This operation can fail when cooker is busy. However, there is no need in registering UI handler for terminating the server. Moved the call of connection.terminateServer before setting up of the event queue. This should make terminating server to work more reliably as it doesn't depend on setting up the event queue and registering UI handler anymore. This should also help Toaster backend to restart bitbake server and observer without getting "Could not register UI event handler" errors. [YOCTO #8776] (Bitbake rev: 0c5a9349f797d05c282c2ada1893e187e05f0576) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: xmplrpc: split connect methodEd Bartosh2016-01-061-0/+1
| | | | | | | | | | | | | | Current code in connect method sets up event queue, which requires registering UI handler. This functionality may not be needed for some operations, e.g. for server termination. Moved functionality of setting up event queue in from 'connect' method to 'setupEventQueue' in BitBakeXMLRPCServerConnection class. (Bitbake rev: 4429871da76d6bd29e023ff42740fe7daa6b40fa) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cooker: preserve pre and post configsEd Bartosh2015-10-271-0/+7
| | | | | | | | | | | | | | | | | | | Additional config files passed to bitbake server with --read and --postread options are rewritten by client bitbake even if it doesn't use those options. This is a show stopper for toaster as toaster command line builds are based on the assumption that server is aware of toster configs, provided by --postread option. This behaviour is fixed by preserving values of --read and --postread options when bitbake server starts and restoring them if client bitbake doesn't explicitly specify them. (Bitbake rev: 02c64f7487ca8ec5d32c440f5002c4b8f64b76a6) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/main: avoid importing all server/UI modules on every executionPaul Eggleton2015-08-241-22/+38
| | | | | | | | | | | | | | | | We're importing the server and UI modules in order to check they are valid, but it turns out that that has some nasty side-effects. We don't actually need to do this except when --help is passed or the module doesn't exist, so rearrange the code so that we only do the module listing in those two cases. Additionally, let's just go ahead and catch all errors on import; we really don't care to have them cause a failure now. (Bitbake rev: c9dc6d9c86e8b887821a6d00346bd0b09e1da97c) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: main: Handle RuntimeError exception in list_extension_modulesRandy Witt2015-08-201-1/+1
| | | | | | | | | | | This exception was triggered in toaster from recent changes and is completely breaking the whole of bitbake. Add the exception to the list so at least only toaster is affected. (Bitbake rev: f64def7cb6069dc1134fcd546bb59e4030c7376f) Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/main: consolidate UI/server extension listing and loadingPaul Eggleton2015-08-191-31/+54
| | | | | | | | | | Provide us with a means of showing the list of UIs / server choices for the command line help, and do the processing in one place for both. (Bitbake rev: 24035c1daad5a904c3372d21d44191ee8182338f) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: Fix -m handling if cannot connect to serverPaul Eggleton2015-08-191-2/+0
| | | | | | | | | | | If we can't connect to the server we should error out, because it might not be that the server is actually dead - it might just be unable to execute commands. (Bitbake rev: d4b921676859d6ba4e1922fa4682ee941652f483) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cooker: properly fix bitbake.lock handlingRichard Purdie2015-08-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the PR server or indeed any other child process takes some time to exit (which it sometimes does when saving its database), it can end up holding bitbake.lock after the UI exits, which led to errors if you ran bitbake commands successively - we saw this when running the PR server oe-selftest tests in OE-Core. The recent attempt to fix this wasn't quite right and ended up breaking memory resident bitbake. This time we close the lock file when cooker shuts down (inside the UI process) instead of unlocking it, and this is done in the cooker code rather than the actual UI code so it doesn't matter which UI is in use. Additionally we report that we're waiting for the lock to be released, using lsof or fuser if available to list the processes with the lock open. The 'magic' in the locking is due to all spawned subprocesses of bitbake holding an open file descriptor to the bitbake.lock. It is automatically unlocked when all those fds close the file (as all the processes terminate). We close the UI copy of the lock explicitly, then close the server process copy, any remaining open copy is therefore some proess exiting. (The reproducer for the problem is to set PRSERV_HOST = "localhost:0" and add a call to time.sleep(20) after self.server_close() in lib/prserv/serv.py, then run "bitbake -p; bitbake -p" ). Cleanup work done by Paul Eggleton <paul.eggleton@linux.intel.com>. This reverts bitbake commit 69ecd15aece54753154950c55d7af42f85ad8606 and e97a9f1528d77503b5c93e48e3de9933fbb9f3cd. (Bitbake rev: a29780bd43f74b7326fe788dbd65177b86806fcf) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: main: add skeleton documentation for the recipe:do_task syntaxRoss Burton2015-07-071-1/+1
| | | | | | | | | | The incredibly useful recipe:do_task syntax on the command line isn't documented at all. This isn't much but it's better than nothing. (Bitbake rev: 7f4c07886ecff4ac77fdd2165bedd179099fcf19) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Check if bitbake versions matchEd Bartosh2015-04-291-2/+1
| | | | | | | | | | | | | | | | Bitbake program and core versions must match. Moved __version__ from main.py back to bin/bitbake. Implemented check for version match in bin/bitbake. (Bitbake rev: 2fe7d8c574ddf6a30278cff1a5a5c4089dc56d6d) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> tbs Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Handle BBMainExceptionEd Bartosh2015-04-291-1/+1
| | | | | | | | | | | | | | | | Some error messages were lost because BBMainException was inherited from bb.BBHandledException. When bb.BBHandledException is processed error messages are not printed as they suppose to be printed before raising this exception. Stopped to inherit BBMainException from bb.BBHandledException. Handled BBMainException in bin/bitbake and printed error message to the stderr. (Bitbake rev: c8e2a40c4e9865ebef9936d23644f2602a5c90f5) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: Update to version 1.27.0 post 1.26 releaseRichard Purdie2015-03-251-1/+1
| | | | | | (Bitbake rev: 0153e0b4e089f62a7d5a92ca6be2fa5a8f61a6e4) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: Update to version 1.26.0Richard Purdie2015-03-251-1/+1
| | | | | | (Bitbake rev: 14da7bc06bc6ea6fd051c0afd8d4839d96f415e7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bin/bitbake: Create bitbake_main APIEd Bartosh2015-03-251-0/+390
Moved most of functionality of bin/bitbake to lib/bb/main.py to be able to call bitbake from python code. (Bitbake rev: d377f7f88d73f4e5d2dffef03d6acee809827ac6) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>