summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Hack petrify command into working againsam/petrify-hackSam Thursfield2015-09-211-51/+21
| | | | Change-Id: I9e5c41266a93a5f2c59a9654a39eaa4a39c00b96
* Revert "Remove petrify and unpetrify commands"Sam Thursfield2015-09-2114-2/+615
| | | | This reverts commit d63f41dadf5aa96a8d9254d31e92711ee160245e.
* Remove yarns for functionality we no longer wantRichard Ipsum2015-09-171-471/+0
| | | | Change-Id: I6c45763fb4d9f304695c1894625ced36bda36f89
* Force test suite to observe morph.conf tempdirMike Williams2015-09-174-3/+31
| | | | | | | | | This change, suggested in story #16, causes the testing suite to use the user-defined tempdir in /etc/morph.conf if it exists or continue using /tmp if not. This will prevent the test suite from filling drives that are not intended to be used for development work. Change-Id: I94edabe4ea1eca7a55ece7424ece7bbd4b68c513
* Make `check --full` pass againTiago Gomes2015-09-141-1/+1
| | | | Change-Id: I9e5b1a70946a87eb29009df2def3bd98ecc7ad2a
* Add support for Module::Build build systemRichard Ipsum2015-09-071-1/+42
| | | | | | | | ExtUtils::MakeMaker is preferred, Module::Build was meant to replace it but essentially wasn't good enough, some projects still use Module::Build though. Change-Id: I124ee7b33f32167302e9bcb5299f6422f4fc346e
* Make ExtUtilsMakeMakerBuildSystem be more standardRichard Ipsum2015-09-071-10/+19
| | | | | | Install to default locations rather than overriding. Change-Id: Ieccd06afdf623eee0d09b8d29d40d147dc8c5e7c
* Rename CPANBuildSystem to ExtUtilsMakeMakerBuildSystemRichard Ipsum2015-09-071-2/+2
| | | | | | There are several perl build systems. Change-Id: I17b5d61b7bffbdbcb9944e9e41449bec7a69c527
* Rework debugging information for failed buildsTiago Gomes2015-09-014-68/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Improve error messages and remove redundant information * Stop displaying the containerised settings, as they are not very helpful to debug a build failure * Display the error code * Change system integration commands logging to consistent with build commands logging. * Provide a log file in the staging directory for each chunk build failure or system integration failure. * Provide a chroot script in the staging directory for each chunk build failure or system integration build failure. This script allows the user to enter an environment similiar to the one where the build failed. * Fix a bug where the system integration commands stdout was being omitted when these commands failed. * Fix a bug where the error_message_for_containerised_commandline() was being called with an empty error message, as the stderr was being directed to stdout. Chunk build failure output before the this change and change I16ebe9ba4ac46fef82e37d0b3e05f42d14249de8: 2015-08-03 15:55:21 [Build 258/267] [test] Running build-commands build failed # configure # # echo "configure-commands stdout" configure-commands stdout # # echo "configure-commands stderr" >&2 configure-commands stderr # build # # echo "build commands stdout" build commands stdout # # echo "build commands stderr" >&2 build commands stderr # # echo "some more sdout" echo "some more stderr" >&2 echo $PATH foo some more sdout some more stderr /tools/bin:/usr/bin:/usr/lib/ccache:/sbin:/usr/sbin:/bin:/usr/bin sh: foo: not found ERROR: In staging area /src/tmp/failed/tmpglc5Sz: Command failed: sh -c 'echo "some more sdout" echo "some more stderr" >&2 echo $PATH foo ': Containerisation settings: {'binds': (('/src/cache/ccache/nano-tarball', '/src/tmp/staging/tmpglc5Sz/tmp/ccache'),), 'mount_proc': True, 'mounts': (('dev/shm', 'tmpfs', 'none'),), 'writable_paths': ['/src/tmp/staging/tmpglc5Sz/test.build', '/src/tmp/staging/tmpglc5Sz/test.inst', '/src/tmp/staging/tmpglc5Sz/dev', '/src/tmp/staging/tmpglc5Sz/proc', '/src/tmp/staging/tmpglc5Sz/tmp'], 'root': '/src/tmp/staging/tmpglc5Sz', 'cwd': '/test.build'} Error output: $> Chunk build failure output after this change and change I16ebe9ba4ac46fef82e37d0b3e05f42d14249de8: 2015-08-03 15:53:59 [Build 258/267] [test] Running build-commands ### CONFIGURE-COMMANDS ### + echo configure-commands stdout configure-commands stdout + echo configure-commands stderr configure-commands stderr ### BUILD-COMMANDS ### + echo build commands stdout build commands stdout + echo build commands stderr build commands stderr + echo some more sdout some more sdout + echo some more stderr some more stderr + echo /tools/bin:/usr/bin:/usr/lib/ccache:/sbin:/usr/sbin:/bin:/usr/bin /tools/bin:/usr/bin:/usr/lib/ccache:/sbin:/usr/sbin:/bin:/usr/bin + foo sh: foo: not found ERROR: In staging area /src/tmp/staging/tmpjES5_2: build failed (exi t_code=127) $> System integration build failure output before this change and change I16ebe9ba4ac46fef82e37d0b3e05f42d14249de8: 2015-08-03 15:58:25 [Build 267/267] [build-system-x86_64] Running the system integration commands 2015-08-03 15:58:25 [Build 267/267] [build-system-x86_64] Error while running system integration commands 2015-08-03 15:58:25 [Build 267/267] [build-system-x86_64] Error while building system ERROR: Command failed: baserock/system-integration/00-test-test-misc-0002: Containerisation settings: {'mounts': (('dev/shm', 'tmpfs', 'none'), ('tmp', 'tmpfs', 'none')), 'mount_proc': True, 'root': '/src/tmp/staging/tmpvpwB4l/build-system-x86_64.inst'} Error output: + foo baserock/system-integration/00-test-test-misc-0002: line 1: foo: not found $> System integration build failure output after this change and change I16ebe9ba4ac46fef82e37d0b3e05f42d14249de8: 2015-08-03 16:00:06 [Build 267/267] [build-system-x86_64] Running the system integration commands + echo stdout stdout + echo stderr stderr + foo baserock/system-integration/00-test-test-misc-0002: line 1: foo: not found ERROR: In staging area /src/tmp/staging/tmpl9VNzf: system integration commands failed (exit_code=127) $> Change-Id: Id992f707f69f3fa761b4c21e9904c4e5328e1c77
* Stop moving staging areas of failed buildsTiago Gomes2015-09-016-32/+64
| | | | | | | | | | | | | | | | | | | | | Stop moving staging areas of failed builds from the 'staging' directory to the 'failed' directory. Moving staging areas make it very difficult to debug build failures on the build essential chunks, as the paths set on the configure scripts and some environment variables (e.g. STAGE2_SYSROOT, DESTDIR) will be invalid after moving the staging area. This change will also make it easier to create scripts that chroot n environment similiar to the one where the build failure occurred. To make it still possible to safely do a build an run `morph gc` in parallel, we use flock(2) to control access to the staging area directory. Also, move the `test_supports_non_isolated_mode` test into a different class, as it requires a different SetUp() routine (the staging area is contructed with different parameters). Change-Id: I06c3c435ad05c12afabc0adc2a9d4f8a284ccc02
* Expose clone_into in GitDirectory classRichard Ipsum2015-08-241-0/+3
| | | | Change-Id: I2e1ae43da6e7dd0d7ddcb51d3cd9bc1794bb80a5
* Move definitions VERSION parsing code into its own definitions_version moduleSam Thursfield2015-08-185-49/+108
| | | | | | | I need to use this outside of the 'sourceresolver' module. Also, the 'sourceresolver' module is too big. Change-Id: I523bcc9555193b7369768441b72f1059e6adde5c
* Log a message if a file isn't found in definitionsSam Thursfield2015-08-181-0/+1
| | | | | | Just for future debuggers. Change-Id: Ie915a9f47fbf3ca56d6e75b816eaa5a4fb36bc88
* Use the shell X-ray modeTiago Gomes2015-08-125-19/+19
| | | | | | | | | | | Instead of logging every command for ourselves, use the shell X-ray mode. As side effect, each command argument will now be printed out in its evaluated form, which aids debugging. Also, improve the visual separation between the different build steps, and display those steps with finer granularity. Change-Id: I16ebe9ba4ac46fef82e37d0b3e05f42d14249de8
* Fix crash if artifact doesn't contain a /baserock directorySam Thursfield2015-08-111-4/+8
| | | | | | | This is probably a sign that something is broken, but it's better to cope with it rather than crashing. Change-Id: I4e9c40d0b7db031ea271143938db61c4ad70a888
* Fix Yarn tests to not include .git directory in built artifactsSam Thursfield2015-08-111-1/+6
| | | | | | | | | When I spotted that artifacts contained a .git directory I was worried that it might indicate a Morph bug. It turned out to be due to the way the 'test shell' used in the Yarn tests works. This change should save anyone else from similar confusion. Change-Id: I97b57eff7aa947506d4062a76e9803398e46c2b6
* Warn if system-integration commands are defined for an unknown artifactSam Thursfield2015-08-111-0/+7
| | | | | | | | | | | | The system-integration field in a chunk .morph file defines which of the chunk artifacts the integration script should live. If you list an artifact that doesn't exist, the integration script will not go anywhere and the commands won't run. Ideally system-integration commands will be become a bit more simple to use, but hopefully this warning helps in the meantime. Change-Id: I10a068e79eb46f98f0bd308a5caf3c445dda22ed
* Set chunk commands' stdin to /dev/nullRichard Ipsum2015-08-071-7/+9
| | | | | | | Chunk commands will currently block if they read from stdin. To fix this we set stdin to /dev/null so that the first read returns EOF. Change-Id: I143396f4c443c098b2880c5925e6f0907cb4fb17
* Print warning messages nicelySam Thursfield2015-07-301-1/+1
| | | | | | They were all run onto the same line before with no linebreaks. Change-Id: Ibdff91a23221034a3d345542f1268f8863cf4515
* Add support for Baserock definitions version 6Sam Thursfield2015-07-295-100/+150
| | | | Change-Id: I891d1b13ed0581b293fe6b09b3cc73af8fd81d67
* Remove support for Baserock definitions format versions 0, 1 and 2Sam Thursfield2015-07-236-63/+13
| | | | | | | | | | | The previous release of the Baserock reference systems (baserock-15.25 tag) used Baserock definitions version 3, so this version of Morph can still build the last release of the Baserock reference systems. In the course of fixing up the cmdtest tests to use version 5 definitions, I removed a couple of bits of redundant code. Change-Id: If9d480aa966d2ea5939cf04351f3d488cccea67f
* Don't provide default strip-commands for 'manual' build systemSam Thursfield2015-07-231-1/+6
| | | | | | | | | | | | | | | | | | | | | This makes more sense to me conceptually: the idea of the 'manual' build system is you specify *everything* manually. However, I made this change to work around a problem in the Yarn test suite. If the definitions used for testing are set to version 5 or newer, `morph build` will try to run 'strip' and 'objcopy', which fails because they don't exist in the test definitions. We could solve this by setting 'strip-commands: []' in the test chunk .morph files, but this triggers an error further down where `morph edit` fails with 'Field strip-commands not allowed in morphology test-chunk.morph'. This bug is caused by the conditional way that strip-commands are currently implemented in Morph. When we drop support for versions of the definitions format older than V5, the bug will go away, and the `morph edit` command is deprecated in any case, so I think it makes sense to work around it instead of trying to fix it. Change-Id: Ib5124d72466a77cf3f28ed3e14cc4c231bdce4c4
* Extract downloaded tarball as current userRichard Ipsum2015-07-201-1/+1
| | | | | | | | | | | | | | | | | | tar will preserve ownership and permissions by default if running as the superuser, whereas git doesn't track ownership, the owner is set to the user running the clone. This is a reproducibility hole since the resulting repo may differ depending on whether the repo was obtained from a tarball or via a git clone, but morph considers the repos to be equivalent. Running tar with --no-same-owner ensures the files written by tar will be owned by the user extracting the archive. This only fixes half the problem, lorry may also need to be modified to ensure files in the tarball have the same mode as those in the git repo. Change-Id: I849d054bc4574f9c0bbcfd608914306e52b7a22e
* Add bitbucket repo alias to default aliasesRichard Ipsum2015-07-061-0/+3
| | | | Change-Id: Ife16546fc90e26919672f6658b30084bafa42f94
* sourceresolver_tests: Remove bogus testRichard Maw2015-07-041-9/+0
| | | | | | | | | | | | | | | | | | This test, tests for a case that produces unhelpful results. It asserts that if we don't have the repository locally, and we try to fetch it remotely and the file doesn't exist, that we should have no morphology. What we'd actually like is for it to fetch the repository and try that locally, at which point it would succeed. The reason the flawed previous behaviour (that this test asserted to be correct) failed to cause problems for us, is that in the normal course of resolving refs, we would always either have found it remotely or cached it locally, when we were doing ls_tree or resolve_ref operations. Change-Id: I287eb1e5bc9c916b31f306b4f5f24b0a6d3f0559
* sourceresolver_tests: Fix invalid backup definitionRichard Maw2015-07-041-1/+2
| | | | | | | If we did end up trying to load a morphology that wasn't defined, we'd get an unhelpful error about the yaml being invalid. Change-Id: If1b182f1100430424a0fe62bd8938a88c1b9a11a
* distbuild: Fix cache status messageSam Thursfield2015-06-241-2/+3
| | | | | | | | The initiator would always say "Need to build 260/260 artifacts" even when it didn't need to build everything, because we were counting the number of unbuilt artifacts wrongly. Change-Id: I5da88157dba59949597c58a983f7b31975c52d7f
* distbuild: Fix crash when worker disconnectsSam Thursfield2015-06-241-1/+1
| | | | | | | Bad function prototype meant that the mechanism for handling workers disconnecting actually caused the controller to crash instead. Change-Id: I8ceb6ad027ba2481c0c4c335e1760692823c208b
* distbuild: Fix partial distbuildingSam Thursfield2015-06-241-1/+1
| | | | | | | | | | | | | | | | | | | | I was getting an error from this command: morph distbuild systems/build-system-x86_64.morph stage2-fhs-dirs Saying this: ERROR: Failed to build git://git.baserock.org/baserock/baserock/definitions 93575a2ceeeda77a5bb8c6121a9cac3edde1afbf systems/build-system-x86_64.morph: Some of the requested components are not in build-system-x86_64-rootfs: stage2-fhs-dirs This patch fixes that issue and makes Morph build up to stage2-fhs-dirs successfully. Change-Id: I61c373272484dcb5dc62f281cae8f21f742c31a9
* distbuild: Add __str__() and __repr__() to ArtifactReferenceSam Thursfield2015-06-231-0/+6
| | | | | | | | This is just to make the log files more readable, as what would previously have been logged as '<ArtifactReference at 0x1235478>' is now logged as the actual name of the artifact. Change-Id: I6189aa1390268cec379dd459fc3f4fecc71363b1
* distbuild: Hide a log messageSam Thursfield2015-06-231-1/+4
| | | | | | | | The 'BC: got artifact: <distbuild.artifact_reference.ArtifactReference object at 0x7f84ea2b5c10>' message is only useful when _debug_build_output is true, if at all. Change-Id: I079b398e841d5508ecefd00167fb0d83be748ce6
* distbuild: Check cache status each time we enqueue new artifactsSam Thursfield2015-06-231-131/+174
| | | | | | | | | | | | | | | | | | | This fixes an issue where distbuild would build the same artifact more than once. The problem occurs with a single distbuild controller, if multiple initiators request builds of the same thing at roughly the same time (which scripts/release-build in definitions.git does). This change also means that multiple distbuild controllers sharing a single artifact cache will be smart about sharing built artifacts. It does not mean that distbuild can handle having built artifacts removed from the cache while it is building stuff. The number of HTTP requests made to the shared artifact cache is higher with this patch, but these seem to take no more than 1 second and we only ever need to run one request before starting more builds, so there should be no noticable impact on performance. Change-Id: Ib3246219a10ca95d40b8a21bd0fe53f32e46c1c9
* distbuild: Add docstrings to BuildController state machineSam Thursfield2015-06-231-2/+96
| | | | | | | Hopefully this makes the code a little less cryptic. No functional changes. Change-Id: I615810e4eacdd5454731e07387b1dbb9eb348fd5
* Fix crash in `morph distbuild` commandSam Thursfield2015-06-231-1/+1
| | | | | | | | This was causing: UnboundLocalError: local variable 'original_ref' referenced before assignment Change-Id: I46e4b5d527d9ac5480a3d1fe5e6d631f0b7279dc
* Make `morph show-build-log` look in local repo cache for build logsSam Thursfield2015-06-221-21/+33
| | | | | | | This makes it more useful and saves people from poking around in the cache in order to dig up build logs. Change-Id: I8e062c5c32b01aca0df54e1974ead3c3b3134cc3
* Make more commands work outside a system-branch/workspaceSam Thursfield2015-06-224-67/+61
| | | | | | | | | | | | | | | | This makes `morph get-chunk-details`, `morph get-repo` and `morph show-build-log` work in any Git checkout of definitions.git. These are all of the commands outside of the deprecated branch_and_merge_plugin that take notice of system branches. The DefinitionsRepo.relative_path_to_chunk() function is changed a bit. It actually only existed for the `get-repo` command to use, but it turns out that it did the wrong thing by returning a long path for the repo (e.g. baserock/baserock/fhs-dirs) instead of a short one (fhs-dirs). The latter is less typing, and is the behaviour expected by the `get-repo` yarn tests, so it now does that. Change-Id: I430b540b3b0f309cf7018e0b8236f0e8a9042d89
* Determine whether to include_local_changes from app.settingsSam Thursfield2015-06-223-9/+5
| | | | | | | Previously callers to DefinitionsRepoWithApp.source_pool() could override the user's value, but that's not actually used anywhere. Change-Id: I43b53e7b9fc937886c8e6e95947e5e2b6776d085
* Raise exception if show-build-log doesn't find the build logSam Thursfield2015-06-191-5/+14
| | | | | | | | | | | | | Previously it would print nothing and then exit with success. Better to tell the user that an error occurred. Example of the new error: ERROR: No build log for artifact 6fb39673b8f9a1c9848063f5132aa958ffa75f2be61a8dde68ebb11f5a3c4a5f found on cache server http://cache.baserock.org:8080/ Change-Id: Icf8ceef60eb497ff90e00391d442a394e3d76f10
* Fix `morph show-build-log` for chunks of a different architectureSam Thursfield2015-06-191-0/+6
| | | | | | | | Previously if you tried to view the log on an x86_32 machine for a chunk that was build on ARM, it'd give a spurious error saying "Are you trying to cross-build?" Change-Id: I19c3781e0951ecb4161f06fd8b3a0c8ea5bfef9d
* localrepocache: Count freshly cloned repositories as updatedRichard Maw2015-06-171-1/+4
| | | | | | | This fixes requires_update_for_ref when it is given a non-fixed ref and it is retrieved from a call to get_updated_repo. Change-Id: Icbcf2e4ec45bd559c6bcb450ceb4a8861b56f654
* Fix anchor yarnRichard Ipsum2015-06-171-1/+8
| | | | | | | This yarn was failing 'cause of a missing chunk morph rather than a failure to push Change-Id: I70d79b1b9ec972cebde825d90c039666867bb1fa
* Add script to run a distbuild network on the local machineSam Thursfield2015-06-171-0/+523
| | | | Change-Id: I8d3f3ec6a1796b06b32e43dc4839360ff1cc2d86
* Don't ignore the 'cwd' parameterSam Thursfield2015-06-161-1/+1
| | | | Thanks to Richard Maw for suggesting this fixup.
* Expose reset_workdir in GitDirectory classRichard Ipsum2015-06-161-0/+6
| | | | Change-Id: Ib2d7bd31bea49c052a59582524382df6b931a31f
* Swap repr() for str() in ref add errmsgRichard Ipsum2015-06-161-1/+1
| | | | | | | | | | | | | | | | | | | | Old message: ERROR: Adding ref refs/heads/baserock/builds/review/javier_jard_n/foundation_core/d3401783ea054fc18ee56ccdb0030d0a with commit 1c60a89a98c5ee532fefd363240b06870ada02f5 failed in git repository located at /src/definitions: AppException() New message: ERROR: Adding ref refs/heads/baserock/builds/review/javier_jard_n/foundation_core/d3401783ea054fc18ee56ccdb0030d0a with commit 1c60a89a98c5ee532fefd363240b06870ada02f5 failed in git repository located at /src/definitions: Command failed: git update-ref refs/heads/baserock/builds/review/javier_jard_n/foundation_core/d3401783ea054fc18ee56ccdb0030d0a 1c60a89a98c5ee532fefd363240b06870ada02f5... Change-Id: Idc6a47388f53d358b7dfc2c0f7fa82eefbc92630
* Improve error when local HEAD of definitions repo is not found in remoteSam Thursfield2015-06-163-7/+30
| | | | | | | | | | | | | | | | | | Old error: ERROR: Git directory /build/cache/gits/git___git_baserock_org_baserock_baserock_definitions has no commit at ref 5046c3a0e4fd587c23f7c6a9e0d0b50d1914dcca^{commit}. New error: ERROR: Commit 5046c3a0e4fd587c23f7c6a9e0d0b50d1914dcca wasn't found in the "origin" remote git://git.baserock.org/baserock/baserock/definitions. You either need to push your local commits on branch xxx to "origin", or use the --local-changes=include feature. Change-Id: I0c3658e9cd27c23f40653662ba7e4ba58b7892de
* Use DefinitionsRepo class in deploy pluginSam Thursfield2015-06-162-92/+77
| | | | | | | | | | This allows you to run `morph deploy` from any Git checkout of definitions.git. This also changes `morph help-extensions` to use the DefinitionsRepo class, as the code overlaps. Change-Id: I64c48f59c8ec5aebc7169f3b4b4abbb759bd0b9a
* Use DefinitionsRepo in build commandSam Thursfield2015-06-163-147/+81
| | | | | | | | | This allows using `morph build`, `morph distbuild` and `morph distbuild-start` from any Git checkout of a definitions.git repo, so nobody needs to use `morph checkout` or `morph branch` if they don't want to. Change-Id: I5fdfae0f8bec1953893e26f0d227e289da11fa84
* Add DefinitionsRepo classSam Thursfield2015-06-166-39/+521
| | | | | | | | | | | | | | The intention is for this class to take over the from the Workspace and SystemBranch classes. It allows Morph to load and parse definitions from a Git repo, without requiring the user to run `morph checkout` or `morph branch`: it can operate from any normal Git repository. The class behaves differently when the Git repository is inside a Morph system-branch checkout made with `morph branch` or `morph checkout`, to avoid changing things under the feet of people who are used to those commands. Change-Id: I52a898efb9f6fb7f7e94c65b9ed38516bd51f49d
* Treat True and False as actual commands, rather than booleans.Jim MacArthur2015-06-161-0/+3
| | | | | | | | | | | It's quite easy to forget that "true" and "false" are special words in YAML, and write "false" to halt the build process while debugging. This was treated as a Boolean instead of a string, so causes an unhelpful error in morph. Since there is no use for booleans in morphologies, they should be treated as strings. Change-Id: I7c872f9696611920febec5f375b599eee89d040e