summaryrefslogtreecommitdiff
path: root/morphlib/cachekeycomputer.py
Commit message (Collapse)AuthorAgeFilesLines
* Build per-source rather than per-artifactRichard Maw2014-09-191-28/+27
|
* Move metadata_version value to cachekeycomputerRichard Maw2014-09-191-1/+1
| | | | | | | | | | | | metadata_version is for when the format of the /baserock metadata files changes. This means it would make sense for it to either live with the code for generating the metadata, or the cache key code so it lives with the rest of the compatibility values. Since the code for generating the metadata isn't in a nice module anywhere, I've put it in the cachekeycomputer module.
* Remove some cache key related log messagesSam Thursfield2014-08-291-15/+5
| | | | | | | | | There's no need to log every time we look something up in a dict. This just makes log files huge. The CacheKeyComputer.compute_key() function still logs the first time it calculates a cache key for an Artifact instance. This message now includes the hex string that is used to identify the artifact.
* Revert "Ensure that none of the _orig_* fields are in the cache key"Adam Coldrick2014-08-141-4/+1
| | | | | | | | | This reverts commit 4124c50b8dc3dfb0ffb933153d0fe6385edf389c. This commit is no longer needed now that morph2 is gone. Conflicts: morphlib/cachekeycomputer.py
* morphloader: Get commands when loading morphologyAdam Coldrick2014-08-141-1/+1
| | | | | | Rather than having a `get_commands` method to obtain missing commands from the build system when they are needed, get the commands when loading a morphology.
* Merge branch 'baserock/adamcoldrick/no-orig-fields-in-cache-key'Adam Coldrick2014-08-011-1/+4
|\ | | | | | | | | | | | | | | This fixes a bug where distbuild was calculating a different cache local build. It will no longer be needed once morph2 is removed. Reviewed-by: Sam Thursfield Reviewed-by: Richard Maw
| * Ensure that none of the _orig_* fields are in the cache keybaserock/adamcoldrick/no-orig-fields-in-cache-keybaserock/adamcoldrick/no-fake-morphAdam Coldrick2014-08-011-1/+2
|/ | | | | | | | morph2.Morphology adds a number of fields beginning with _orig_, which contain default values. There is no reason for these values to be in the cache key, and this fixes a bug where distbuild created systems with a different cache key than local builds did when the configuration extensions list was empty.
* Use chunk morpholgy contents in cache keysRichard Maw2014-07-221-9/+19
| | | | | | | | | | | | | | | | | | | | | Previously the contents of the morphology would be included by virtue of the fact that it came from the source repository, so would be included in the "tree" field. Now that chunk morphologies can come from the definitions repository, it is not always included in the "tree" field, so the logical contents of the morphology need to be included in the cache key computation. Build commands are included after looking them up in the build-system, so that in future, we don't need to change the chunk morphology compatibility version when we change how build-systems work. Since we may be moving the morphologies about in the definitions repository, it would suck if we had to do a full rebuild after we move things, so I dropped the filename from the cache key. This also tweaks the system and stratum cache keys to include the contents directly, rather than hashed in the "morphology-sha1" field.
* CacheKeyComputer: Memoise cache keys more effectively.Daniel Silverstone2014-03-281-10/+23
| | | | | | | | | We were previously memoising the computation of the dictionaries but this patch adds support for memoising the computation of the cache key itself (the SHA string). This massively improves cache key computation performance. Signed-Off-By: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
* Don't create a blank /etc/fstabSam Thursfield2014-03-041-1/+1
| | | | | | | | This messes up the baserock-system-config-sync tool. Systemd does not require /etc/fstab to exist in any case. I have bumped the 'system-compatibility-version' field in this commit to trigger rebuilding all system artifacts.
* cache-key: Fix obscure cache key collisionRichard Maw2014-01-221-1/+2
| | | | | | | | | | | | | | | | | | | | If two systems with the same name (e.g. different repo/ref) depend on the same strata, then it will collide with systems which depend on different artifacts from that stratum, but the same number of artifacts. For example, if you checkout an existing branch and change the artifacts used by one of its strata, then your local changes won't be built. This is because the 'kids' field lists artifacts it depends on by their cache-key, which is now no longer sufficient to uniquely identify artifacts. The same number of artifacts issue is from it listing cache keys multiple times. The fix for this is to include the artifact name, so the 'kids' field is now a list of dicts, with artifact name and cache key. This is a dict rather than a tuple so that the generated /baserock metadata is more readable.
* cache-key: Don't reduntantly hash products fieldRichard Maw2014-01-221-2/+6
| | | | | | For chunks the products field doesn't need to be hashed, since the split-rules field is used instead, and includes the default rule set, and for strata and systems it is handled by hashing the dependencies.
* CacheKeyComputer: Include split rules in computationRichard Maw2014-01-161-1/+3
| | | | | | | | | | | | Chunk artifacts need the [(artifact_name, [regular_expression])] so that if the default split rules change, or the blending rule changes, then an extra version field doesn't need to be added to the cache key computer. This is for future plans to allow the split rules to be configurable and allow us to more easily change them. System and Stratum artifact computations don't need this, since those splitting rules are already expressed in the dependencies information.
* Include the artifact metadata-version in the cache id keyRichard Dale2013-05-241-1/+2
|
* One 'arch' to rule them allSam Thursfield2013-03-151-2/+1
| | | | | | | | | | | | | Define a specific set of 4 architectures that Morph supports, and only expose that value to morphologies. Since GNU triplets are very common we also expose a GNU triplet. Other morphologies should work out their configuration based on MORPH_ARCH. This commit also removes the morphlib.util.arch() function, which detected the machine Morph is running on via 'uname -m'. Morph's architecture names do not necessarily map to the output of 'uname -m' so we should not rely on it anywhere.
* Add 'prefix' property for chunks within strataSam Thursfield2013-03-131-2/+3
| | | | | | | | | 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-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Set environment variables defining target for build-essentialSam Thursfield2013-03-131-1/+2
| | | | | | In the future we will allow this to be modified to provide a cross-bootstrap mode, but for now we use the same target as the host compiler.
* Refactor build processSam Thursfield2013-03-131-4/+3
| | | | | | | | | | | | | | | | | | 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.
* Avoid rebuilds when unimportant morphology contents changeJonathan Maw2012-11-291-0/+8
| | | | | | | | This changes the cache key generation so that it will ignore unimportant fields of the morphology, e.g. description, build-depends, chunks. description is unimportant because it does not affect building, and build-depends/chunks are unimportant because they are already considered
* Compute cache keys using tree SHA1s instead of commit SHA1sJannis Pohlmann2012-09-051-1/+1
| | | | | This avoids rebuilding things when commits are made that do not change the actual source code or the morphologies.
* python scripts: pep8ize codebaseRichard Maw2012-08-011-10/+9
| | | | | | | | | 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.
* 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.
* CacheKeyComputer: increment compat-versionRichard Maw2012-07-021-0/+2
| | | | | | | | | This will prevent systems that don't have the right mount options being cache hits. Having fstab be in some System configuration morphology, which is also included in the cache key would prevent this being needed if the fstab format changes again.
* CacheKeyComputer: add stratum-format-versionRichard Maw2012-06-141-0/+2
| | | | | | Since strata aren't tarballs any more, it's simpler to make tarball strata cache misses than have the system build code behave differently for tarballs and json chunk lists.
* CacheKeyComputer: re-use dict hash logic for morphology hashingRichard Maw2012-05-181-17/+2
| | | | | | CacheKeyComputer already re-invents the wheel for hashing a dict, so re-use that logic rather than re-implement it as creating a huge string.
* Fix stringifying morphologies to be deterministicLars Wirzenius2012-05-111-4/+18
| | | | | | | Previously we were stringifying complex values (lists, dicts) by using whatever Python produces, but different runs and versions of Python may convert them differently, particularly dicts. We now do it manually.
* Change cache keys for strata, systems to use sha of morphology, instead of ↵Lars Wirzenius2012-05-091-2/+15
| | | | | | | | | | commit This avoids a problem where we make a change to one system morphology in the "morphs" repository, and then we have to rebuild all system and stratum artifacts, because their commit sha1 also changed. With this change, we don't care about the commit sha1 for systems and strata, just the contents of the morphologies.
* cachekeycomputer: use sha1s in the cache_idRichard Maw2012-04-231-1/+1
| | | | This makes the dicts smaller, so should be faster and more manageable
* cachekeycomputer: log get_cache_id as wellRichard Maw2012-04-231-0/+4
| | | | get_cache_id is called recursively, so it would help to log that too
* Add missing import, oopsLars Wirzenius2012-04-231-0/+1
|
* Add more logging to cache key computationLars Wirzenius2012-04-231-0/+4
|
* Remove BuildGraph, compute cache keys based on Artifacts.Jannis Pohlmann2012-04-181-12/+12
| | | | | | | | | | | | With this commit, the ArtifactResolver no longer computes the cache keys when creating Artifact objects. This will have to happen as a post-resolving step (e.g. prior to building or checking whether a local or remote artifact cache has any of the resolved artifacts). The CacheKeyComputer now takes an Artifact object and computes the cache keys using its dependencies. BuildGraph is no longer needed for the CacheKeyComputer unit tests.
* cachekeycomputer: rename get_cache_key compute_keyRichard Maw2012-04-161-1/+1
| | | | | Also amend tests to operate on a dependency chain starting from a system morph
* cachekeycomputer: look up values in buildenvRichard Maw2012-04-121-4/+3
| | | | Duplicate data less, so it should be more manageable
* cachekeycomputer: prepare build environment changeRichard Maw2012-04-121-2/+2
| | | | | | CacheKeyComputer needs to know some stuff that is needed elsewhere as well. Rather than duplicate the storage, have a BuildEnvironment class to handle that.
* morphlib: add cachekeycomputer classRichard Maw2012-04-121-0/+79