aboutsummaryrefslogtreecommitdiffstats
path: root/rrs/tools/upgrade_history_internal.py
diff options
context:
space:
mode:
Diffstat (limited to 'rrs/tools/upgrade_history_internal.py')
-rw-r--r--rrs/tools/upgrade_history_internal.py37
1 files changed, 29 insertions, 8 deletions
diff --git a/rrs/tools/upgrade_history_internal.py b/rrs/tools/upgrade_history_internal.py
index 15d4671b1f5..d58a79d639c 100644
--- a/rrs/tools/upgrade_history_internal.py
+++ b/rrs/tools/upgrade_history_internal.py
@@ -153,6 +153,32 @@ def _get_recipes_filenames(ct, repodir, layerdir, logger):
return ct_files
+def checkout_layer_deps(layerbranch, commit, fetchdir, logger):
+ """ Check out the repositories for a layer and its dependencies """
+ # Some layers will be in the same repository, so we only want to check those out once
+ done_repos = []
+ def checkout_layer(lb, lcommit=None, lcommitdate=None, force=False):
+ urldir = str(lb.layer.get_fetch_dir())
+ repodir = os.path.join(fetchdir, urldir)
+ if not repodir in done_repos:
+ if not lcommit:
+ lcommit = utils.runcmd('git rev-list -1 --before="%s" origin/master' % lcommitdate, repodir, logger=logger).strip()
+ utils.checkout_repo(repodir, lcommit, logger, force)
+ done_repos.append(repodir)
+
+ # We "force" here because it's almost certain we'll be checking out a
+ # different revision for the layer itself
+ checkout_layer(layerbranch, commit, force=True)
+ layer_urldir = str(layerbranch.layer.get_fetch_dir())
+ layer_repodir = os.path.join(fetchdir, layer_urldir)
+ commitdate = utils.runcmd("git show -s --format=%ci", layer_repodir, logger=logger)
+
+ for dep in layerbranch.get_recursive_dependencies():
+ checkout_layer(dep, lcommitdate=commitdate)
+
+ return commitdate
+
+
def generate_history(options, layerbranch_id, commit, logger):
from layerindex.models import LayerBranch
from rrs.models import Release
@@ -168,9 +194,7 @@ def generate_history(options, layerbranch_id, commit, logger):
repodir = os.path.join(fetchdir, urldir)
layerdir = os.path.join(repodir, str(layerbranch.vcs_subdir))
- utils.runcmd("git checkout %s" % commit,
- repodir, logger=logger)
- utils.runcmd("git clean -dfx", repodir, logger=logger)
+ commitdate = checkout_layer_deps(layerbranch, commit, fetchdir, logger)
if options.initial:
fns = None
@@ -187,11 +211,8 @@ def generate_history(options, layerbranch_id, commit, logger):
# Branch name, need to check out detached
bitbake_rev = 'origin/%s' % bitbake_rev
else:
- commitdate = utils.runcmd("git show -s --format=%ci", repodir, logger=logger)
- bitbake_rev = '`git rev-list -1 --before="%s" origin/master`' % commitdate
- utils.runcmd('git checkout %s' % bitbake_rev,
- bitbakepath, logger=logger)
- utils.runcmd("git clean -dfx", bitbakepath, logger=logger)
+ bitbake_rev = utils.runcmd('git rev-list -1 --before="%s" origin/master' % commitdate, bitbakepath, logger=logger).strip()
+ utils.checkout_repo(bitbakepath, bitbake_rev, logger)
sys.path.insert(0, os.path.join(bitbakepath, 'lib'))
(tinfoil, d, recipes, tempdir) = load_recipes(layerbranch, bitbakepath,