summaryrefslogtreecommitdiff
path: root/morphlib/sourceresolver.py
Commit message (Collapse)AuthorAgeFilesLines
* Add tests for sourceresolverAdam Coldrick2015-01-231-10/+10
| | | | | | | | | This only adds tests for the bits which were moved from morphologyfactory into sourceresolver, namely detection of build systems and the '_get_morphology()' function. These are just the morphologyfactory tests reworked slightly to work properly with the modified API.
* Read files from a local clone of definitions where possibleSam Thursfield2015-01-231-1/+30
| | | | | | | | | | | | | | | | | Most morphologies involved in a build are in the definitions repo these days. Currently we read each of them using `git cat-file`, which is slow. It's quicker to check out all the files in one go to a temporary directory and then read them from there. With the current workflow users often have definitions.git checked out on disk. It seems strange to not just read the files from there. There are two reasons why I don't want to do that yet: - there are commands which don't run inside a system branch, which would be broken if we expected to always be in a system branch - there may be local changes in the checked-out repo, and it takes around 5 seconds on each build to check if there aren't any local changes. It actually seems faster to just check out a known clean version from the cache.
* Split up traverse_morphs to improve readabilitySam Thursfield2015-01-231-61/+79
|
* Add an LRU cache for detected build-systemsSam Thursfield2015-01-231-21/+101
| | | | | | | This will speed up builds of chunks which don't have a chunk morph. It won't have much (if any) effect on the speed of the first build, but subsequent builds will be much faster as we won't have to query the artifact cache.
* Add an LRU cache for resolved tree refsSam Thursfield2015-01-231-27/+70
| | | | | | | | | | | | This uses the PyLRU module, from: <https://pypi.python.org/pypi/pylru/1.0.6>. Python 3.2 and newer provide a built-in LRU cache, but this is specifically for in-memory use. See <http://bugs.python.org/issue17528>. Git commits are immutable, so caching information about their contents is fairly easy and trouble-free. There's no danger of the cache becoming stale.
* Add a cache manager utilising pylru and pickleAdam Coldrick2015-01-231-0/+51
|
* Move MorphologyFactory into SourceResolverSam Thursfield2015-01-231-9/+69
| | | | | There's no need for this stuff to be in a separate class. This allows integrating it with the caching in the SourceResolver class.
* sourceresolver: Add comments and factor out common functionSam Thursfield2015-01-231-13/+15
|
* Rework CachedRepo to use the GitDirectory class where possibleSam Thursfield2014-12-031-2/+4
| | | | | | | | | | | | | This consolidates a bunch of code paths that were previously duplicated. This also changes the API for local cached repos to match the function names GitDirectory uses. Note that the remote repo cache still uses the old names, and should be fixed when time permits. Some unit tests that use the CachedRepo module required a bit of inelegant monkey-patching in order that they continue to work. A better way to do this would be with the 'mock' library (which would need to be added to Baserock 'build' and 'devel' systems before we could use it).
* Separate resolution of ref->commit and commit->treeSam Thursfield2014-12-021-7/+15
|
* Add docstring to SourceResolver class.Sam Thursfield2014-11-101-1/+22
|
* Set the 'update' flag in the SourceResolver constructorSam Thursfield2014-11-101-12/+14
|
* Move create_source_pool code into new 'sourceresolver' moduleSam Thursfield2014-11-101-0/+176
This code is an essential part of 'morph build'. It's quite complex and really shouldn't be mixed in with the base Application class. Given a dedicated class we can store some state in the object and avoid functions with seven parameters, too.