aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2020-08-28COW: formattingChris Laplante
Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-26server/process: Fix typo in code causing tracebacksRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-26utils: Drop broken timeout functionRichard Purdie
I strongly suspect this function doesn't work with modern python so and its unused now, drop it. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-26process: Avoid bb.utils.timeoutRichard Purdie
I have a suspicion based on process traces that the flock() call is no longer interrupted by SIGALRM and hence the timeout doesn't work. We were relying on EINTR triggering around syscalls but python is likely protecting us from that in modern versions. Re-implement this code with a different mechanism which doesn't have that potential issue. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-25compat.py: remove file since it no longer actually implements anythingChris Laplante
Now that compat.py just imports Python standard library stuff, get rid of the layer of indirection. Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-25server/process: Use sys.executable for bitbake-serverRichard Purdie
Using sys.executable ensures we're using the same python binary for the server as the client, which is probably advisable. "bitbake-server" is left as the process name as its more distinctive in process listings. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-25fetch2: Drop globbing supprt in file:// SRC_URIsRichard Purdie
Globbing in file:// urls is terminally broken. Currently when its used, the file checksum code is basically bypassed. This means changes to the source files don't change the task checksum, the task doesn't rebuild when the inputs change and things generally break. To make globbing work generically, we'd have to scan the file system for all possible matches to the glob and log whether they exist or not. We can't simply log the files which exist, we have to also know which files could later exist and influence the choice of file so we know when to reparse. For a simple file://xxx/*, this could be done but for bigger patterns, it becomes much more problemtic. We already support file://xxx/ in urls. So, lets decide we'll not support globs in file://urls. Worse case users can put files in a directory and reference that, moving files into place if needed. Remove all the glob special cases (see the comments if anyone doesn't believe this is terminally broken) and error to the user if they have such urls. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-25lib: fix most undefined code picked up by pylintFrazer Clews
Correctly import, and inherit functions, and variables. Also fix some typos and remove some Python 2 code that isn't recognised. Signed-off-by: Frazer Clews <frazerleslieclews@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-25cooker: Ensure cooker's enviroment is updated on updateConfigRichard Purdie
Only the env variables which were added to the datastore were being updated. We need to update the whole copy, we just only trigger a reparse if any of the variables making it into the datastore change. This avoids a bug where variables such as DISPLAY in a new UI context would break under memory resident bitbake. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-25runqueue: Don't use sys.argvRichard Purdie
We should not be using sys.argv inside the server to decide which targets the user added on the commandline. There might not even be a commandline. Thankfully the targets variable is easily accessible in this context and contains this exact data we want. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-25server/process: Add bitbake-server and exec() a new server processRichard Purdie
Trying to have a new python process forked off an original doesn't work out well and ends up having race issues. To avoid this, exec() a new bitbake server process. This starts with a fresh python interpreter and resolves various atexit and other multiprocessing issues once and for all. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24server/process: Log extra threads at exitRichard Purdie
Dump info into the logs if there are extra threads left at process exit time. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24cooker: Ensure BB_ORIGENV is updated by changes to configuration.envRichard Purdie
Changes to configuration.env were not updating BB_ORIGENV, fix this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24main/server/process: Drop configuration object passingRichard Purdie
The first thing the UIs do is update the server config from the UI. We can just rely upon that and start the server with a standard config, removing the need to pass the confusing configuration object around as well as configParams, which contains a similar copy of some of the data. This makes memory resident bitbake work the same way as the normal mode, removing the opportunity for some class of bugs. The xmlrpcinterface and server_timeout values are passed in at server startup time now and there no longer a second option in the configuration which is effective ignored once the server starts. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24server/process: Move the socket code to server process onlyRichard Purdie
The sock object isn't used client side so we can just created it in the server process and save passing around the fd/object. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24cooker: Defer configuration init to after UI connectionRichard Purdie
Currently we end up parsing the base configuration multiple times as initially, the right settings haven't come from the UI. We can defer this until later in startup using runCommand as a trigger. The advantage to doing this is improved startup times and ultimately we should be able to avoid the double parse of the base configuration. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24cooker/cookerdata: Ensure UI event log is updated from commandlineRichard Purdie
Currently the eventlog is not handled correctly for memory resident bitbake. Fix this by allowing adpations to configuration changes. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24cookerdata: Ensure UI options are updated to the serverRichard Purdie
There were some options which were not being passed to the server. This was breaking, particularly in memory resident bitbake mode. Add the missing options to the correct place to ensure the server is updated correctly. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24cooker/cookerdata/main: Improve loglevel handlingRichard Purdie
Rather than passing debug/verbose/debug_domains around, pass the computed output of these. Ensure that the cooker sets the levels to match the levels currently set in the UI and generally try and make it easier to understand what the code is doing. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24build/msg: Cleanup verbose option handlingRichard Purdie
The levels of indirection to set these verbose logging options is rather crazy. This attempts to turn things into two specific options with much more specific meanings. For now its all still controlled by the commandline verbose option and should funciton as previously, with the addition that the BB_VERBOSE_LOGS option can now be task specific. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-23fetch2: Drop cups.org from wget status checksRichard Purdie
Its becomming clear the upstream server doesn't like this, drop these two urls from the test, not sure we need them here anyway. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-23cooker: Explictly shut down the sync threadRichard Purdie
Hongxu Jia reported a problem where the bb_cache files were not always being written out correctly. This was due to the sync thread being terminated prematurely. Whilst the preceeding changes mean the exit handler for this thread is now correctly called since we switch to using sys.exit() instead of os._exit(), this write can happen after we drop the bitbake lock, leading to potential races. Avoid that headache by adding in explicit thread join() calls before we drop the lock (which atexit or Finalize can't do). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-23cooker: Ensure parse_quit thread is closed downRichard Purdie
Each run through the parser would leak a thread from the queue created to shut the parser down. Close this down correctly and clean up the code flow slightly whilst in the area, making sure this thread does shut down correctly (we don't care if it loses data). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-22fetch2/wget: Remove buffering parameterRichard Purdie
The buffering parameter was removed in python 3.1 and made default so we can clean up the code. This removes weird looking double exceptions when connections fail. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-22siggen: clean_basepath: remove recipe full path when virtual:xyz presentJean-Francois Dagenais
Before this fix, this example basepath (a): virtual:native:/full/path/to/recipes-example/helloworld/helloworld_1.2.3.bb:do_compile would get incorrectly "cleaned" into: helloworld/helloworld_1.2.3.bb:do_compile:virtual:native:/full/path/to/recipes-example/helloworld/helloworld_1.2.3.bb When searching backwards in `a` trying to isolate the 'virtual:xyz' to add it to the end of the string, we need to consider `a` still has the recipe path and taskname. So stoping the rsplit after only 1 split is not enough. We want to reach the second ':' from the end. This way, we obtain: helloworld/helloworld_1.2.3.bb:do_compile:virtual:native reviewed-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com> Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-20build: make shell traps less chatty when 'bitbake -v' is usedChris Laplante
This shuts up both the DEBUG and EXIT handlers. Also, remove an unneeded "set -o errtrace" (i.e. set -E), since we no longer use an ERR trap. Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-14build: print a backtrace with the original metadata locations of Bash shell ↵Chris Laplante
funcs Leverage the comments that emit_var writes and the backtrace that the shell func writes to generate an additional metadata-relative backtrace. This will help the user troubleshoot shell funcs much more easily. Example: | WARNING: /home/laplante/repos/oe-core/build/tmp-glibc/work/core2-64-oe-linux/libsolv/0.7.14-r0/temp/run.do_compile.68955:171 exit 1 from 'exit 1' | WARNING: Backtrace (BB generated script): | #1: myclass_do_something, /home/laplante/repos/oe-core/build/tmp-glibc/work/core2-64-oe-linux/libsolv/0.7.14-r0/temp/run.do_compile.68955, line 171 | #2: do_something, /home/laplante/repos/oe-core/build/tmp-glibc/work/core2-64-oe-linux/libsolv/0.7.14-r0/temp/run.do_compile.68955, line 166 | #3: actually_fail, /home/laplante/repos/oe-core/build/tmp-glibc/work/core2-64-oe-linux/libsolv/0.7.14-r0/temp/run.do_compile.68955, line 153 | #4: my_compile_extra, /home/laplante/repos/oe-core/build/tmp-glibc/work/core2-64-oe-linux/libsolv/0.7.14-r0/temp/run.do_compile.68955, line 155 | #5: do_compile, /home/laplante/repos/oe-core/build/tmp-glibc/work/core2-64-oe-linux/libsolv/0.7.14-r0/temp/run.do_compile.68955, line 141 | #6: main, /home/laplante/repos/oe-core/build/tmp-glibc/work/core2-64-oe-linux/libsolv/0.7.14-r0/temp/run.do_compile.68955, line 184 | | Backtrace (metadata-relative locations): | #1: myclass_do_something, /home/laplante/repos/oe-core/meta/classes/myclass.bbclass, line 2 | #2: do_something, autogenerated, line 2 | #3: actually_fail, /home/laplante/repos/oe-core/meta/recipes-extended/libsolv/libsolv_0.7.14.bb, line 36 | #4: my_compile_extra, /home/laplante/repos/oe-core/meta/recipes-extended/libsolv/libsolv_0.7.14.bb, line 38 | #5: do_compile, autogenerated, line 3 ERROR: Task (/home/laplante/repos/oe-core/meta/recipes-extended/libsolv/libsolv_0.7.14.bb:do_compile) failed with exit code '1' NOTE: Tasks Summary: Attempted 542 tasks of which 541 didn't need to be rerun and 1 failed. Summary: 1 task failed: /home/laplante/repos/oe-core/meta/recipes-extended/libsolv/libsolv_0.7.14.bb:do_compile Summary: There was 1 ERROR message shown, returning a non-zero exit code. Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-14build: print a backtrace when a Bash shell function failsChris Laplante
The trick here is to use a DEBUG trap to record the line number of each command as they execute. This is so we can report the real line number of the failing command, which is otherwise not possible in a Bash EXIT trap. See http://gnu-bash.2382.n7.nabble.com/trap-echo-quot-trap-exit-on-LINENO-quot-EXIT-gt-wrong-linenumber-td3666.html Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-12server/process: Add extra logfile flushingRichard Purdie
There is the possibility data is being lost from the logfile due to data buffering. Add in a couple of extra flush calls to ensure data is being written out before the lock file is dropped. Possible fix for [YOCTO #14000]? Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-12server/process: Pass timeout/xmlrpc parameters directly to the serverRichard Purdie
Further cleanup, just pass these settings directly. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-12server/process: Simplfy idle callback handler functionRichard Purdie
Having the idle callbacks abstracted via the configuration object makes no sense. Its like this for historical reasons from the multiple server backends but we don't need this now so simplfy. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-12server/process: Remove pointless process forkingRichard Purdie
We already call bb.daemonize.createDaemon() in BitBakeServer so the extra multiprocessing.Process() appears to be totally unneeded and just an extra layer of forking which confuses things. Remove it. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-07data: emit filename/lineno information for shell functionsChris Laplante
Make it easier for users to debug shell task failure by including some breadcrumbs in the emitted .run file that (hopefully) points to the .bb/.bbclass file where the shell function was defined. Unfortunately this won't work with functions with _append or _prepends, since BitBake wipes the filename/lineno information. This shouldn't be too hard to fix; for now, you'll just see comments like this for such functions: [YOCTO #7877] Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-07tests/color: add test suite for ANSI color code filteringChris Laplante
Includes tests for bb.progress integration. Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-07progress: filter ANSI escape codes before looking for progress textChris Laplante
This is in prepartion for introducing the log-colorizer bbclass into poky. Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-07progress: fix hypothetical NameError if 'progress' isn't setChris Laplante
Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-07progress: modernize syntax, formatChris Laplante
Also fixes DummyMultiStageProcessProgressReporter calling the wrong super __init__ Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-28build: create_progress_handler: fix calling 'get' on NoneTypeChris Laplante
Just use the |resolve| function which already takes care of it. Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-28build: print traceback if progress handler can't be createdChris Laplante
Before: ERROR: expat-native-2.2.9-r0 do_compile: 'NoneType' object has no attribute 'get' ERROR: Logfile of failure stored in: /home/laplante/repos/oe-core/build/tmp-glibc/work/x86_64-linux/expat-native/2.2.9-r0/temp/log.do_compile.90289 Log data follows: | ERROR: 'NoneType' object has no attribute 'get' ERROR: Task (virtual:native:/home/laplante/repos/oe-core/meta/recipes-core/expat/expat_2.2.9.bb:do_compile) failed with exit code '1' After: ERROR: expat-native-2.2.9-r0 do_configure: Failed to create progress handler ERROR: expat-native-2.2.9-r0 do_configure: Traceback (most recent call last): File "/home/laplante/repos/oe-core/bitbake/lib/bb/build.py", line 400, in exec_func_shell logfile = create_progress_handler(func, progress, logfile, d) File "/home/laplante/repos/oe-core/bitbake/lib/bb/build.py", line 344, in create_progress_handler cls_obj = functools.reduce(resolve, cls.split("."), bb.utils._context) File "/home/laplante/repos/oe-core/bitbake/lib/bb/build.py", line 343, in resolve return x.get(y) AttributeError: 'NoneType' object has no attribute 'get' ERROR: expat-native-2.2.9-r0 do_configure: 'NoneType' object has no attribute 'get' ERROR: Logfile of failure stored in: /home/laplante/repos/oe-core/build/tmp-glibc/work/x86_64-linux/expat-native/2.2.9-r0/temp/log.do_configure.22982 ERROR: Task (virtual:native:/home/laplante/repos/oe-core/meta/recipes-core/expat/expat_2.2.9.bb:do_configure) failed with exit code '1' Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-27server/process: Account for xmlrpc connectionsRichard Purdie
UI control can happen via the xmlrpc connection. Account for this when timing out UI connections. This was causing issues for toaster on systems where it couldn't parse the metadata within the timeout. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-27server/process: Fix UI first connection trackingRichard Purdie
We're only meant to be doing UI connection timeouts on the first connection but haveui changes for each connection. We need to add a specific variable to track this correctly and get the intended behaviour. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-23bitbake: command: Handle multiconfig in findSigInfoJoshua Watt
Changes the findSigInfo command to accept a recipe specified with the multiconfig prefix Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-22cooker: Handle multiconfig name mappings correctlyRichard Purdie
"bitbake mc:arm:bash mc:arm:busybox" works but "bitbake multiconfig:arm:bash multiconfig:arm:busybox" does not. The reason is the list is modified whilst iterating. Don't do that. [YOCTO #13607] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-22cooker: Improve multiconfig configuration error reportingRichard Purdie
This avoids a traceback if an invalid multiconfig is referenced in the bitbake commandline and tweaks the message to make it more understanable. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-21build: Allow deltask to take multiple tasknamesRichard Purdie
deltask currently supports only one task to delete but it would be useful if it could support a variable which gets expanded to allow flexibility in the metadata. This is simple to support in bitbake and is how other directives such as inherit operate so adjust the parser/code to handle that. It means that syntax like: EXTRA_NOPACKAGE_DELTASKS = "" deltask ${EXTRA_NOPACKAGE_DELTASKS} is now allowed. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-21cooker: Fix unmatched files handling leading to misleading warningsRichard Purdie
Currently if all recipes in a layer are skipped, there are warnings that the BBFILE_PATTERN_ entry didn't match anything. We probably shouldn't do this for skipped recipes. The current code is hard to understand, not least as it passes variables which functions modify by reference rather than giving a return value. Update calc_bbfile_priority() to return values rather than modifying them. Refactor the code to try and make it clearer what its doing and fix the skipped recipe issue by passing in the list of parsed files. The function is complicated by the need to not rerun regex matching more than we ever have to which complicates the flow, it would be easier if we just reran operations multiple times. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-20server/process: Fix note reference -> infoRichard Purdie
Its bb.note or logger.info, this avoids a backtrace. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-12server/process: Ensure UI-less servers don't sit in infinite loopsRichard Purdie
If server startup is broken for some reason (e.g. lockfile issues) and no UI connection is made, the server will just sit inifinitely waiting. Add a timeout upon startup in the non-memory resident case so that such infinite waits are avoided. In the memory resident case, the server wouldn't have shut down in the first place or will timeout according to configuration. Since any race may mean the socket file is no longer present, ensure the unlink doesn't fault upon exit, thus ensuring any hashequiv or PRServ is removed from memory, allowing all processes to exit cleanly in such scenarios. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-12server/process: Fix a rare lockfile raceRichard Purdie
We're seeing rare occasional races on the autobuilder as if two server processes have the lockfile at the same time. We need to be extremely careful this does not happen. I think there is a potential race in this shutdown code since we delete the lockfile, then call unlockfile() which also tries to delete it. This means we may remove a lock file now held by another process if we're unlucky. Since unlockfile removes the lockfile when it can, just rely on that and remove any possible race window. An example cooker-deamonlog: --- Starting bitbake server pid 2266 at 2020-07-11 06:17:18.210777 --- Started bitbake server pid 2266 Entering server connection loop Accepting [<socket.socket fd=20, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, laddr=bitbake.sock>] ([]) Processing Client Connecting Client Running command ['setFeatures', [2]] Running command ['updateConfig', XXX] Running command ['getVariable', 'BBINCLUDELOGS'] Running command ['getVariable', 'BBINCLUDELOGS_LINES'] Running command ['getSetVariable', 'BB_CONSOLELOG'] Running command ['getSetVariable', 'BB_LOGCONFIG'] Running command ['getUIHandlerNum'] Running command ['setEventMask', XXXX] Running command ['getVariable', 'BB_DEFAULT_TASK'] Running command ['setConfig', 'cmd', 'build'] Running command ['getVariable', 'BBTARGETS'] Running command ['parseFiles'] --- Starting bitbake server pid 8252 at 2020-07-11 06:17:28.584514 --- Started bitbake server pid 8252 --- Starting bitbake server pid 13278 at 2020-07-11 06:17:31.330635 --- Started bitbake server pid 13278 Running command ['dataStoreConnectorCmd', 0, 'getVar', ('BBMULTICONFIG',), {}] Running command ['getRecipes', ''] Running command ['clientComplete'] Processing Client Disconnecting Client No timeout, exiting. Exiting where it looks like there are two server processes running which should not be. In that build there was a process left sitting in memory with its bitbake.sock file missing but holding the lock (not sure why it wouldn't timeout/exit). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-12pyshyacc: allow double COMMA statementsKonrad Weihmann
this allows shell statements like '; ;' to pass the parser. As it may be bad code but still valid enough to execute Signed-off-by: Konrad Weihmann <kweihmann@outlook.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>