diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-02-08 19:35:26 +0000 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-02-08 19:35:26 +0000 |
commit | bb262854bc53882a4d0c2e81e3e21a2ed1025986 (patch) | |
tree | 23dab6fcbd23aab200fb0aa7274e9e430296a910 /morphlib/git.py | |
parent | c163d09ab436b6c219dc17f371f29c35d0c1d0da (diff) | |
download | morph-bb262854bc53882a4d0c2e81e3e21a2ed1025986.tar.gz |
Extract chunk submodule repos into the build directory directly.
This change requires the latest version of cliapp to be installed.
Rather than creating an archive from the cached git repositories,
moving this tarball archive into the cache and then extracting it from
there into the build directory, we now directly extract the sources into
the build directory.
We also recursively extract all submodules into the corresponding paths
inside the build directory. (Recursing has not been tested yet,
however.)
Diffstat (limited to 'morphlib/git.py')
-rw-r--r-- | morphlib/git.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/morphlib/git.py b/morphlib/git.py index e64fecb9..0b774229 100644 --- a/morphlib/git.py +++ b/morphlib/git.py @@ -87,7 +87,11 @@ class Treeish(object): binascii.unhexlify(ref) ex = morphlib.execute.Execute(self.repo, self.msg) ex.runv(['git', 'rev-list', '--no-walk', ref]) - self.sha1=ref + self.sha1 = ref + # NOTE this is a hack, but we really don't want to add + # conditionals all over the place in order to handle + # situations where we only have a .sha1, do we? + self.ref = ref except (TypeError, morphlib.execute.CommandFailure): raise InvalidReferenceError(self.original_repo, ref) @@ -238,3 +242,9 @@ def add_remote(gitdir, name, url, msg=logging.debug): def update_remote(gitdir, name, msg=logging.debug): ex = morphlib.execute.Execute(gitdir, msg=msg) return ex.runv(['git', 'remote', 'update', name]) + +def archive_and_extract(app, treeish, destdir, msg=logging.debug): + return app.runcmd(['git', 'archive', treeish.ref], + ['tar', '-C', destdir, '-xv'], + cwd=treeish.repo, + msg=msg) |