summaryrefslogtreecommitdiff
path: root/morphlib/stagingarea.py
Commit message (Collapse)AuthorAgeFilesLines
* StagingArea: Ensure staging are paths are bytestringsbaserock/richardmaw/bugfix/distbuild-eglibcRichard Maw2014-07-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | If the destdir path returned when creating a staging area is a unicode string, then when attempting to `os.walk(destdir)`, it will encounter unicode errors if there are file paths in the destdir that are not representable as unicode strings. For various as-yet unknown reasons, when building stage-2 eglibc it produces file paths that are not unicode compatible. There was previously a patch to fix this issue with regards to creating the metadata files, but it did not fix all the issues, because the build at the time was local rather than distributed. This is failing during a distributed build because morphologies are serialised into json, and during deserialisation their string values are left as unicode. Rather than doing the byte-string conversion during deserialisation, I have chosen to do it when the contents of the morphology are used, because it's only at the point where it's used to create a file path, that it matters whether it's unicode or not.
* Add logfile kwarg to staging area runcmdRichard Ipsum2014-05-141-1/+8
| | | | | | | | | | | | We use tee to write the output to a file as well as to stdout. Using Popen it should be straight forward to send the output to a pipe and then read that pipe and write to wherever. At the moment morph uses cliapp's runcmd rather than Popen. cliapp's runcmd is a blocking call, so we're not able to read from the pipe until the command has completed, which prevents real time logging to a number of files. One solution to this problem might be to spawn a thread which opens a pipe to the command being executed, the thread then reads from the pipe and writes to our collection of logfiles.
* Use morphlib.fsutils.mount when possiblePedro Alvarez2014-03-181-1/+1
|
* Reduce spam from setting up staging areaLars Wirzenius2014-03-101-1/+4
| | | | | | | | | | | Make the message "Installing chunk..." be chatty, i.e., only displayed when the user turns verbosity higher. Most of the time the chunk is already unpacked in the cache, so installing it takes a fraction of a second. Add a new message, at default verbosity, when a chunk needs to be unpacked. This can take a while, so a message is appropriate, so the user knows what is happening.
* Tidy up debug output of morph buildDaniel Firth2013-10-281-4/+1
|
* Added chunkname prefix to some elements of the debug log.Dan Firth2013-10-111-3/+3
|
* Remove redundant dict.getRichard Maw2013-08-231-1/+0
|
* Merge branch 'baserock/richardmaw/S8563/bootstrap-rootfs-protection'Richard Maw2013-08-231-31/+36
|\ | | | | | | Reviewed-by: Lars Wirzenius
| * Make the tempdir writable in bootstrap mode.Richard Maw2013-08-161-3/+7
| | | | | | | | | | Somehow this was working on x86 even though it had no ability to write to tempdirs, but on ARM it wasn't working.
| * stagingarea: use linux-user-chroot in bootstrapsRichard Maw2013-08-151-28/+30
| | | | | | | | | | This changes the semantics of the use_chroot flag to instead mean chrooting to /
| * stagingarea: use invert_paths to bind-mount roRichard Maw2013-08-151-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This improves upon the logic by allowing subdirectories to be marked as writable. This is not needed in its state here, but it will be built upon. It also does not attempt to make symlinks read-only, since the symlink resolution is done before chrooting, so there will be dangling links, which cause linux-user-chroot to fail during the bootstrap. This also uses the --chdir option of linux-user-chroot instead of running a shell script to cd and run the command.
* | Disable network during buildsJonathan Maw2013-08-131-0/+1
|/
* stagingarea: move to failed on construction failRichard Maw2013-08-061-0/+14
| | | | | | | | | This uses the same logic as when a build fails, so it's been consolidated into `StagingArea.abort()`. You could argue that if a build fails before any commands are run, then there's nothing interesting to see, but it will be useful if the hardlink/tarball extract algorithm fails in some corner case.
* stagingarea: Construct hardlink cache atomicallyRichard Maw2013-08-061-6/+14
| | | | | | | | | | | | Paul had file system problems which led to a partially constructed chunk hardlink cache, which caused later builds to fail, since they got a partially extracted chunk. This patch fixes the case where the failed extract caused unreproducible builds, but it's possible to corrupt the hardlink cache in other ways. Read-only btrfs subvolumes would fix this, but either tie us further to btrfs, or complicates the codebase with fallback logic.
* Change the structure of the temporary directory used by morphTiago Gomes2013-06-051-3/+3
| | | | | | Now, inside the temporary directory we will have the following subdirectories: chunks, staging, failed and deployments. The failed directory will contain the staging areas of failed builds.
* Added exception to give smaller error messageRic Holland2013-03-201-1/+7
|
* Fix long lineSam Thursfield2013-03-151-1/+2
|
* Only bind mount necessary directories in chrootSam Thursfield2013-03-131-7/+5
| | | | | If for example /bin is a symlink, we shouldn't and can't mount the host system's /bin over the top.
* Add 'prefix' property for chunks within strataSam Thursfield2013-03-131-2/+2
| | | | | | | | | Morph no longer supports setting the prefix using the --prefix argument / setting. This was only used in tests and during bootstrap. If a chunk build-depends on a chunk within a stratum which has a custom prefix, that prefix is appended to the PATH in the build environment.
* Add 'build-mode' field for chunks in a stratumSam Thursfield2013-03-131-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Allowed values: staging: build with a staging chroot (default) test: build with the host's tools bootstrap: build with the host's tools, and do not include this chunk in the final stratum artifact In the past, 'normal mode' has been used to describe building a chunk with the host's tools. We don't want that mode to ever be used, because it is a huge hole in reproducability, but we need to keep it around to avoid making Morph's cmdtest suite depend on Baserock. Hopefully naming it 'test' should discourage potential abusers. It is unfortunate that the build tests now take a separate code path compared to real-world usage of Morph. However, this is necessary to avoid a circular dependency between Morph's test suite and the build-essential stratum in Baserock. We do whole-build testing of Baserock, too, so the 'staging' code path is still tested outside of Morph. However, testing a staging area requires populating it with at minimum a working shell, and this is a bit too complex to go in Morph's test suite.
* Refactor build processSam Thursfield2013-03-131-16/+36
| | | | | | | | | | | | | | | | | | Reorganise the build_artifact() and build_artifacts() functions to allow more complex work when setting up chunk builds in build_artifact(). The staging area now holds the BuildEnvironment object (the environment variables that should be set during build). This makes sense because all build commands should be run inside the staging area and therefore through the StagingArea object. The BuildEnvironment object is now considered immutable after it is created. The environment is used in cache key computation when computing what artifacts are required; if it changes after that point we risk either computing different artifact keys for the same artifact or missing data in the cache key that should be included in the hash. Better to force changes into a separate 'extra_env' variable.
* Remove support for bootstrap mode in staging areaSam Thursfield2013-03-131-12/+8
| | | | | This involved having a staging area with split personalities and was generally a bit ugly.
* Fix existence checks to not follow symlinksLars Wirzenius2013-03-011-4/+4
| | | | | | | | | | | | When we hardlink the staging area tree, we were checking if the target file already exists with os.path.exists. Unfortunately, this follows a symlink, and in this case, we don't want to: if the symlink target exists, and is a symlink, we want to remove the symlink only, and we don't care about its target. The target file may exists because of overlapping files in chunks. Reported-By: Paul Sherwood
* Perform *-commands in linux-user-chrootJonathan Maw2013-02-281-2/+17
|
* Hardlink files into the staging-areaJonathan Maw2013-02-281-2/+151
| | | | | | Instead of repeatedly unpacking tarballs into a succession of staging- areas, it will unpack each tarball only once, then hardlink all the files into the staging-area instead.
* Revert "Merge branch 'liw/hardlink-staging-area-pre-rebase'"Jannis Pohlmann2012-11-301-67/+4
| | | | | | | | | | | | | | 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.
* Change method comments to docstringsLars Wirzenius2012-11-291-3/+6
| | | | This also makes coverage.py be silent on Debian squeeze.
* Reformat code, plus adapt for non-staging-area buildsLars Wirzenius2012-11-291-15/+20
|
* Refactor and fix to make it pass (more of) the test suiteLars Wirzenius2012-11-291-8/+12
|
* Hardlinked chroot done with linux-user-chrootJoe Burmeister2012-11-291-3/+54
| | | | | | | | | | | | | | 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.
* python scripts: pep8ize codebaseRichard Maw2012-08-011-24/+23
| | | | | | | | | 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.
* morph: remove dead code and replace Execute with app.runcmdRichard Maw2012-05-301-3/+3
|
* bins: move errno from stagingareaRichard Maw2012-05-151-1/+0
| | | | | This import was forgotten when the artifact extract code was moved into bins, so it could be used in builder
* builder: use the same tar extract logic for all artifactsRichard Maw2012-05-141-82/+2
| | | | | Before only the staging area had symbolic links handled, now strata and systems will have the same logic.
* stagingarea: fix dir detectionRichard Maw2012-04-301-4/+4
|
* Improve artifact extraction logic when overwriting existing stuff on filesystemLars Wirzenius2012-04-301-3/+49
| | | | | | | | | We had a problem where something in the bootstrap would fail because two different chunk artifacts had a path (/tools/lib64) exist as a directory exist as a symlink (to /tools/lib) versus a directory, and morph confusing things. The new logic should handle this better.
* stagingarea: when extracting, clobber outputRichard Maw2012-04-271-0/+3
| | | | | | I really don't like this, but it causes the bootstrap to fail because /bin/bash exists for compatibility and the stratum also creates /bin/bash.
* stagingarea: remove path from chrootRichard Maw2012-04-261-1/+1
| | | | | | | chroot may not be installed to /usr/sbin/chroot, this breaks bootstrap because chroot is installed in /tree/tools/sbin. PATH should be set, so putting the absolute path in should be unnecessary
* Restructure code so coverage is happyLars Wirzenius2012-04-261-8/+7
|
* Monkey patch Python's tarfile.TarFile for proper errors, ignoring overwritesLars Wirzenius2012-04-261-0/+31
|
* Log installed artifacts; do not log shell commandsLars Wirzenius2012-04-251-2/+4
| | | | | The -x to sh didn't actually produce any output to help in my debugging, so I remove it now.
* Fix how we run commands in a chrootLars Wirzenius2012-04-201-1/+2
| | | | | | We'll get back to linux-user-chroot later, but to do that, we need to sort out how we deal with the install-commands without needing real or fake root for them.
* Make StagingArea get temporary directory separately from root directoryLars Wirzenius2012-04-181-6/+4
| | | | | | When we are not using --staging-chroot (e.g., bootstrap), we need to specify the temporary directory separately, because it needs to obey things like $TMPDIR.
* Make StagingArea create build and install directories, run commandsLars Wirzenius2012-04-181-1/+59
|
* Add a class to manage the staging area for buildsLars Wirzenius2012-04-121-0/+60