summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Make our use of json binary path safebaserock/richardmaw/bugfix/unicode-safe-jsonRichard Maw2014-07-118-22/+30
| | | | | | | | | | | | | | | | | | | | | json only accepts unicode. Various APIs such as file paths and environment variables allow binary data, so we need to support this properly. This patch changes every[1] use of json.load or json.dump to escape non-unicode data strings. This appears exactly as it used to if the input was valid unicode, if it isn't it will insert \xabcd escapes in the place of non-unicode data. When loading back in, if json.load is told to unescape it with `encoding='unicode-escape'` then it will convert it back correctly. This change was primarily to support file paths that weren't valid unicode, where this would choke and die. Now it works, but any tools that parsed the metadata need to unescape the paths. [1]: The interface to the remote repo cache uses json data, but I haven't changes its json.load calls to unescape the data, since the repo caches haven't been made to escape the data.
* Merge remote-tracking branch ↵Richard Maw2014-07-1162-5495/+2626
|\ | | | | | | | | | | | | 'origin/baserock/richardmaw/S11284/morphologies-by-path-v4' Reviewed-by: Sam Thursfield Reviewed-by: Lars Wirzenius
| * yarns: Adapt to put morphologies in subdirsbaserock/richardmaw/S11284/morphologies-by-path-v4Richard Maw2014-07-108-195/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | We want to move our morphologies in our definitions repository into subdirectories, so they're more organised. We'd prefer to only refer to morphologies by file path, rather than a name that loosely corresponds to the file path, but we need to support that for backwards compatibility until we can move all of our morphologies into the definitions repository. However, since we want to eventually remove this, and we want to ensure that file paths work, we change the yarn tests to use file paths.
| * Don't check if a file exists before trying to read itRichard Maw2014-07-101-28/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to check whether a file existed before trying to read it. We used to be able to get away with only looking at the top-level directory, which made using ls-files before trying to cat-file it better. Unfortunately, we need to look at the files in subdirectories now, so this no longer works. We could make it include files in subdirectories, but for repositories with many files, you would end up reading a file listing longer than the morphology, so even in the slow case of needing to read the entire morphology file, it would be faster to attempt to read the file first. So now we beg forgiveness rather than asking permission.
| * Use exact filenames to refer to morphology filesRichard Maw2014-07-1014-1757/+1768
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than repeatedly stripping and appending an optional .morph extension morphology names, instead always use the file path of the morphology relative to the definitions repository. This is an inversion of the previous logic, which would strip the .morph extension and use the "name" internally. The exception to this rule of always using the filename, is that `morph edit CHUNK` uses the name of the morphology as-defined in the stratum. This is based off Adam Coldrick's inital patch, but this version will allow the old style of providing the "name" by converting it into a path if it does not have either a / or a . in it. An unfortunate consequence of this change is that the show-dependencies command's output changed, so the test needed updating.
| * Don't attempt to load symlinks as morphologiesRichard Maw2014-07-073-1/+49
| | | | | | | | | | | | | | | | | | | | | | This was noticed because our definitions.git had a dangling symlink, so it failed to construct the temporary build branch. We shouldn't process symlinks as morphologies either, since either we make symlinked morphologies a first-class behaviour, and validate that the link points inside the repository, which is a lot of work for something we don't and probably won't need; or we can just assume that we deal with the morphology this is linked to correctly anyway.
| * Make MorphologyFinder use file pathsRichard Maw2014-07-074-28/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to use file paths to locate morphologies now, so the old model of get a list of names and hand it those back to get the contents doesn't really make sense any more. This abstraction initially came about as one idea I had for moving morphologies out of the source tree was to put them in something like git notes, where it's possible to look up information for one commit in another ref in the repository, at which point this abstraction would have been flexible enough to handle that as well as in the However, moving the chunk morphologies into the definitions repository has other benefits too, so it makes more sense to be honest about using filenames in the API. It remains as a single point where we can put the logic for knowing which files in a repository look like morphologies, but if we need to remove any further functionality, it should be replaced by a single function.
| * Add class hierarchies for Morphology load errorsRichard Maw2014-07-071-28/+36
| | | | | | | | | | There's a lot of them, it's too much of a pain to enumerate them all, so it's convenient to provide a hierachy and catch the base exceptions.
| * Exorcise some old and unused commandsRichard Maw2014-07-0736-3309/+536
| | | | | | | | | | | | | | | | | | | | | | | | | | `morph merge` only worked for a small subset of cases, and has been left to bit-rot, since we don't use it. `morph tag` is just a `git tag` when we have petrified definitions repository. We don't use it, nor do we need it, so it can go away rather than take up valuable development time fixing it when requirements change. `old-foo` have all been superceded by newer versions and are no-longer used.
| * Remove check on checkout/branch that there are systemsRichard Maw2014-07-072-31/+0
| | | | | | | | | | | | | | This was the wrong response to the problem of accidentally checking-out morph when trying to check out morphs. Now that it's called definitions, this is irrelevent, and aborting a checkout when this check fails is the wrong thing to do.
| * Remove code made vestigial from the `morph edit` rewriteRichard Maw2014-07-073-119/+1
| | | | | | | | | | | | This was originally used by `morph edit`, but since we removed the need to run `morph edit system stratum` and could shorten it to `morph edit chunk`, this function is no longer used.
* | Revert "Revert "Update NEWS for release 14.28.""baserock-14.28Michael Drake2014-07-111-0/+6
| | | | | | | | This reverts commit ad65450c145e3283f95a40397280fc8b938a04c0.
* | Revert "Update NEWS for release 14.28."Daniel Silverstone2014-07-091-6/+0
| | | | | | | | This reverts commit a6488c42e79177576d8c73927dac7c1e86311122.
* | Update NEWS for release 14.28.Michael Drake2014-07-091-0/+6
| |
* | Merge branch 'sam/splitting-fixes'Sam Thursfield2014-07-071-10/+14
|\ \ | | | | | | | | | | | | Reviewed-By: Richard Maw <richard.maw@codethink.co.uk> Reviewed-By: Lars Wirzenius <lars.wirzenius@codethink.co.uk>
| * | Rewrite SplitRules.partition() docstring to be clearer to meSam Thursfield2014-07-041-3/+4
| | |
| * | Fix issue when overriding default chunk splitting rulesSam Thursfield2014-07-041-7/+10
| |/ | | | | | | | | | | | | | | | | | | | | When overriding a default chunk splitting rule, the use 'break' would mean that some of the other default chunk split rules might be ignored. This isn't ever what you want. I also clarified the current behaviour in a comment. I think in future we should add a mechanism to extend the default rules, as well as the current mechanism which allows only replacing them. But that is a separate issue.
* | Merge branch 'sam/update-gits-fix'Sam Thursfield2014-07-073-13/+46
|\ \ | |/ |/| | | | | Reviewed-By: Pedro Alvarez <pedro.alvarez@codethink.co.uk> Reviewed-By: Adam Coldrick <adam.coldrick@codethink.co.uk>
| * Fix Morph failing to update some cached git reposSam Thursfield2014-07-073-13/+46
|/ | | | | | | | | | | | | | | | | | | | | | | I was getting the following error when running the 'do-release.py' script: ERROR:root:Command failed: morph --quiet --trove-host=git.baserock.org list-artifacts baserock:baserock/definitions sam/auto-release minimal-system-x86_32-generic ERROR: Ref d67a0e110187abd560a1de63fa172894a52839d5 is an invalid reference for repo git://git.baserock.org/delta/linux The commit that it wants did actually exist in git.baserock.org and the logs show that Morph hadn't done a `git remote update` to get the commit locally. This turned out to be because it'd had already looked up a different ref in linux.git. It hadn't needed to run 'git remote update', but it *had* added linux.git to a "don't need to update this repo again" list. Oops! I've moved the code in question to the cachedrepo module so that the repo object keeps that of whether it should be updated. The bug is now fixed. As a side effect this patch fixes the spurious 'Updating repo file:///...' messages, which were printed even though repos with file:/// URLs are never updated.
* Update NEWS filebaserock-14.26Richard Ipsum2014-06-271-0/+9
|
* Merge remote-tracking branch ↵Lars Wirzenius2014-06-262-31/+37
|\ | | | | | | | | | | | | 'origin/baserock/richardipsum/improve_getmorph_errmsg' Reviewed-by: Lars Wirzenius Reviewed-by: Emmet Hikory
| * Make morph factory tests expect MorphologyNotFoundErrorRichard Ipsum2014-06-251-6/+5
| |
| * Replace AutodetectError with MorphologyNotFoundErrorRichard Ipsum2014-06-251-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The error message: ERROR: Failed to determine the build system of repo file://foo/bar/baz at ref 59713cf997385a094091443fdcce9d5c17313f39: was looking for distbuild-system-x86-64.morph is confusing since our system morph has nothing to do with build systems, the fact that build system autodetection is executed when looking for distbuild-system-x86-64.morph is an implementation detail that shouldn't be exposed to the user. This patch replaces this error message with: ERROR: Couldn't find morphology: distbuild-system-x86-64.morph This is still not ideal, since there are cases where we may not be able find the morph because build system autodection has failed, but out of the two user typos/mistakes are probably more likely. Differentiating between user error and build system detection failure would require more substantial changes. This patch also splits the get_morphology function into two functions _get_morphology_text, that actually fetches the morph text from the cache or otherwise infers it from the build system, and get_morphology which constructs a Morphology object from the text.
| * Add chatty status messages to aid the userRichard Ipsum2014-06-251-5/+12
|/
* Improve var names in morphloaderRichard Ipsum2014-06-241-24/+22
|
* Fix duplicate names error messageRichard Ipsum2014-06-241-5/+6
| | | | | This error message didn't report the cluster morph at fault. We also fix a minor formatting issue.
* Merge branch 'sam/distbuild-busyloop-debug'Sam Thursfield2014-06-201-0/+4
|\ | | | | | | | | Reviewed-By: Richard Ipsum <richard.ipsum@codethink.co.uk> Reviewed-By: Richard Maw <richard.maw@codethink.co.uk>
| * distbuild: Log a message when a socket error is receivedSam Thursfield2014-06-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I found an issue in distbuild where the controller was stuck in a busy loop where it was continually writing to a closed socket. With 'strace' I saw write(), SIGPIPE, write(), SIGPIPE, ad infinitum. I got this much of a Python backtrace using GDB: distbuild.socketsrc.SocketEventSource.write() distbuild.sockbuf.SocketBuffer._flush() distbuild.sm.StateMachine.handle_event() I didn't manage to get further. However, I suspect one of the state machine transitions may be creating an event loop instead of correctly handling the error. The log file was quiet at this point, the last entries were: 2014-06-19 08:57:36 INFO There seems to be nothing to build 2014-06-19 08:57:36 INFO Requested artifact is built 2014-06-19 08:57:36 DEBUG InitiatorConnection: sent to 10.24.1.215:53818: {'mess age': 'Need to build 0 artifacts', 'type': 'build-progress', 'id': 790629564} 2014-06-19 08:57:36 DEBUG Notifying initiator of successful build 2014-06-19 08:57:36 DEBUG MainLoop.remove_state_machine: <BuildController at 0xb 6c554c, request-id InitiatorConnection-93> 2014-06-19 08:57:36 DEBUG InitiatorConnection: sent to 10.24.1.215:53818: {'type ': 'build-finished', 'id': 790629564, 'urls': [u'http://hawkdevtrove:8080/1.0/ar tifacts?filename=861f640923494ca3626bbd65655b350ce1bebea4c0bf7a57693bc06ed122cef 4.system.devel-system-x86_32-chroot-rootfs']} 2014-06-19 08:57:36 DEBUG InitiatorConnection: 10.24.1.215:53818: closing: <Json Machine at 0xc6cb22c: socket 10.24.1.164:7878 -> 10.24.1.215:53818, max_buffer 1 6384> 2014-06-19 08:57:36 DEBUG MainLoop.remove_state_machine: <InitiatorConnection at 0xc6cbcec: remote 10.24.1.215:53818> 2014-06-19 08:57:36 DEBUG MainLoop.remove_state_machine: <JsonMachine at 0xc6cb22c: socket 10.24.1.164:7878 -> 10.24.1.215:53818, max_buffer 16384> 2014-06-19 08:57:36 DEBUG MainLoop.remove_state_machine: <SocketBuffer at 0xc6cbe2c: socket None max_buffer 16384> This commit should improve matters a little: in future the log file will show the ID of the SocketEventSource object and error we hit when calling its write() function.
* | Merge branch 'sam/only-update-git-when-needed-v2'Sam Thursfield2014-06-191-3/+11
|\ \ | | | | | | | | | | | | Reviewed-By: Adam Coldrick <adam.coldrick@codethink.co.uk> Reviewed-By: Pedro Alvarez <pedro.alvarez@codethink.co.uk>
| * | Only updated cached git repos when necessarySam Thursfield2014-06-181-3/+11
| |/ | | | | | | | | | | | | | | | | | | When the given ref points to a specific commit, and it's already available in the locally cached copy of repo, there's no need to update the repo. If the ref points to a branch or tag, and the user didn't pass --no-git-update, the locally cached copy of the repo will still be updated. This should speed up many Morph commands.
* | Merge branch 'baserock/adamcoldrick/deploy-specific-systems-v5'Adam Coldrick2014-06-186-11/+203
|\ \ | | | | | | | | | | | | Reviewed by: Richard Maw <richard.maw@codethink.co.uk> Lars Wirzenius <lars.wirzenius@codethink.co.uk>
| * | Add yarn tests for new deployment functionalitybaserock/adamcoldrick/deploy-specific-systems-v5Adam Coldrick2014-06-183-1/+111
| | |
| * | Update the help text for morph deployAdam Coldrick2014-06-181-1/+5
| | |
| * | Allow the user to specify deployments in a clusterAdam Coldrick2014-06-181-8/+43
| | | | | | | | | | | | | | | | | | | | | | | | Instead of taking the name of a cluster morphology and zero or more parameters for overriding the cluster morphology, morph deploy should take the name of a cluster morphology and the names of zero or more system deployments that are defined in the cluster morphology. If no deployment names are given then all deployments are deployed.
| * | Add unit test to test the validation of cluster morphsAdam Coldrick2014-06-181-0/+18
| | |
| * | Validate cluster morphologiesAdam Coldrick2014-06-181-1/+26
|/ / | | | | | | | | The names of deployments in cluster morphologies will need to be unique in order for the deployment of selected systems to work.
* | Fix: use end of options option with run-partsRichard Ipsum2014-06-181-1/+6
|/ | | | | | We want to supply the end of options option before the SYSTEM_INTEGRATION_PATH so that the system integration path doesn't get interpreted as an option if it happens to begin with a -
* Merge remote-tracking branch 'origin/sam/morph-version-no-tags'Sam Thursfield2014-06-181-2/+3
|\ | | | | | | | | | | | | | | | | Several reviews; all were happy with the code but not all were sure that this is the correct approach to take. I have merged, because we need this change to make Baserock releases easier. We can revisit it in the future if we want to provide semantic versioning for Morph, instead of our current "report the version of the containing OS image instead" approach.
| * Use abbreviated commit SHA as version number, rather than the tagSam Thursfield2014-06-121-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | This still (ab)uses 'git describe', in order to get an '-unreproducible' postfix when the tree has uncommitted changes. Previously we tagged morph.git with the name of the corresponding Baserock release that it was to be part of. This made the Baserock release process awkward. We needed to first create and test the release images, then (once we knew the version of Morph we were releasing was good) tag morph.git, and then build all the release images again so that the new tag would be picked up and the output of `morph --version` would be correct.
* | Merge remote-tracking branch 'origin/sam/distbuild-gc-fix'Sam Thursfield2014-06-161-0/+3
|\ \ | | | | | | | | | Reviewed-By: Lars Wirzenius <lars.wirzenius@codethink.co.uk>
| * | Don't delete subdirectories of tempdir in gc pluginSam Thursfield2014-06-131-0/+3
| | | | | | | | | | | | | | | | | | There is code that assumes these exist in at least one place: StagingArea.abort(). That code should be fixed, but we should also stop deleting them every time we run 'morph gc'.
* | | Update NEWS for releasebaserock-14.24Richard Maw2014-06-121-0/+14
| |/ |/|
* | Check for presence of btrfs before trying to use itSam Thursfield2014-06-115-1/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If btrfs is not present in the kernel we end up with strange output like this: Error creating disk image2014-06-10 16:00:40 [devel-system-x86_64-generic][my-raw-disk-image][rawdisk.write]Failure to create disk image at /src/tmp/testdev.img ERROR: Command failed: mount -o loop /src/tmp/testdev.img /src/tmp/deployments/tmpQ7wXO1/tmp4lVDcu/tmpvHSzDE mount: mounting /dev/loop0 on /src/tmp/deployments/tmpQ7wXO1/tmp4lVDcu/tmpvHSzDE failed: Device or resource busy To avoid this confusing error, Morph should explicitly check first.
* | Merge branch 'baserock/richardipsum/distbuild_err_when_no_controller2'Richard Ipsum2014-06-113-12/+62
|\ \ | | | | | | | | | | | | | | | Reviewed by: Lars Wirzenius Richard Maw
| * | Make buildcommand use InitiatorConnectionMachineRichard Ipsum2014-06-111-2/+11
| | | | | | | | | | | | | | | | | | After a failed attempt to connect to the controller node the initiator will wait 30 seconds before attempting a reconnect, if this reconnect fails the initiator gives up.
| * | Import InitiatorConnectionMachineRichard Ipsum2014-06-111-1/+2
| | |
| * | Use superRichard Ipsum2014-06-111-1/+1
| | | | | | | | | | | | This change is made just for consistency.
| * | Add InitiatorConnectionMachineRichard Ipsum2014-06-111-5/+36
| | | | | | | | | | | | | | | | | | The InitiatorConnectionMachine wraps the ConnectionMachine, so we can continue to use ConnectionMachine without providing it with an app.
| * | Add max_retries optionRichard Ipsum2014-06-111-5/+14
|/ / | | | | | | | | | | | | By default there is no limit on the number of reconnection attempts. We make the reconnect_interval a parameter, but the default interval remains 1 second.
* | Fix: force select to wait on timeoutRichard Ipsum2014-06-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently the mainloop unintentionally busy-waits if we can't connect to the controller. We want the mainloop's select call to wait for the timeout not for this socket's descriptors (which are always ready). We could just call stop_reading() and stop_writing() but since we won't be needing this socket again we may as well close the entire event source, which calls stop_reading(), stop_writing() and then closes the socket.