summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-07-31 01:06:21 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-31 08:02:10 +0100
commit2ed3f63b021626fa3de90153c5648ad927518e21 (patch)
treedebf971571cde735eef97b6051af049628c269dc /scripts
parentdad01a055bb4fc1cb567723b80196818eb99f6e5 (diff)
downloadpoky-2ed3f63b021626fa3de90153c5648ad927518e21.tar.gz
combo-layer: allow component pull to be done separately
* Add a -n option to disable component repo pull during update * Add a 'pull' action to pull the component repos only (From OE-Core rev: 61983b2191253b24117b63f586d5aac00c7eb48e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/combo-layer51
1 files changed, 39 insertions, 12 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index b1a9dcac29..554ac06191 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -181,12 +181,7 @@ def check_patch(patchfile):
181 of.close() 181 of.close()
182 os.rename(patchfile + '.tmp', patchfile) 182 os.rename(patchfile + '.tmp', patchfile)
183 183
184def action_update(conf, args): 184def get_repos(conf, args):
185 """
186 update the component repos
187 generate the patch list
188 apply the generated patches
189 """
190 repos = [] 185 repos = []
191 if len(args) > 1: 186 if len(args) > 1:
192 for arg in args[1:]: 187 for arg in args[1:]:
@@ -202,15 +197,48 @@ def action_update(conf, args):
202 if not repos: 197 if not repos:
203 repos = conf.repos 198 repos = conf.repos
204 199
200 return repos
201
202def action_pull(conf, args):
203 """
204 update the component repos only
205 """
206 repos = get_repos(conf, args)
207
205 # make sure all repos are clean 208 # make sure all repos are clean
206 for name in repos: 209 for name in repos:
207 check_repo_clean(conf.repos[name]['local_repo_dir']) 210 check_repo_clean(conf.repos[name]['local_repo_dir'])
211
212 for name in repos:
213 repo = conf.repos[name]
214 ldir = repo['local_repo_dir']
215 branch = repo.get('branch', "master")
216 runcmd("git checkout %s" % branch, ldir)
217 logger.info("git pull for component repo %s in %s ..." % (name, ldir))
218 output=runcmd("git pull", ldir)
219 logger.info(output)
220
221def action_update(conf, args):
222 """
223 update the component repos
224 generate the patch list
225 apply the generated patches
226 """
227 repos = get_repos(conf, args)
228
229 # make sure combo repo is clean
208 check_repo_clean(os.getcwd()) 230 check_repo_clean(os.getcwd())
209 231
210 import uuid 232 import uuid
211 patch_dir = "patch-%s" % uuid.uuid4() 233 patch_dir = "patch-%s" % uuid.uuid4()
212 os.mkdir(patch_dir) 234 os.mkdir(patch_dir)
213 235
236 # Step 1: update the component repos
237 if conf.nopull:
238 logger.info("Skipping pull (-n)")
239 else:
240 action_pull(conf, args)
241
214 for name in repos: 242 for name in repos:
215 repo = conf.repos[name] 243 repo = conf.repos[name]
216 ldir = repo['local_repo_dir'] 244 ldir = repo['local_repo_dir']
@@ -218,12 +246,6 @@ def action_update(conf, args):
218 branch = repo.get('branch', "master") 246 branch = repo.get('branch', "master")
219 repo_patch_dir = os.path.join(os.getcwd(), patch_dir, name) 247 repo_patch_dir = os.path.join(os.getcwd(), patch_dir, name)
220 248
221 # Step 1: update the component repo
222 runcmd("git checkout %s" % branch, ldir)
223 logger.info("git pull for component repo %s in %s ..." % (name, ldir))
224 output=runcmd("git pull", ldir)
225 logger.info(output)
226
227 # Step 2: generate the patch list and store to patch dir 249 # Step 2: generate the patch list and store to patch dir
228 logger.info("generating patches for %s" % name) 250 logger.info("generating patches for %s" % name)
229 if dest_dir != ".": 251 if dest_dir != ".":
@@ -369,6 +391,7 @@ def action_error(conf, args):
369actions = { 391actions = {
370 "init": action_init, 392 "init": action_init,
371 "update": action_update, 393 "update": action_update,
394 "pull": action_pull,
372 "splitpatch": action_splitpatch, 395 "splitpatch": action_splitpatch,
373} 396}
374 397
@@ -382,6 +405,7 @@ Create and update a combination layer repository from multiple component reposit
382Action: 405Action:
383 init initialise the combo layer repo 406 init initialise the combo layer repo
384 update [components] get patches from component repos and apply them to the combo repo 407 update [components] get patches from component repos and apply them to the combo repo
408 pull [components] just pull component repos only
385 splitpatch [commit] generate commit patch and split per component, default commit is HEAD""") 409 splitpatch [commit] generate commit patch and split per component, default commit is HEAD""")
386 410
387 parser.add_option("-c", "--conf", help = "specify the config file (conf/combo-layer.conf is the default).", 411 parser.add_option("-c", "--conf", help = "specify the config file (conf/combo-layer.conf is the default).",
@@ -393,6 +417,9 @@ Action:
393 parser.add_option("-D", "--debug", help = "output debug information", 417 parser.add_option("-D", "--debug", help = "output debug information",
394 action = "store_true", dest = "debug", default = False) 418 action = "store_true", dest = "debug", default = False)
395 419
420 parser.add_option("-n", "--no-pull", help = "skip pulling component repos during update",
421 action = "store_true", dest = "nopull", default = False)
422
396 options, args = parser.parse_args(sys.argv) 423 options, args = parser.parse_args(sys.argv)
397 424
398 # Dispatch to action handler 425 # Dispatch to action handler