scripts/combo-layer: make component repo branch configurable
Add an optional per-component branch setting to allow specifying the branch instead of always using master. (From OE-Core rev: 8e2b8b05607103acd539808c5ab0cc80c0d481fc) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
cb21ff1807
commit
25fc202e21
|
@ -108,19 +108,23 @@ def action_init(conf, args):
|
||||||
if not os.path.exists(ldir):
|
if not os.path.exists(ldir):
|
||||||
logger.info("cloning %s to %s" %(conf.repos[name]['src_uri'], 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)
|
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"):
|
if not os.path.exists(".git"):
|
||||||
runcmd("git init")
|
runcmd("git init")
|
||||||
for name in conf.repos:
|
for name in conf.repos:
|
||||||
ldir = conf.repos[name]['local_repo_dir']
|
repo = conf.repos[name]
|
||||||
|
ldir = repo['local_repo_dir']
|
||||||
logger.info("copying data from %s..." % name)
|
logger.info("copying data from %s..." % name)
|
||||||
dest_dir = conf.repos[name]['dest_dir']
|
dest_dir = repo['dest_dir']
|
||||||
if dest_dir and dest_dir != ".":
|
if dest_dir and dest_dir != ".":
|
||||||
extract_dir = os.path.join(os.getcwd(), dest_dir)
|
extract_dir = os.path.join(os.getcwd(), dest_dir)
|
||||||
os.makedirs(extract_dir)
|
os.makedirs(extract_dir)
|
||||||
else:
|
else:
|
||||||
extract_dir = os.getcwd()
|
extract_dir = os.getcwd()
|
||||||
file_filter = conf.repos[name].get('file_filter',"")
|
branch = repo.get('branch', "master")
|
||||||
runcmd("git archive master | tar -x -C %s %s" % (extract_dir, file_filter), ldir)
|
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 HEAD", ldir).strip()
|
lastrev = runcmd("git rev-parse HEAD", ldir).strip()
|
||||||
conf.update(name, "last_revision", lastrev)
|
conf.update(name, "last_revision", lastrev)
|
||||||
runcmd("git add .")
|
runcmd("git add .")
|
||||||
|
@ -162,9 +166,11 @@ def action_update(conf, args):
|
||||||
repo = conf.repos[name]
|
repo = conf.repos[name]
|
||||||
ldir = repo['local_repo_dir']
|
ldir = repo['local_repo_dir']
|
||||||
dest_dir = repo['dest_dir']
|
dest_dir = repo['dest_dir']
|
||||||
|
branch = repo.get('branch', "master")
|
||||||
repo_patch_dir = os.path.join(os.getcwd(), patch_dir, name)
|
repo_patch_dir = os.path.join(os.getcwd(), patch_dir, name)
|
||||||
|
|
||||||
# Step 1: update the component repo
|
# Step 1: update the component repo
|
||||||
|
runcmd("git checkout %s" % branch, ldir)
|
||||||
logger.info("git pull for component repo %s in %s ..." % (name, ldir))
|
logger.info("git pull for component repo %s in %s ..." % (name, ldir))
|
||||||
output=runcmd("git pull", ldir)
|
output=runcmd("git pull", ldir)
|
||||||
logger.info(output)
|
logger.info(output)
|
||||||
|
@ -177,11 +183,11 @@ def action_update(conf, args):
|
||||||
prefix = ""
|
prefix = ""
|
||||||
if repo['last_revision'] == "":
|
if repo['last_revision'] == "":
|
||||||
logger.info("Warning: last_revision of component %s is not set, so start from the first commit" % name)
|
logger.info("Warning: last_revision of component %s is not set, so start from the first commit" % name)
|
||||||
patch_cmd_range = "--root master"
|
patch_cmd_range = "--root %s" % branch
|
||||||
rev_cmd_range = "master"
|
rev_cmd_range = branch
|
||||||
else:
|
else:
|
||||||
patch_cmd_range = "%s..master" % repo['last_revision']
|
patch_cmd_range = "%s..%s" % (repo['last_revision'], branch)
|
||||||
rev_cmd_range = "%s..master" % repo['last_revision']
|
rev_cmd_range = patch_cmd_range
|
||||||
|
|
||||||
file_filter = repo.get('file_filter',"")
|
file_filter = repo.get('file_filter',"")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue