path: root/scripts
diff options
authorPaul Eggleton <>2015-04-28 12:25:30 +0100
committerRichard Purdie <>2015-06-28 09:44:15 +0100
commit8c9551a7a32036ac1f0bfba0b3f3dc24d006483e (patch)
treee32d12e14481620e27830ebf6dc03c623972c768 /scripts
parent6bc56e634a9f01a84dcc64569f79a6813d0bf5ca (diff)
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 <> Signed-off-by: Richard Purdie <>
Diffstat (limited to 'scripts')
3 files changed, 15 insertions, 6 deletions
diff --git a/scripts/lib/devtool/ b/scripts/lib/devtool/
index 6b53781..4dc175d 100644
--- a/scripts/lib/devtool/
+++ b/scripts/lib/devtool/
@@ -23,6 +23,7 @@ import glob
import tempfile
import logging
import argparse
+import scriptutils
from devtool import exec_build_env_command, setup_tinfoil
logger = logging.getLogger('devtool')
@@ -236,12 +237,7 @@ def _extract_source(srctree, keep_temp, devbranch, d):
# Handle if S is set to a subdirectory of the source
srcsubdir = os.path.join(workdir, os.path.relpath(srcsubdir, workdir).split(os.sep)[0])
- if os.path.exists(os.path.join(srcsubdir, '.git')):
- alternatesfile = os.path.join(srcsubdir, '.git', 'objects', 'info', 'alternates')
- if os.path.exists(alternatesfile):
- # This will have been cloned with -s, so we need to convert it to a full clone
-'git repack -a', cwd=srcsubdir)
- os.remove(alternatesfile)
+ scriptutils.git_convert_standalone_clone(srcsubdir)
patchdir = os.path.join(srcsubdir, 'patches')
haspatches = False
diff --git a/scripts/lib/recipetool/ b/scripts/lib/recipetool/
index 1d5bfd9..0c41368 100644
--- a/scripts/lib/recipetool/
+++ b/scripts/lib/recipetool/
@@ -22,6 +22,7 @@ import glob
import fnmatch
import re
import logging
+import scriptutils
logger = logging.getLogger('recipetool')
@@ -238,6 +239,7 @@ def create_recipe(args):
if args.extract_to:
+ scriptutils.git_convert_standalone_clone(srctree)
shutil.move(srctree, args.extract_to)'Source extracted to %s' % args.extract_to)
diff --git a/scripts/lib/ b/scripts/lib/
index e786126..fdf4b5d 100644
--- a/scripts/lib/
+++ b/scripts/lib/
@@ -58,3 +58,14 @@ def load_plugins(logger, plugins, pluginpath):
if hasattr(plugin, 'plugin_init'):
+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
+'git repack -a', cwd=repodir)
+ os.remove(alternatesfile)
OpenPOWER on IntegriCloud