summaryrefslogtreecommitdiff
path: root/morphlib/extensions.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix `morph help-extensions` run outside a workspaceSam Thursfield2014-12-051-1/+3
| | | | | | | | | This command would use the sysbranchdir.open_from_within() function call to search for a system branch, which traverses all subdirectories looking for a directory. This is useful behaviour, but if the user ran `morph help-extensions` in / it'd traverse their whole filesystem before returning, which is stupid. This change means it only does the traverse if it already detected a workspace.
* Make deployment extensions use unshared_cmdlineRichard Maw2014-10-301-4/+1
|
* Merge branch 'baserock/richardmaw/parallelism-improvements'Richard Maw2014-10-241-1/+5
|\ | | | | | | | | | | | | | | This stripped out the commit from the patch series on the mailing list to remove /dev/shm. Reviewed-by: Sam Thursfield Reviewed-by: Daniel Silverstone
| * deploy extensions: Don't crash if someone builds at the same timeRichard Maw2014-10-241-1/+3
|/ | | | | | | | | | | | | | If a build happens, it creates a new network namespace, and if this happens while you have a disk image mounted, then you can't remove the mount-point, because the other namespace is using it. We can avoid the other namespace keeping this mount-point open by creating the disk image in a private mount namespace, so it never sees it. The nicest way to do this is to have every extension run in a private mount namespace, since you'd have to have extensions re-exec themselves, since the appropriate system calls aren't exposed very well.
* deploy: Allow extensions to write to Morph log fileRichard Maw2014-09-011-3/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is achieved by passing it the write end of a pipe, so that the extension has somewhere to write debug messages without clobbering either stdout or stderr. Previously deployment extensions could only display status messages on stdout, which is good for telling the user what is happening but is not useful when trying to do post-mortem debugging, when more information is usually required. This uses the asyncore asynchronous event framework, which is rather specific to sockets, but can be made to work with file descriptors, and has the advantage that it's part of the python standard library. It relies on polling file descriptors, but there's a trick with pipes to use them as a notification that a process has exited: 1. Ensure the write-end of the pipe is only open in the process you want to know when it exits 2. Make sure the pipe's FDs are set in non-blocking read/write mode 3. Call select or poll on the read-end of the file descriptor 4. If select/poll says you can read from that FD, but you get an EOF, then the process has closed it, and if you know it doesn't do that in normal operation, then the process has terminated. It took a few weird hacks to get the async_chat module to unregister its event handlers on EOF, but the result is an event loop that is asleep until the kernel tells it that it has to do something.
* Cut BuildBranch out of morphlib.extensionsRichard Maw2014-08-121-25/+17
| | | | | | | | | | | This was previously used just so it could get the right repo and ref to read the file out of. However, there was a subtle bug in this behaviour, as if we had not previously used morph build in that branch, it would attempt to read the extensions from a branch which didn't exist. So now it reads it from the working tree, which always exists.
* Add utilities for listing and finding extensions.Mark Doffman2014-03-311-0/+159
| | | | | | | | | Add a module to morphlib that can list all write and configuration extensions either in morph itself or the morphology repository. The module also contains methods to find an extension filename from the name and type.
* Revert "Add utilities for listing and finding extensions."Mark Doffman2014-02-211-143/+0
| | | | This reverts commit ab0a83a09a93ca33aa402d9c4d3b916a48a1a882.
* Add utilities for listing and finding extensions.Mark Doffman2014-02-211-0/+143