diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-04-28 12:25:30 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-28 09:44:15 +0100 |
commit | 8c9551a7a32036ac1f0bfba0b3f3dc24d006483e (patch) | |
tree | e32d12e14481620e27830ebf6dc03c623972c768 /scripts/lib/scriptutils.py | |
parent | 6bc56e634a9f01a84dcc64569f79a6813d0bf5ca (diff) | |
download | ast2050-yocto-poky-8c9551a7a32036ac1f0bfba0b3f3dc24d006483e.zip ast2050-yocto-poky-8c9551a7a32036ac1f0bfba0b3f3dc24d006483e.tar.gz |
recipetool: ensure git clone is standalone when extracting
If -x is specified and the specified URI was a git repository, we need
to ensure that the resulting clone is a sandalone and not one that has
pointers into the temporary fetch location or DL_DIR (since the git
fetcher does a local clone with -s). Split out the code from devtool
that already does this for "devtool modify -x" and reuse that.
(From OE-Core master rev: fc47e8652ef32e7399f57c80593df90dc52d8b84)
(From OE-Core rev: d8f151b6a385f81abead65624ba15d42cbd90e11)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/scriptutils.py')
-rw-r--r-- | scripts/lib/scriptutils.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py index e786126..fdf4b5d 100644 --- a/scripts/lib/scriptutils.py +++ b/scripts/lib/scriptutils.py @@ -58,3 +58,14 @@ def load_plugins(logger, plugins, pluginpath): if hasattr(plugin, 'plugin_init'): plugin.plugin_init(plugins) plugins.append(plugin) + +def git_convert_standalone_clone(repodir): + """If specified directory is a git repository, ensure it's a standalone clone""" + import bb.process + if os.path.exists(os.path.join(repodir, '.git')): + alternatesfile = os.path.join(repodir, '.git', 'objects', 'info', 'alternates') + if os.path.exists(alternatesfile): + # This will have been cloned with -s, so we need to convert it so none + # of the contents is shared + bb.process.run('git repack -a', cwd=repodir) + os.remove(alternatesfile) |