aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/scriptutils.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-04-28 12:25:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-01 17:08:10 +0100
commitfc47e8652ef32e7399f57c80593df90dc52d8b84 (patch)
treef96a2ba90dede5ab247ab229d37e851cbfbe666e /scripts/lib/scriptutils.py
parent0eeecce96a0aa757c2c4c4ac4d82e3bcbf0f982c (diff)
downloadopenembedded-core-contrib-fc47e8652ef32e7399f57c80593df90dc52d8b84.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. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'scripts/lib/scriptutils.py')
-rw-r--r--scripts/lib/scriptutils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py
index e7861268a5..fdf4b5d55d 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)