From: Markus Lehtonen <markus.lehtonen@linux.intel.com>
To: Paul Eggleton <paul.eggleton@linux.intel.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 2/6] recipetool: ensure git clone is a full clone when extracting
Date: Thu, 30 Apr 2015 13:17:41 +0300 [thread overview]
Message-ID: <1430389061.9508.14.camel@linux.intel.com> (raw)
In-Reply-To: <df99c07e8afaaef6fe5f0ada4cd3f33b7f7b555f.1430314621.git.paul.eggleton@linux.intel.com>
Hi,
On Wed, 2015-04-29 at 14:41 +0100, Paul Eggleton wrote:
> If -x is specified and the specified URI was a git repository, we need
> to ensure that the resulting clone is a full clone and not one that has
> pointers into the temporary fetch location or DL_DIR. 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>
> ---
> scripts/lib/devtool/standard.py | 8 ++------
> scripts/lib/recipetool/create.py | 2 ++
> scripts/lib/scriptutils.py | 10 ++++++++++
> 3 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
> index 94b5e0b..eb41f28 100644
> --- a/scripts/lib/devtool/standard.py
> +++ b/scripts/lib/devtool/standard.py
> @@ -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
> - bb.process.run('git repack -a', cwd=srcsubdir)
> - os.remove(alternatesfile)
> + scriptutils.git_convert_full_clone(srcsubdir)
>
> patchdir = os.path.join(srcsubdir, 'patches')
> haspatches = False
> diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
> index 1d5bfd9..15de694 100644
> --- a/scripts/lib/recipetool/create.py
> +++ b/scripts/lib/recipetool/create.py
> @@ -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):
> outlines.extend(lines_after)
>
> if args.extract_to:
> + scriptutils.git_convert_full_clone(srctree)
> shutil.move(srctree, args.extract_to)
> logger.info('Source extracted to %s' % args.extract_to)
>
> diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py
> index e786126..4af6fd5 100644
> --- a/scripts/lib/scriptutils.py
> +++ b/scripts/lib/scriptutils.py
> @@ -58,3 +58,13 @@ def load_plugins(logger, plugins, pluginpath):
> if hasattr(plugin, 'plugin_init'):
> plugin.plugin_init(plugins)
> plugins.append(plugin)
> +
> +def git_convert_full_clone(repodir):
> + """If specified directory is a git repository, ensure it's a full 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 to a full clone
> + bb.process.run('git repack -a', cwd=repodir)
> + os.remove(alternatesfile)
> --
> 2.1.0
>
I just find the term "full clone" a bit misleading here. I somehow tend
to associate it with a mirrored clone / cloning all refs / cloning with
full history. Could the term used above be "independent clone" or
"standalone clone" or something?
Thanks,
Markus Lehtonen
next prev parent reply other threads:[~2015-04-30 10:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 13:41 [PATCH 0/6] devtool: enable adding remote source Paul Eggleton
2015-04-29 13:41 ` [PATCH 1/6] recipetool: avoid second-level subdir when extracting Paul Eggleton
2015-04-29 13:41 ` [PATCH 2/6] recipetool: ensure git clone is a full clone " Paul Eggleton
2015-04-30 10:17 ` Markus Lehtonen [this message]
2015-04-30 10:26 ` Paul Eggleton
2015-05-01 15:59 ` Paul Eggleton
2015-04-29 13:41 ` [PATCH 3/6] devtool: add: add an option to fetch remote source Paul Eggleton
2015-04-29 13:41 ` [PATCH 4/6] devtool: add: use the appropriate file naming and versioning for SCM recipes Paul Eggleton
2015-04-29 13:41 ` [PATCH 5/6] recipetool: allow specifying SRCREV via rev= in URI Paul Eggleton
2015-04-29 13:42 ` [PATCH 6/6] oe-selftest: devtool: add some tests for devtool add -f Paul Eggleton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430389061.9508.14.camel@linux.intel.com \
--to=markus.lehtonen@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=paul.eggleton@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox