summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2011-11-02 14:35:55 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-07 13:58:38 +0000
commitd4d491aa118b6cbe895167c62a46d883abc7b4ab (patch)
tree191103186fd8436cc2b8d1dab234320e50bb24fb
parentb6b6b215675631d0e505ffc8b4890f85fb3169f9 (diff)
downloadopenembedded-core-d4d491aa118b6cbe895167c62a46d883abc7b4ab.tar.gz
openembedded-core-d4d491aa118b6cbe895167c62a46d883abc7b4ab.tar.bz2
openembedded-core-d4d491aa118b6cbe895167c62a46d883abc7b4ab.tar.xz
openembedded-core-d4d491aa118b6cbe895167c62a46d883abc7b4ab.zip
scripts/combo-layer: make init set up initial component data
The "init" subcommand will now copy the current state of each component repository into the combo layer repository, set last_revision for each component, and then use "git add" to set up the initial commit (but will not actually make the initial commit - that is left up to the user). Also take the opportunity to bump the version number. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rwxr-xr-xscripts/combo-layer22
-rw-r--r--scripts/combo-layer.conf.example5
2 files changed, 23 insertions, 4 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index d6d238d83..db38a9580 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -26,7 +26,7 @@ import logging
import subprocess
import ConfigParser
-__version__ = "0.1.0"
+__version__ = "0.2.0"
def logger_create():
logger = logging.getLogger("")
@@ -146,7 +146,7 @@ def runcmd(cmd,destdir=None):
def action_init(conf, args):
"""
Clone component repositories
- Check git initialised and working tree is clean
+ Check git is initialised; if not, copy initial data from component repos
"""
for name in conf.repos:
ldir = conf.repos[name]['local_repo_dir']
@@ -155,6 +155,24 @@ def action_init(conf, args):
subprocess.check_call("git clone %s %s" % (conf.repos[name]['src_uri'], ldir), shell=True)
if not os.path.exists(".git"):
runcmd("git init")
+ for name in conf.repos:
+ ldir = conf.repos[name]['local_repo_dir']
+ logger.info("copying data from %s..." % name)
+ dest_dir = conf.repos[name]['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()
+ file_filter = conf.repos[name].get('file_filter',"")
+ runcmd("git archive master | tar -x -C %s %s" % (extract_dir, file_filter), ldir)
+ lastrev = runcmd("git rev-parse HEAD", ldir).strip()
+ conf.update(name, "last_revision", lastrev)
+ runcmd("git add .")
+ logger.info("Initial combo layer repository data has been created; please make any changes if desired and then use 'git commit' to make the initial commit.")
+ else:
+ logger.info("Repository already initialised, nothing to do.")
+
def check_repo_clean(repodir):
"""
diff --git a/scripts/combo-layer.conf.example b/scripts/combo-layer.conf.example
index 09b94156f..8cee04f77 100644
--- a/scripts/combo-layer.conf.example
+++ b/scripts/combo-layer.conf.example
@@ -11,8 +11,9 @@ local_repo_dir = /home/kyu3/src/test/bitbake
# use "." if it is root dir
dest_dir = bitbake
-# the updated revision last time.
-# If empty, the tool will start from the first commit
+# the last update revision.
+# "init" will set this automatically, however if it is empty when "update"
+# is run, the tool will start from the first commit.
last_revision =
# optional options