summaryrefslogtreecommitdiffstats
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-06-28 09:44:15 +0100
commit8c9551a7a32036ac1f0bfba0b3f3dc24d006483e (patch)
treee32d12e14481620e27830ebf6dc03c623972c768 /scripts/lib/scriptutils.py
parent6bc56e634a9f01a84dcc64569f79a6813d0bf5ca (diff)
downloadpoky-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.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):
58 if hasattr(plugin, 'plugin_init'): 58 if hasattr(plugin, 'plugin_init'):
59 plugin.plugin_init(plugins) 59 plugin.plugin_init(plugins)
60 plugins.append(plugin) 60 plugins.append(plugin)
61
62def git_convert_standalone_clone(repodir):
63 """If specified directory is a git repository, ensure it's a standalone clone"""
64 import bb.process
65 if os.path.exists(os.path.join(repodir, '.git')):
66 alternatesfile = os.path.join(repodir, '.git', 'objects', 'info', 'alternates')
67 if os.path.exists(alternatesfile):
68 # This will have been cloned with -s, so we need to convert it so none
69 # of the contents is shared
70 bb.process.run('git repack -a', cwd=repodir)
71 os.remove(alternatesfile)