diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-09-13 17:23:11 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-14 09:49:54 +0100 |
commit | ff8277cd133e9a02b131977078cff61fa587a1af (patch) | |
tree | 0da1fac386584df9a786d01c02141f4f85a77b97 /scripts/combo-layer | |
parent | 3e40136e8bd13b17b6d88b6acfb5ed162bb8d96a (diff) | |
download | openembedded-core-ff8277cd133e9a02b131977078cff61fa587a1af.tar.gz openembedded-core-ff8277cd133e9a02b131977078cff61fa587a1af.tar.bz2 openembedded-core-ff8277cd133e9a02b131977078cff61fa587a1af.zip |
scripts/combo-layer: use last_revision if specified in init
If last_revision is specified for a component when running combo-layer
init, then use that revision instead of the latest revision on the
branch. Also, remove unnecessary git checkout during init since we
specify the revision to all calls to git when dealing with the component
repositories.
Fixes [YOCTO #3040].
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'scripts/combo-layer')
-rwxr-xr-x | scripts/combo-layer | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer index 330faca389..65435db8c0 100755 --- a/scripts/combo-layer +++ b/scripts/combo-layer @@ -174,25 +174,31 @@ def action_init(conf, args): if not os.path.exists(ldir): logger.info("cloning %s to %s" %(conf.repos[name]['src_uri'], ldir)) subprocess.check_call("git clone %s %s" % (conf.repos[name]['src_uri'], ldir), shell=True) - branch = conf.repos[name].get('branch', "master") - runcmd("git checkout %s" % branch, ldir) if not os.path.exists(".git"): runcmd("git init") for name in conf.repos: repo = conf.repos[name] ldir = repo['local_repo_dir'] - logger.info("copying data from %s..." % name) + branch = repo.get('branch', "master") + lastrev = repo.get('last_revision', None) + if lastrev and lastrev != "HEAD": + initialrev = lastrev + logger.info("Copying data from %s at specified revision %s..." % (name, lastrev)) + else: + lastrev = None + initialrev = branch + logger.info("Copying data from %s..." % name) dest_dir = repo['dest_dir'] if dest_dir and dest_dir != ".": extract_dir = os.path.join(os.getcwd(), dest_dir) os.makedirs(extract_dir) else: extract_dir = os.getcwd() - branch = repo.get('branch', "master") file_filter = repo.get('file_filter', "") - runcmd("git archive %s | tar -x -C %s %s" % (branch, extract_dir, file_filter), ldir) - lastrev = runcmd("git rev-parse %s" % branch, ldir).strip() - conf.update(name, "last_revision", lastrev, initmode=True) + runcmd("git archive %s | tar -x -C %s %s" % (initialrev, extract_dir, file_filter), ldir) + if not lastrev: + lastrev = runcmd("git rev-parse %s" % initialrev, ldir).strip() + conf.update(name, "last_revision", lastrev, initmode=True) runcmd("git add .") if conf.localconffile: localadded = True |