summaryrefslogtreecommitdiff
path: root/morphlib/builder2.py
Commit message (Collapse)AuthorAgeFilesLines
* Make metadata include the repo-alias.Richard Maw2013-02-111-0/+1
| | | | | | | | | This is required for reproducing the morphologies that created the artifacts. It is possible, but expensive, to `unexpand` a url, provided your repository aliases are the same as the morphology's, but this may not always be the case.
* Avoid confusing error when staging area is emptySam Thursfield2013-02-061-2/+3
| | | | | | | | | | | | | | | | | | For Morph to work it's necessary for the staging area to contain a full FHS heirarchy. However, if the staging area is empty we want to give the user an obvious error. Previously we would say something like: OSError: [Errno 2] No such file or directory: '/tmp/ccache' This makes it seem like the problem is with ccache. With this patch, we will instead get as far as: /bin/sh: No such file or directory This should make the real problem clearer. Also, aborting while trying to mount the ccache directory causes the /proc and /dev/shm mounts to persist which is fixed by this patch.
* Include morph-version in artifact metadataRichard Maw2013-01-281-0/+7
| | | | | | This can be used to rebuild an artifact with the exact same version of morph. Eventually there may be a tool to do this, but it allows for expert diagnosis until that point.
* Make ccache use the same directory for repos that are clonesJonathan Maw2013-01-031-4/+15
| | | | | | | | | This patch makes morph store its ccaches by the url's basename instead of using the whole url. This fixes the problem of morph choking when it tries to mount a directory with a colon in its path, and also makes all clones of one repository use the same cache (probably). This will cause projects with the same name to use the same cache, but that is not likely to cause serious problems.
* Add support for ccacheJonathan Maw2012-12-171-0/+24
| | | | | | | | | | | | | | | | | | | This is set up so that each individual project repository has its own ccache, all under one defined directory. The top-level ccache directory is added as the setting 'compiler-cache-dir', and defaults to $cachedir/ccache. When a build is performed, this will bind-mount a project's ccache into the /tmp/ccache of the staging-area and set up the environment variables so that ccache will be used (if appropriate executables are installed to /usr/lib/ccache in the staging-area). In addition, this removes code for ccache-remotedir, as it is unrelated to this implementation of ccache. Reviewed-by: Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> Reviewed-by: Lars Wirzenius <lars.wirzenius@codethink.co.uk>
* Revert "Merge branch 'liw/hardlink-staging-area-pre-rebase'"Jannis Pohlmann2012-11-301-5/+27
| | | | | | | | | | | | | | This reverts commit c859d70d86423a52bc7053abf64e9ca21f62a487, reversing changes made to 3085a672d1e8b5177be33f0463385de72a0ef5bf. Unfortunately, hardlinking and linux-user-chroot both break builds in various ways. Hardlinking breaks the bootstrap process by creating symlinks like /usr/libexec that can then not be overwritten with real files by install scripts from morphologies like gcc. linux-user-chroot caused problems by breaking privileged operations such as chgrp and CAP_SETFCAP. As a consequence, chunks like util-linux and libcap can no longer be built.
* Use the builder runcmd, to get build environment rightLars Wirzenius2012-11-291-6/+4
|
* Reformat code, plus adapt for non-staging-area buildsLars Wirzenius2012-11-291-1/+2
|
* Hardlinked chroot done with linux-user-chrootJoe Burmeister2012-11-291-31/+10
| | | | | | | | | | | | | | The patch gives two things. Improves morph build time by reusing decompressed files of chunks/stage-fillers with hardlinks from the chroot. Rather than decompressing each time into each chroot. Original: real 5h 17m 47s Hardlink: real 2h 52m 27s It uses linux-user-chroot to create the chroot and make all but the basics readonly.
* Don't store original filename in compressed image filesSam Thursfield2012-11-161-1/+2
| | | | | | | gzip files can store the name and date of the uncompressed original, and this is displayed in some GUI archive managers, or when gunzip -N is used. In our case the original filename is something like 'tmpXsgaY15', which is useless information and serves only to confuse.
* Cleanly handle out of disk space on target filesystem.Sam Thursfield2012-11-151-1/+7
| | | | Includes new test.
* Close file handles correctly on exceptions when unpacking strataSam Thursfield2012-11-151-18/+19
| | | | | | | This prevents us from leaving file handles open when code throws an exception. When the file handle is on a loopback mount, this is a real problem because Morph then cannot unmount the image in its exception handler. In most cases 'with' is the best option.
* Consistency fixSam Thursfield2012-11-151-1/+1
|
* Write /etc/os-release in system imagesSam Thursfield2012-10-261-1/+14
| | | | | | This is intended to for human consumption, with the full set of metadata in /baserock/system-artifact-name.meta. It currently lists system name, the symbolic ref of the system morphology and build date.
* Write metadata for the rootfs itself into the rootfsSam Thursfield2012-10-261-2/+3
| | | | | | | | This makes it easier to identify what version of a system we are running. Tests are updated to check inside the contents of the rootfs we created, and the code to mount the rootfs as a loopback device was extracted out into tests.as-root/lib
* Fix use of GzipFile to not assume "with" protocolLars Wirzenius2012-10-121-3/+4
| | | | | This fixes a bunch of tests so they pass on squeeze, which has a version of Python whose GzipFile doesn't support the "with" protocol.
* Correct a few long lines.Daniel Silverstone2012-10-091-3/+6
|
* Compress system disk imagesDaniel Silverstone2012-10-081-29/+45
| | | | | | | | | | Since tarball rootfs images are compressed with gzip -1, we should do the same for disk images. This means they'll need decompressing before they can be used as disk images, but it means we'll be shunting around something closer to their true data size rather than the disk image size. For example, a 2G development system image compresses down to around 380M which is a lot faster to transfer and doesn't risk de-sparseification.
* Rework git caches to be bare mirrors of the repos.Daniel Silverstone2012-09-141-11/+9
| | | | | | | | This reworks the code for managing and using the git caches in morph to treat the caches as bare repositories which are mirrors of where we clone from. In addition we correctly prune the branches during updates, so that we don't end up accumulating pointless branches over and over. This is even more important with branch-and-merge generating temporary build refs for things.
* Fix code format for unicode fixRichard Maw2012-09-131-1/+2
|
* Encode the root path for os.walk()Daniel Silverstone2012-09-121-1/+1
| | | | | | | | | Unfortunately we were running into issues with unicode filenames in repositories causing set_mtime_recursively() to explode. This fixes the problem. Reviewed-By: Lars Wirzenius (In real life)
* Warning instead of error for empty strata, temporarilySam Thursfield2012-09-031-1/+1
| | | | | | | | | This kind of reverts commit: c4facff97b27968f00a75ffb3d49cea2080ad9a4 Currently our bootstrap depends on building an empty stratum; this should be changed so that it builds a tarball system image, but this is currently broken too. This commit should be reverted when bootstrap is fixed to not depend on building an empty stratum.
* Log a clear error if creating an empty stratumSam Thursfield2012-08-301-0/+2
| | | | | This is mostly useful for diagnosing Morph bugs. Currently empty strata just cause confusing errors when building systems.
* Fix test coverage for squeeze coverage.pyLars Wirzenius2012-08-151-3/+3
| | | | | | | | The squeeze version of coverage.py seems to have problems with methods that consist of a single pass statement. This patch replaces those statements with placeholder docstrings so that ./check passes on squeeze. Reviewed-By: Daniel Silverstone (on irc)
* Initial non-syslinux disk image kindDaniel Silverstone2012-08-141-0/+136
| | | | | | | This adds a disk system image kind which does everything the syslinux-disk one does, but without syslinux. It deliberately carries stubbed bootloader operations so that we can later make syslinux-disk inherit from this one and override it.
* python scripts: pep8ize codebaseRichard Maw2012-08-011-75/+83
| | | | | | | | | This was done with the aid of the pep8 script, available by running `easy_install pep8`. It may be worth making this part of ./check, but that will require putting pep8 into the development tools stratum. This should be easy, given pep8 has no external dependencies.
* Refactor: move kernel artifact creation into base classLars Wirzenius2012-07-261-0/+19
|
* Move fstab creation into base classLars Wirzenius2012-07-261-0/+20
|
* Move strata unpacking into a base classLars Wirzenius2012-07-261-0/+54
|
* Start a tarball systembuilderLars Wirzenius2012-07-261-0/+2
| | | | | Also, rename the syslinux-disk builder plugin file to make it clear it's a system builder plugin.
* Move syslinux-disk system building into pluginLars Wirzenius2012-07-261-237/+1
|
* Refactor system building to use syskind specific classLars Wirzenius2012-07-261-2/+50
|
* Expose the real filename for SaveFileLars Wirzenius2012-07-171-1/+1
|
* Log to morph's log output of a failed buildLars Wirzenius2012-07-171-0/+7
| | | | | | Normally, the build log would go into the artifact cache, but it's tedious to fetch from there, so we log it into the normal morph log as well if things fail.
* SystemBuild: remove check for if arch == NoneRichard Maw2012-07-111-4/+4
| | | | | | This should never happen any more, so the check is now redundant. This may have a negligible performance benefit, but it prevents the code implying that None is a valid architecture.
* SystemBuilder: mount rootfs rw initiallyRichard Maw2012-07-091-1/+1
| | | | | | | | | | This is required for systemd's journald to start. This is probably a bad dependency in systemd, trying to start the journal before it has mounted everything properly. This required a compat change, it is a string to make it more noticeable that it's a temporary version.
* ChunkBuilder: runcmd, redirect err to outRichard Maw2012-07-061-1/+2
| | | | | Data buffers can get confused if two file handles are writing to the same file, python's subprocess module has subprocess.STDOUT for this.
* ChunkBuilder: dump build log on errorRichard Maw2012-07-061-4/+20
|
* ChunkBuilder: write output of build to cacheRichard Maw2012-07-061-3/+9
|
* Merge remote branch 'origin/baserock/bugfix/S2528-remount-rw'Lars Wirzenius2012-07-021-2/+2
|\
| * SystemBuilder: fix mounting optionsRichard Maw2012-06-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | fstab had errors=remount-ro, this is an ext option, btrfs doesn't support it. However it should be mounted noatime, to prevent the metadata trees being duplicated because they were read. extlinux.conf also has its mounting options changed so that the rootfs is mounted read-only initially. This should prevent the metadata trees being updated by reading them until it is remounted with noatime.
* | Fix test suite to deal with morph output changesLars Wirzenius2012-06-261-7/+9
| | | | | | | | | | | | | | | | Also, some bug fixes. Also, when handling a BaseException, log the exception (with traceback) that we're handling, in case there is an error while handling it, because the second error will otherwise mask the first one.
* | Fix problems found by Richard in reviewLars Wirzenius2012-06-261-3/+3
| |
* | Be more usefully verbose for chunk buildingLars Wirzenius2012-06-251-2/+6
| |
* | Add status message for unpacking chunksLars Wirzenius2012-06-251-1/+3
| |
* | Replace Morph.msg with Morph.statusLars Wirzenius2012-06-251-22/+48
| | | | | | | | | | | | | | | | | | The new method takes a list of keyword arguments. This is more useful than the old way of giving just a string, since now the presentation layer may transmogrify the status update. For example, it can usefully translate the message to another language. Add --verbose option to allow more control over what the user sees.
* | SystemBuilder: create a new artifact for kernelRichard Maw2012-06-211-8/+6
|/ | | | | | | The kernel should be considered a full artifact, not just metadata. The rootfs is now suffixed by -rootfs and the kernel is named $name-kernel. This is similar to how chunk splitting works.
* ChunkBuilder: mount /dev/shm as wellRichard Maw2012-06-201-19/+24
| | | | | | This required refactoring mount_proc and unmount_proc into more generic mounting functions. do_mounts returns the paths that were mounted instead of just one
* app: rename setup_proc to setup_mountsRichard Maw2012-06-201-7/+7
| | | | | This change is purely cosmetic, but reflects the fact that we need to mount more than just proc sometimes.
* Return list of built artifacts from builderLars Wirzenius2012-06-151-2/+9
|