aboutsummaryrefslogtreecommitdiffstats
path: root/layerindex/recipeparse.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-04-06 23:27:00 +1200
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-05-04 23:57:53 +1200
commit7343484695f264d68d5b5ed8900a0786d755a2ff (patch)
tree1ae54d2dfd5ff95f77e508f87c784b0a79aa48fc /layerindex/recipeparse.py
parent009adcb8df8dabf5b459a98f35f3d1a829449a36 (diff)
downloadopenembedded-core-contrib-7343484695f264d68d5b5ed8900a0786d755a2ff.tar.gz
utils: add common function to check out a specific git revision
Checking out a revision in the bitbake/layer repositories is something we are doing in a few places, so add a checkout_repo() function that does this, ensuring that we don't get tripped up by any junk files, and avoids checking out if the repository is already at the desired revision (thus avoiding the clean operation and e.g. preserving any .pyc files that aren't stale and would speed things up a little). Note that we do the clean before checking out in case there are untracked files that are tracked in the commit we are checking out. In addition to adding this function, change the existing code that we use in the update script to check out a layer use the new function. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'layerindex/recipeparse.py')
-rw-r--r--layerindex/recipeparse.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/layerindex/recipeparse.py b/layerindex/recipeparse.py
index f211cfac4a..f1c1bd3246 100644
--- a/layerindex/recipeparse.py
+++ b/layerindex/recipeparse.py
@@ -31,8 +31,7 @@ def init_parser(settings, branch, bitbakepath, enable_tracking=False, nocheckout
else:
# Branch name
bitbake_ref = 'origin/%s' % branch.bitbake_branch
- out = utils.runcmd("git checkout %s" % bitbake_ref, bitbakepath, logger=logger)
- out = utils.runcmd("git clean -f -x", bitbakepath, logger=logger)
+ utils.checkout_repo(bitbakepath, bitbake_ref, logger=logger)
# Skip sanity checks
os.environ['BB_ENV_EXTRAWHITE'] = 'DISABLE_SANITY_CHECKS'
@@ -57,8 +56,7 @@ def init_parser(settings, branch, bitbakepath, enable_tracking=False, nocheckout
core_repodir = os.path.join(fetchdir, core_urldir)
core_layerdir = os.path.join(core_repodir, core_subdir)
if not nocheckout:
- out = utils.runcmd("git checkout origin/%s" % core_branchname, core_repodir, logger=logger)
- out = utils.runcmd("git clean -f -x", core_repodir, logger=logger)
+ utils.checkout_repo(core_repodir, "origin/%s" % core_branchname, logger=logger)
if not os.path.exists(os.path.join(core_layerdir, 'conf/bitbake.conf')):
raise RecipeParseError("conf/bitbake.conf not found in core layer %s - is subdirectory set correctly?" % core_layer.name)
# The directory above where this script exists should contain our conf/layer.conf,