summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/command.py
Commit message (Collapse)AuthorAgeFilesLines
* bitbake: bitbake: Convert to python 3 megacommit This needs breaking up into ↵Richard Purdie2016-05-161-1/+1
| | | | | | | | smaller changes. (Bitbake rev: cf51f19aed208a75d38c14cd585d9b9f115e3ba3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: command: make setEventMask readonlyEd Bartosh2016-03-071-0/+1
| | | | | | | | | | | | | | | | Executing setEventMask command when bitbake server is in readonly mode causes runCommand to fail with the following error: 'Not able to execute not readonly commands in readonly mode' Set readonly attribute for setEventMask command to make it working for Toaster UI. This should not do any harm as this command doesn't influence cooker state. (Bitbake rev: 8a47d30b2555255fbf6049c5ed69b29664c32b17) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: command: Add getSetVariable commandRichard Purdie2015-10-291-0/+10
| | | | | | | | | | There are some use cases where we want to read a variable but also set the variable to the value read, effectively locking in any expansion of it. This adds such a command. (Bitbake rev: 0c0c524691e3d2ffd9953a106fcc06262cbde910) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: command: ensure sync commands that read configuration see updatesRichard Purdie2015-08-191-1/+12
| | | | | | | | | | | | Add a means of ensuring that synchronous commands that read the results of the configuration trigger a reparse of the configuration if any underlying files have changed. (Bitbake rev: aaf3cc024315450c1674819edf2a4e5cdf293f35) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: command: intercept SystemExit to avoid trashing the serverPaul Eggleton2015-08-191-1/+1
| | | | | | | | | | | | If sys.exit() is called within a command run over XMLRPC, the XMLRPC server is effectively trashed (apparently listening but no longer able to respond to commands). We need to intercept the SystemExit exception and deal with it as we would any other exception. (Bitbake rev: 95e391acbc3b4efd6c77637a1ce815012ae0f09b) 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-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: command.py: Unlock function included into CommandsSync classLeonardo Sandoval2015-07-091-0/+6
| | | | | | | | | | Function which calls cooker's unlock method, which in turn unlocks bitbake.lock file. (Bitbake rev: e97a9f1528d77503b5c93e48e3de9933fbb9f3cd) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cooker: Rename event_data -> expanded_dataRichard Purdie2015-01-231-3/+3
| | | | | | | | | | event_data would be better named expanded_data, then we can widen its scope to other places in cooker where we need to access an expanded data store. We certainly don't want multiple expanded data stores. (Bitbake rev: 1a3c1c9203e1a1452314954f1cfd771e5c1ce89b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: command/cooker/knotty: Fix memres handling of command environment ↵Richard Purdie2015-01-211-1/+2
| | | | | | | | | | | | | | | | changes If the environment changes, we need memory resident bitbake to adapt to those changes. This adds in functionality to handle this alongside the configuration option handling code. This means that the common usage: MACHINE=X bitbake Y now works with the memory resident server. (Bitbake rev: 4d1343010da757a0c126bc22475354da44aaf8e3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: knotty: Ensure commandline parameters are updated in memres serverRichard Purdie2014-09-231-0/+4
| | | | | | | | | | | | | | | | When using options like -k, -f, -v and so on with the memory resident server, they'd currently only be set on the initial values passed to the original command. This ensures they now match those specified on the commandline for the options where this makes sense. To make this work, a command to update the options on the server side is required so this is added. [YOCTO #5292] (Bitbake rev: 1c75cc4d0c8b606c1fe76e6bf60bf6a32298b105) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: command: Trigger updateCache to shut down any active parser threadsRichard Purdie2014-08-231-0/+3
| | | | | | | | | | | | | If we trigger a shutdown whilst parsing for whatever reason, in some cases we were not closing down the parser threads. This change ensures we do so. The function names are not entirely intuitive but the behaviour is more correct (and commented). The previous bug with the stdout failure would trigger this one, if there was a cold cache and parsing was required (but not otherwise). (Bitbake rev: 25bfa2478f1c3a8eb695e1e5760e06db5be8f2fc) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: command/runqueue: Fix shutdown logicRichard Purdie2014-07-211-1/+1
| | | | | | | | | | | | | | If you hit Ctrl+C at the right point, the system processes the request but merrily continues building. It turns out finish_runqueue() is called but this doesn't stop the later generation and execution of the runqueue. This patch adjusts some of the conditionals to ensure the build really does stop. (Bitbake rev: 39b08c604ba713100e174c136f81f18eca6ef33d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: cooker: mark setFeatures command as read-onlyAlexandru DAMIAN2014-04-011-0/+4
| | | | | | | | | | | | | | | | This patch makes sure that the setFeatures command is marked as read-only and that it can only run if the cooker is in the initial state. Additionally, remove logging from the XMLRPC module in favor of sending the exception to the client for easy processing. [YOCTO #6089] (Bitbake rev: f0a1a3e24757f7658d272035620465f92a3e4c3c) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cooker/command: Add setFeatures commandRichard Purdie2014-03-101-0/+7
| | | | | | | | | Add a command to allow backends to set particular 'features' on the cooker (server). (Bitbake rev: f547d6ec6cfd677d71fa96dd3c69823c00dc6c69) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cooker/command/hob: Cleanup configuration init/reset functions and ↵Richard Purdie2013-12-031-24/+14
| | | | | | | | | | | | | | | | | | | | | | | | commands initConfigurationData and loadConfigurationData are similar functions, the only reason for them appears to be to be able to reset the pre/post configuration files. The current code is confusing and unmaintainable. Instead this patch creates a new Sync command which allows these to be explicitly set. The init and load functions can then be merged into one. There is then no need for a parseConfiguration command, we can simply reset the server to have the settings take effect. The reset fuction is not an instant value return and triggers an event so it should be an Async command, not a sync one. The number of calls for the set pre/post command is probably higher than it need be but someone with more familiarity with the hob code base can probably figure out the right places its needed (maybe just init_cooker?). (Bitbake rev: bae5210d7e048022f083361964ebec7daf1608f7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cooker/command: Add error state for the server and use for ↵Richard Purdie2013-10-141-0/+2
| | | | | | | | | | | | | | pre_serve errors Currently if errors occur when starting the PR service, there is a race that occurs since the UI runs various commands including starting builds before processing the CookerExit(). By adding the error state and refusing to run async commands in this mode, builds are prevented from starting and the UI reaches the exit code with the system shutting down cleanly. (Bitbake rev: 42fa34142ea685f91115a551e74416ca28ef1c91) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake/hob: removing extra parameters from conf files using hobCristiana Voicu2013-10-071-0/+7
| | | | | | | | | | | | | In Hob settings, there is a tab to add/remove extra settings. This patch implements a way to "remove" variables from conf files, through bitbake. But, to keep the history assigment of the variables synchronized, instead of removing, it replaces the lines with blank lines. [YOCTO #5284] (Bitbake rev: bd720fb63cef6b399619b8fbcaeb8d7710f2d6df) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: cooker, command: add a command to return global dataAlexandru DAMIAN2013-09-221-0/+9
| | | | | | | | | | | | | | Adding the 'getAllKeysWithFlags' read-only command that will return a dump of the global data state, together with specified flags for each key. The flag list is passed in as the first parameter to the command. This will be used by UI clients to get the build configuration. (Bitbake rev: 3e094da513e1220319288806cb76ddf804772afd) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: command: Treat empty messages as failures, not CommandCompletedRichard Purdie2013-09-141-1/+1
| | | | | | | | | Empty messages should trigger CommandFailed, not CommandCompleted as otherwise the exit code will be incorrect. (Bitbake rev: 70a8ead31f9ffc987d9c6db61a926f7a9af8f8b1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cooker/command: Add finishcommand to reset cooker stateRichard Purdie2013-09-141-1/+1
| | | | | | | | | | | | | After running a command on the server, it needs to reset to the initial state. This ensures that subsequent clients start from a known state and notice any configuration changes. Ultimately we may want to do more than this buts a good start and better than nothing. (Bitbake rev: dd15648fc2654b8d7c3e00ea7ab3dbf04f24f24b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cooker: Rename confusing 'stop' state to 'forceshutdown'Richard Purdie2013-09-141-3/+3
| | | | | | | | | | | | The shutdown state causes the server to finish what its doing, stop was them meant to completely stop it. It doesn't mean the server is stopped though. Renaming the current stop event for forceshutdown gives more meaning to what it actually does. The stopped namespace then becomes available to indicate a completely stopped server. (Bitbake rev: 12e9d33bfae5294e3870dfd1202f63383ad05e92) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: command.py: Call updateCache for all states != runningRichard Purdie2013-08-261-2/+1
| | | | | | | | | | | updateCache handles the logic for shutting down the parsing so we need to call it for all cases when we're not running. This fixes hangs if Ctrl+C is pressed during parsing. (Bitbake rev: 552b8935dd2f9f11e8d5c08a597a7e966b891480) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Add ui event handlers filteringRichard Purdie2013-08-261-0/+7
| | | | | | | | | | | | | | | | | | | Add functionality to allow UIs to update and change the types of events they recieve. To do this we need to add a new command and also need to be able to obtain the current event hander ID. In the case of xmlrpc, this is straightforward, in the case of the process server we need to save the result in a multiprocessing.Value() so we can retrive it. An excplit command was added to the server API to facilitate this. The same function can also be used to mask or unmask specific log messages, allowing the UI to optionally differ from the standard set of message filtering. Based upon work by Cristiana Voicu <cristiana.voicu@intel.com> (Bitbake rev: ba5a6c88785d9889d4172ec79937ac2a5555327e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: hob & bitbake: append a value to a variable from hob throught bitbakeCristiana Voicu2013-08-061-2/+3
| | | | | | | | | | | | It was necessary to append ${TOPDIR}/recipes/images to BBFILES. Implemented the mechanism to append a value to a variable: a command and the method in cooker. [YOCTO #4193] (Bitbake rev: 4aedbee90bd92395c2460a68702e6ede00e256c9) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: hob/bitbake: save the description of a custom imageCristiana Voicu2013-08-061-1/+2
| | | | | | | | | | | | When an new image is saved, the dialog for this action has a field for the description. Changed how an image is saved, by appending the DESCRIPTION variable at the end of the .bb file. [YOCTO #4193] (Bitbake rev: 5629007f2b984005e3a8ac5d9b71422cbc2f1409) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: hob/bitbake: create a template (a .bb file) from hob through bitbakeCristiana Voicu2013-08-061-1/+7
| | | | | | | | | | | | | | Modified generateNewImage function from cooker, in order to be used to save a template in Hob. Created a command to ensure that some dirs are created. The templates (recipes) will be saved in {TOPDIR}/recipes/images folder. Called these methods from Hob. [YOCTO #4193] (Bitbake rev: 96ffa00945c7eb09a0132fa47159aef3ef20fb3e) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: call the initConfiguration when reparsingCristiana Voicu2013-06-201-1/+1
| | | | | | | | | | | | As it is implemented now, when parsing the configuration files is needed, it also needs an initialization. Also, implemented a function to create an extra configuration files which can be used as postfile/prefiles when parsing. (Bitbake rev: 5fe23c1b51da14f58f8c483f43f30b48766a0913) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: remove the function for reparse because it does nothingCristiana Voicu2013-06-201-8/+0
| | | | | | | | | | | The command for reparse does nothing, so I have managed to remove it, because it can be misleading. When a reparse is needed, it can be used the parse function. (Bitbake rev: 188eaba121789112ffeb1188f0984d23dfe8df4f) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake & hob: modify some commands and call them from hobCristiana Voicu2013-06-201-3/+13
| | | | | | | | | | | | | This patch adds a new command to create an extra configuration file, in order to create it from Hob. Also, it calls the enable/disable data tracking when needed. Modified the prefiles and postfiles variables because the cooker expects some lists. (Bitbake rev: 92393701adcfa181a1090e3632bc6df7ee7852e6) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: knotty, xmlrpc: add observer-only modeAlexandru DAMIAN2013-06-171-1/+6
| | | | | | | | | | | | | | | | | | | | | I add an observer only mode for the knotty UI and the XMLRPC server that will allow the UI to register a callback with a server in order to receive events. The observer-UI is able to send read-only commands to the server, and also is able to register as an event handler. Read-only commands are the commands that do not change the state of the server and have been marked as such in the command module. The observer can switch to a full client if it calls addClient at any time, and the server has no other client running. (Bitbake rev: 4de9ee21f1fa4d04937cc7430fb1fc8b7a8f61e2) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cooker: Split data from configurationRichard Purdie2013-06-071-9/+9
| | | | | | | | | | | The reasons for combining these objects is ancient history, it makes sense to clean things up and separate them out now. This follows on logically from the configuration cleansups and leads well into the bitbake-worker changes. (Bitbake rev: 89ffd62661ebcf2a97ce0c8dfd5e4d5bfbe27de7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cooker/cookerdata: Improve configuration object handlingRichard Purdie2013-05-241-1/+3
| | | | | | | | | | | | | | | | | | | | | Originally it seemed like a good idea to keep the parameters around. Having seen this in real life use, its incorrect, we should pull all the data we need into the cooker's configuguration and then use this to build the datastore. Being able to just build the datastore from the parameters seemed like a good idea but having a dummy cooker configuration object is now looking like the better option. This also fixes failures in hob since the parseFiles command can call into cooker directly now and reset the configuration prefiles and postfiles at will, rather than the indirect calls before which were breaking the datastore (e.g. BBPATH wasn't set). The cleanup this allows in tinfoil illustrates how this change makes more sense. (Bitbake rev: f50df5b891bf318f12fc61c74adfcc626cc6f836) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: command: Fix function module reference after code rearrangementRichard Purdie2013-05-221-1/+1
| | | | | | (Bitbake rev: ff9f62fd5f76892ad41a5329b75472501e17e712) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cooker: Move commandline parsing back into the UI/cookerdataRichard Purdie2013-05-221-12/+8
| | | | | | | | | | | | | | | | | | | | | Building up a set of actions for the server is tricky since we depend upon the commandline but fall back to values from the datastore. We should be able to build a datastore without a commandline and vice versa. Ultimately the UI should send the commands to the server. This patch amounts to code rearranging, moving the heavy lifting to the UI, though a helper in the configuration option. This will need further cleanup/tweaking but this should be the only update needed to the UIs. The code now queries the server for any missing data should it need to. This code allows various knowledge of configuration variables to move to the UI side only, partcularly pkgs_to_build but also all the command specifiers. It should also be possible to move cmd eventually, I'm just unsure if any callers call the commands expecting this to default to something sane right now. (Bitbake rev: 2dbbb1d51dafd4451fef8fe16f095bcd4b8f1177) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Create cookerdata splitting config from cooker and bin/bitbakeRichard Purdie2013-05-221-1/+1
| | | | | | | | | | | | | | | | | | | Currently the UI and server configuration is one big incestuous mess. To start to untangle this we creater cookerdata, a new module which contains various confiuration modules and the code for building the base datastore. To start with we add a ConfigParameters() class which contains information about both the commandline configuration and the original environment. The CookerConfiguration class is created to contain the cooker.configuration options. This means we can transfer new paramters to the server over something like XMLRPC and then build a new configuration from these on the server. Based on a patch from Alexandru Damian <alexandru.damian@intel.com> (Bitbake rev: 35bd5997e8d8e74bc36019030cc10c560a8134f9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: hob: some settings in Hob are not rememberedCristiana Voicu2013-03-191-7/+0
| | | | | | | | | | | | | Some settings in Hob were not saved in Bitbake and they were not displayed correcty in Hob, because Hob used some other variables with the extension "_HOB". I have removed this, in order to have a consistency for the variables. ALso, I called a function to load the extra variables saved in .hob/template_default.hob. [YOCTO #3957] (Bitbake rev: 0f62a12ef3fa4daf8f3a289c984115302b75c23d) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake & hob: implement functions to assure consistency for ↵Cristiana Voicu2013-01-311-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | configuration files Added a new command in bitbake to save a variable in a file; added a function in cooker which is called by this command. Added new command in bitbake to enable/disable data tracking. The function saveConfigurationVar from cooker.py saves a variable in the file that is received by argument. It checks all the operations made on that variable, using the history. If it's the first time when it does some changes on a variable,it comments the lines where an operation is made on it, and it sets it in a line to the end of file. If it's not the first time(it has a comment before), it replaces the line. Made some changes in hob to save the variables from bblayers.conf and local.conf using the bitbake command. [YOCTO #2934] (Bitbake rev: 55b814ccfa413d461d12956896364ab63eed70a8) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: hob/bitbake: custom image is now using the base imageCristiana Voicu2012-12-141-0/+10
| | | | | | | | | | | | | Till now, a custom image made in Hob was using only the packages from the base image. Now it is using everything declared in the base image. Also next to hob-image.bb, it creates another .bb file which is used in building process. Those images are ignored by git. [YOCTO #2601] (Bitbake rev: 22007cf71a00fbb03b40f97201a6eb06c9aebd16) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: command: Fix getCmdLineAction bugsRichard Purdie2012-12-141-2/+4
| | | | | | | | | | | Executing "bitbake" doesn't get a sane message since the None return value wasn't being handled correctly. Also fix msg -> cmd_action['msg'] as otherwise an invalid variable is accessed which then crashes the server due to the previous bug. (Bitbake rev: c6211291ae07410832031a5274690437cc2b09a6) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: command: Add missing import tracebackRichard Purdie2012-12-141-0/+1
| | | | | | | | | Without this, if an exception occurs the server will silently crash with no feedback to the user about why (since traceback isn't imported). (Bitbake rev: e637a635bf7b5a9a2e9dc20afc18aceec98d578f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: command: add error to return of runCommandChristopher Larson2012-11-011-16/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, command.py can return an error message from runCommand, due to being unable to run the command, yet few of our UIs (just hob) can handle it today. This can result in seeing a TypeError with traceback in certain rare circumstances. To resolve this, we need a clean way to get errors back from runCommand, without having to isinstance() the return value. This implements such a thing by making runCommand also return an error (or None if no error occurred). As runCommand now has a method of returning errors, we can also alter the getCmdLineAction bits such that the returned value is just the action, not an additional message. If a sync command wants to return an error, it raises CommandError(message), and the message will be passed to the caller appropriately. Example Usage: result, error = server.runCommand(...) if error: log.error('Unable to run command: %s' % error) return 1 (Bitbake rev: 717831b8315cb3904d9b590e633000bc897e8fb6) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/command.py: ensure setVariable only sets values as stringsPaul Eggleton2012-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | This is the interface Hob uses to set variable values in many instances, and at the moment it is possible that some of the values it passes are not strings. If a non-string value gets into the datastore it can trigger exceptions during parsing when we attempt to expand the variable and substitute in the non-string value. This fixes using the meta-ti layer within Hob - it currently has a reference to BB_NUMBER_THREADS within a shell function and since this is a variable that Hob was setting from its configuration as an integer, due to the above this was triggering an ExpansionError. Fixes [YOCTO #2875]. (Bitbake rev: 855b71d8a8e468bfeff9e1a6699d79d68ab27aa1) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* ConfHandler.py: Add a hook for config parsingRichard Purdie2012-04-131-0/+7
| | | | | | | | | | | To make the UI settings take effect, we need to hook at the end of each config file parsing and set UI specific values. (Bitbake rev: f54e733c7863110896f43900d9e4e791602f9d65) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* command.py: Move triggerEvent to command async classDongxiao Xu2012-03-291-7/+10
| | | | | | | | | | | The parameters in triggerEvent function is an event object, and it may cost some time to pass this object through pipe, causing the pipe's poll() function timeout. Change it to async mode. (Bitbake rev: 3b5909ebc86a12dedfb30e5446aa81eb58921760) Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* command.py: remove the resolve parameter in generateTargetsTreeDongxiao Xu2012-03-011-12/+2
| | | | | | | | | | Remove the "resolve" parameter since the original resolve=False option is no longer be used. (Bitbake rev: dadce609149cfb09ecdc53bfe1f416a3f57a5033) Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* command.py: add resolve option for generateTargetsTree APIDongxiao Xu2012-02-231-2/+9
| | | | | | | | | | | | | | | Currently we have generateTargetsTree API, which is used to get dependency information. However in that tree, there will be "virtual/xxx" in depends fields. Therefore we add the resolve option to replace it with its real providers. Besides, for packages that provided by multiple recipes, we will find their preverred provider. (Bitbake rev: 28501612efdfc6ee47576cc90deb6e897883e7f5) Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* command.py: Add a new API triggerEvent()Dongxiao Xu2012-02-231-0/+6
| | | | | | | | | | This functions enables the client to request triggering specific event from bitbake server. (Bitbake rev: 45da6d709a69697158fae92e1c0c0a6ac8f30831) Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* command.py: add new API to get the cpu count on the serverShane Wang2012-02-231-0/+6
| | | | | | | | | Add a new API in command.py to get the cpu count in order to set the appropriate default BB_NUMBER_THREADS and PARALLEL_MAKE variables. (Bitbake rev: 335047b2e440e65713e88fabb24b47a9c82f939b) Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: Add BBHandledException exception classRichard Purdie2012-01-101-2/+5
| | | | | | | | | | | | | | | | | | | | | | | We have a problem knowing when to show the user debug information and when not to since the code has already shown the user suitable information about why a failure is occurring. This patch adds a bb.BBHandledException exception class which can be used to identify those exceptions which don't need further explanation to the user. This patch uses this class for the bb.providers exceptions and ensures the command handling code correctly filters the exceptions meaning that "bitbake invalid" now shows an simple error message and not a python traceback. [YOCTO #1141 partial] (Bitbake rev: eac9249b40ae1e3aa21e016010c862664e59a8d4) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* command.py: add parseConfigurationFiles APIDongxiao Xu2012-01-061-0/+10
| | | | | | | | | | The parseConfigurationFiles API calls the related function in cooker.py to parse config files. (Bitbake rev: 96c307b9874131ad8c7d9caea6f6dfbd09aab9d4) Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>