summaryrefslogtreecommitdiffstats
path: root/lib/bb
AgeCommit message (Collapse)Author
2017-08-24fetch2: don't mandate path element in encodeurl()paule/fetch2-encodeurl-fixPaul Eggleton
URLs do not have to have a path; currently our npm URLs don't, so encodeurl() needs to handle if the path element isn't specified. This fixes errors using OpenEmbedded's devtool add / recipetool create on an npm URL after OE-Core revision ecca596b75cfda2f798a0bdde75f4f774e23a95b that uses decodeurl() and encodeurl() to change URL parameter values. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-08-23bitbake: ui: Sort 'Dependent tasks' in taskexpJussi Kukkonen
The underlying model is already sorted for use in the other view, add a sorting model for the 'Dependent Tasks' view. Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-21process: Ensure we call select() to know which fds to readRichard Purdie
There is an interesting bug in the current code where a sync command is not seen until the current async command completes, by which time the UI may have shut down. The reason is that if there are idle commands, we may not end up sleeping in the select call at all, partiularly under heavy load like parsing. Fix this by calling select with a zero timeout so that we see active fds and know to read from them. This fixes various problems toaster was having with the recent server changes. [YOCTO #11898] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-15process: Increase server startup timeoutRichard Purdie
We're seeing the server fail to start within 8s on heavily loaded autobuilders so increase this timeout to 30s which should be more than enough time. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-14process: Improve client disconnectsRichard Purdie
There have been cases where the server could loop indefinitely and incorrectly handle client disconnects. In the EOFError case, ensure a full disconnect happens in the alternative disconnect path to avoid this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-09cooker: Ignore common bitbake files for the parse cache invalidationRichard Purdie
Writes to the cookerdaemon log and/or the lockfile were meaning the parser cache was always being invalidated and reparsed. This is unnecessary so spot accesses to these two common cases and ignore the files from a reparse perspective. This doesn't remove many sources of reparse but does improve several common cases. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-09cooker: Improve inotify overflow handlingRichard Purdie
Add a proper function for clearing the mtime cache. Clean up the inotify event overflow case to err on the side of caution and clear any potentially now out of sync caches. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-09cooker: Ensure we handle inotify before running the next commandRichard Purdie
The inotify watch events are handled "at idle" which could in theory mean a command could run before any preceeding inotify events have been processed. This leads to a theoretical race window where those events may have a signficicant effect on the command. Add a mechanism to allow us to ensure all pending events are processed before running commands. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-09cooker: Track directories searched for bbappend/bb filesRichard Purdie
Some of the directories searched by BBFILES are not currently being added to the inotify watch list. This can mean that added append files are not noticed leading to misleading metadata results when using BB_SERVER_TIMEOUT != 0. We use glob to expand the BBFILES references and without writing our own implentation, figuring out the directories it searches is hard. We use some horrible hacks here to intecept the listdir calls, I'm open to better ways to handle this but this does ensure we have the right watches set. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-09server/process: Ensure we don't loop on client EOFErrorRichard Purdie
The server currently crashes if we hit an EOFError due to controllersock still being in ready and the continue meaning ready isn't re-evaluated. Setting the value to False can mean the shutdown code doesn't handle the situation cleanly. Clear ready to avoid the crash/loop instead and handle any OSError whilst we're in here. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-09cooker/siggen: Reset siggen when reparsingRichard Purdie
If we don't do this, we get basehash mismatch errors occurring from the reparse which would then set bitbake's error exit code. This for example would cause oe-selftest -r bbtests.BitbakeTests.test_bbappend_order to fail with a non-zero BB_SERVER_TIMEOUT. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-08main: Handle BB_SERVER_TIMEOUT = -1 for no server timeoutRobert Yang
Make BB_SERVER_TIMEOUT = -1 mean no unload forever. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-08process: Fix disconnect when BB_SERVER_TIMEOUTRobert Yang
Fixed: $ export BB_SERVER_TIMEOUT=10000 $ bitbake --server-only $ bitbake --status-only [snip] File "/buildarea/lyang1/poky/bitbake/lib/bb/server/process.py", line 472, in recvfds msg, ancdata, flags, addr = sock.recvmsg(1, socket.CMSG_LEN(bytes_size)) OSError: [Errno 9] Bad file descriptor And: $ export BB_SERVER_TIMEOUT=10000 $ bitbake --server-only -B localhost:-1 $ bitbake --status-only # Everything is fine in first run $ bitbake --status-only [snip] File "/buildarea/lyang1/poky/bitbake/lib/bb/server/process.py", line 472, in recvfds msg, ancdata, flags, addr = sock.recvmsg(1, socket.CMSG_LEN(bytes_size)) OSError: [Errno 9] Bad file descriptor This was because self.controllersock was not set to False, so it still ran sock.recvmsg() when sock was closed. And also need set command_channel to Flase, otherwise the self.command_channel.get() will always run when EOF, and cause infinite loop. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-08main: Remove unneeded float()Robert Yang
There is already a type=float, so the float() is not needed, which also makes the error clearer: $ export BB_SERVER_TIMEOUT=10000AA With float(): $ bitbake quilt-native [snip] ValueError: could not convert string to float: '10000AA' Without float(): $ bitbake quilt-native [snip] optparse.OptionValueError: option --idle-timeout: invalid floating-point value: '10000AA' The second one tells clearly where is wrong. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-08Revert "tinfoil: fix duplication of log messages"Paul Eggleton
In combination with the recent server reworking, this change actually prevents messages sent from tasks from being logged properly. This will of course give us the duplicated messages back, and I really hate to do that effectively a second time, but that's better than seeing no error at all in the case of a failure - we'll have to find the proper way of avoiding the duplication that doesn't result in some messages going missing. This reverts commit 8a5bae76f91f2411187c638a42fa3c762052cf11. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-03daemonize: Always print any remaning UI events at exitRichard Purdie
If there are events in the UI queue we want to print them regardless of whether we're handling an exception or something like SystemExit. This improves error messages for some other failure cases where currently no logging would get printed and leave the user confused as to what went wrong. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-01cooker: Ensure all tasks are shown in task dependency treeRichard Purdie
"bitbake -g m4-native -c do_unpack" doesn't list any dependencies in task-depends.dot. This is because no header describing the task was added unless a task has dependencies. Tweak the code to fix this. [YOCTO #10893] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-31daemonize: clean up codeRichard Purdie
This was originally based on some other code but its mostly misleading comments now. Massively clean this up and accept its now a total fork. There are no funciton changes here, just cleanup. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-31daemonize: Ensure child process exits safelyRichard Purdie
When we create the child, if an exception occurred it was transfering back into the parent context. We don't want to do that us use a try/finally to ensure we exit. We need to ensure a traceback is printed and any queued UI messages which may not have made it to the client UI at this point. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-31process: Add some extra server startup logsRichard Purdie
We have cases where the server is being started but we're not seeing any messages from it. Add some earlier logging so we can try and better understand where issues may be occurring. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-31process: Reorder server command processing and handle EOFErrorRichard Purdie
If the connection control socket and the command channel close together, we can race and hit EOFError exceptions before we close the channel. Reorder the code to handle this in the correct order and ignore the EOFError exceptions as they mean the client is disconnecting and shouldn't terminate the server. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30wget: fix FusionForge workaroundRoss Burton
My previous assertion about FusionForge appears to have been wrong, or FusionForge has changed behaviour, or both. FusionForge now mandates that downloads have the Accept header set, despite that header being optional, and returns a 406 Not Acceptable error if it isn't set. As we were pretending that 406 was actually 405 (Moved) and tried to handle it as a redirect this results in an infinite loop until Python kills the recursion. Delete the handling of 406 as 405, and pass Accept: */* in the headers. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30runqueue: Tweak debug message to make it more readable/diffableRichard Purdie
Having this as one huge long line isn't easy to manipulate, split it into multiple lines for ease of debugging issues. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30fetch2: fix checkstatus fallback to MIRRORSRoss Burton
The checkstatus() code was expecting checkstatus to throw exceptions if it failed, but in general it should return False. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30tests/fetch: fix GitShallowTest.test_bitbakeChristopher Larson
`git fetch --tags` seems to interact badly with `mirror=fetch`, resulting in the regular branches not being fetched, so drop the unnecessary `--tags`. This fixes this unit test failure: `bb.fetch2.FetchError: Fetcher failure: Unable to resolve 'master' in upstream git repository in git ls-remote output for /tmp/tmp4ag_mgmn/gitsource` [YOCTO #11698] Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-28main: Always return 0 for bitbake --kill-serverRichard Purdie
If the server isn't running return 0 as to do otherwise complicates scripts which do cleanup of bitbake servers which would potentially be memory resident. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-28process: Clean up server communication timeout errorsRichard Purdie
This timeout path was commonly hit due to errors starting the server. Now we have a better way to handle that, the retry logic can be improved and cleaned up. This patch: * Makes the timeout 5s rather than intervals of 1s with a message. Paul noted some commands can take around 1s to run on a server which has just been started on a loaded system. * Allows a broke connection to exit immediately rather than retrying something which will never work. * Drops the Ctrl+C masking, we shouldn't need that anymore and any issues would be better handled in other ways. This should make things clearer and less confusing for users and is much cleaner code too. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-28process: Don't leak open pipes upon reconnectionRichard Purdie
If we reconnect to the server, stop leaking pipes and clean up after ourselves. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-28process/cooker: Allow UI process to know if the cooker was started successfullyRichard Purdie
Currently if the server fails to start, the user sees no error message and the server will be repeatedly attempted to be started until some longer timeouts expire. There are error messages in the cookerdeamon log but nobody thinks to look there. Add in a pipe which can be used to tell the starting process whether the cooker did actually start or not. If it fails to start, no further attempts can be made and if present, the log file can be shown to the user. [YOCTO #11834] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-28process: Move socket keep alive into BitBakeProcessServerConnectionRichard Purdie
This cleans up the socket keep alive into better class structured code and adds cleanup of the open file descriptors upon shutdown. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-28process: Allow BBUIEventQueue to exit cleanlyRichard Purdie
Currently the monitoring thread exits with some error code or runs indefinitely. Allow closure of the pipe its monitoring to have the thread exit cleanly/silently. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-28process: Ensure ConnectionReader/Writer have fileno() and close() methodsRichard Purdie
Expose the underlying close() and fileno() methods which allow connection monitoring and cleanup. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-28event: Don't write duplicate logs to stdout and stderr in no UI caseRichard Purdie
This code would duplicate messages to stdout and stderr when no UI connected and there were error level messages. Rework the code so it either uses stderr (for errors and above) or stdout for warnings/debug but not both for the same messages. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-27bitbake-diffsigs: fix regression after recent server changesPaul Eggleton
We were bridging the gap between the server and UI here by calling a bb.siggen.find_siginfo, a function defined and set on that module from the metadata. This worked from the UI side before but since the recent server changes is no longer accessible. Create a new command so this can execute on the server side and return the result by way of a new event. (We're still running compare_sigfiles() on the signature generator but that isn't quite the same thing and does still work.) Fixes [YOCTO #11844]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-27lib/fetch2/__init__.py: Fix unpack commentMark Hatle
Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-27lib/bb/utils.py: Add missing debug levelMark Hatle
Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-25fetch2/__init__.py: replace stray logger.warn() with logger.warning()Andre McCurdy
Update stray usage of deprecated logger.warn(), which was introduced to fetch2/__init__.py after all other instances had been replaced by logger.warning(): http://git.openembedded.org/bitbake/commit/?id=5a53e7d7b017769a6eb0f0a6335735a1fe51a5ec http://git.openembedded.org/bitbake/commit/?id=676a5f592e8507e81b8f748d58acfea7572f8796 Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-25fetch/wget: mitigate a wget race condition when listing FTP directoriesRoss Burton
When wget is fetching a listing for a directory over FTP it writes to a temporary file called .listing in the current directory. If there are many such operations happening in parallel - for example during 'bitbake world -c checkpkg' - then up to BB_NUMBER_THREADS instances of wget will be racing to write to, read, and delete the same file. This results in various failures such as the file disappearing before wget has processed it or the file changing contents, which causes checkpkg to randomly fail. Mitigate the race condition by creating a temporary directory to run wget in when doing directory listings. [ YOCTO #11828 ] Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-24process: Change timeout warning to a noteRichard Purdie
The warning message currently shown can occur more frequently than previously if a previous bitbake server is shutting down and we're reconnecting to a new server. Change it to a note message to match the higher level connection logging retry messages and so as not to interfer with selftests. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-24cooker/process: Drop server_main functionRichard Purdie
Now that there is only one server, this abstraction is no longer needed and causes indrection/confusion. The server shutdown is also broken with the cooker post_server calls happening too late, leading to "lock held" warnings in the logs if PRServ is enabled. Remove the abstraction and put the shutdown calls in the right order with respect to the locking. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21fetch2/wget.py: improve error handling during sstate checkPatrick Ohly
When the sstate is accessed via HTTP, the existence check can fail due to network issues, in which case bitbake silently continues without sstate. One such network issue is an HTTP server like Python's own SimpleHTTP which closes the TCP connection despite an explicit "Keep-Alive" in the HTTP request header. The server does that without a "close" in the HTTP response header, so the socket remains in the connection cache, leading to "urlopen failed: <urlopen error [Errno 9] Bad file descriptor>" (only visible in "bitbake -D -D" output) when trying to use the cached connection again. The connection might also get closed for other reasons (proxy, timeouts, etc.), so this is something that the client should be able to handle. This is achieved by checking for the error, removing the bad connection, and letting the check_status() method try again with a new connection. It is necessary to let the second attempt fail permanently, because bad proxy setups have been observed to also lead to such broken connections. In that case, we need to abort for real after trying twice, otherwise a build would just hang forever. [YOCTO #11782] Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21Update to version 1.35.0 (development version with server rework changes)Richard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21fetch2: fire an event when there are missing checksumsPaul Eggleton
If BB_STRICT_CHECKSUMS is set to anything other than "1" i.e. we're not going to raise an error, then fire an event so that scripts can listen for it and get the checksums. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21fetch2: allow hiding checksum warningPaul Eggleton
If BB_STRICT_CHECKSUMS is set to "ignore" then don't display a warning if no checksums are specified in the recipe. This is not intended to be used from recipes - it is needed when we move to using more standard code paths to fetch new files from scripts i.e. where we don't know what the checksums are in advance. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21tinfoil: add more doc commentsPaul Eggleton
We want this API to be easier to use, so add missing function documentation to help with that. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21tinfoil: add simple API for getting cached recipe informationPaul Eggleton
A common task for tinfoil-using scripts is to iterate over all recipes. This isn't too difficult with the current API, but the pkg_* variables are a little awkward and are really designed for bitbake's internal usage - and it gets a bit more difficult when you want to access some of the other information such as packages and rprovides. To resolve this, create a new recipe info class and add an all_recipes() function to generate this for all recipes. Also add a get_recipe_info() function to get the information for a specific recipe (by PN). (It might perhaps be suggested that we already have a structure similar to this in the cache, however the one we add here is designed for external use and allows the internal structures to change if needed without affecting the API). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21tinfoil: enable access to additional cached itemsPaul Eggleton
Add access to fn_provides, packages, packages_dynamic and rproviders on the recipecache object. This requires an additional corresponding command plumbing to be added. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21tinfoil: add functionality for running full buildsPaul Eggleton
Up to this point, if you wanted to run build tasks in the normal way they get run from a python script, there was no other way than to shell out to bitbake. Worse than that, you couldn't have tinfoil active during that because only one bitbake instance could be running at once. As long as we're prepared to handle the events produced, we can create a wrapper around calling the buildTargets command. Borrow code from knotty to do this in such a way that we get the expected running task display (courtesy of TermFilter) and Ctrl+C handling. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21knotty: make it possible to use termfilter without either consolePaul Eggleton
This isn't useful for knotty itself, but for use from tinfoil in case we can't get access to either the console or errconsole, allow either to be unspecified (None). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21lib/bb/ui/uihelper: indicate to caller of eventHandler() if events handledPaul Eggleton
It is useful for the caller to know whether the uihelper has handled the event passed so that it can skip other event handling code if so. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>