update.py: add --nocheckout option

This allows disabling the checkout of the appropriate branch so that we
can test the update script with fixes to bitbake or the metadata if
needed.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2013-05-22 15:28:50 +01:00
parent eaa7e4a8d7
commit 5a07f0422d

View File

@ -175,6 +175,9 @@ def main():
parser.add_option("-x", "--nofetch", parser.add_option("-x", "--nofetch",
help = "Don't fetch repositories", help = "Don't fetch repositories",
action="store_true", dest="nofetch") action="store_true", dest="nofetch")
parser.add_option("", "--nocheckout",
help = "Don't check out branches",
action="store_true", dest="nocheckout")
parser.add_option("-d", "--debug", parser.add_option("-d", "--debug",
help = "Enable debug output", help = "Enable debug output",
action="store_const", const=logging.DEBUG, dest="loglevel", default=logging.INFO) action="store_const", const=logging.DEBUG, dest="loglevel", default=logging.INFO)
@ -262,6 +265,7 @@ def main():
else: else:
out = runcmd("git fetch", bitbakepath) out = runcmd("git fetch", bitbakepath)
if not options.nocheckout:
# Check out the branch of BitBake appropriate for this branch and clean out any stale files (e.g. *.pyc) # Check out the branch of BitBake appropriate for this branch and clean out any stale files (e.g. *.pyc)
out = runcmd("git checkout origin/%s" % branch.bitbake_branch, bitbakepath) out = runcmd("git checkout origin/%s" % branch.bitbake_branch, bitbakepath)
out = runcmd("git clean -f -x", bitbakepath) out = runcmd("git clean -f -x", bitbakepath)
@ -283,6 +287,7 @@ def main():
core_urldir = core_layer.get_fetch_dir() core_urldir = core_layer.get_fetch_dir()
core_repodir = os.path.join(fetchdir, core_urldir) core_repodir = os.path.join(fetchdir, core_urldir)
core_layerdir = os.path.join(core_repodir, core_subdir) core_layerdir = os.path.join(core_repodir, core_subdir)
if not options.nocheckout:
out = runcmd("git checkout origin/%s" % options.branch, core_repodir) out = runcmd("git checkout origin/%s" % options.branch, core_repodir)
out = runcmd("git clean -f -x", core_repodir) out = runcmd("git clean -f -x", core_repodir)
# The directory above where this script exists should contain our conf/layer.conf, # The directory above where this script exists should contain our conf/layer.conf,
@ -373,7 +378,9 @@ def main():
layermachines = Machine.objects.filter(layerbranch=layerbranch) layermachines = Machine.objects.filter(layerbranch=layerbranch)
if layerbranch.vcs_last_rev != topcommit.hexsha or options.reload: if layerbranch.vcs_last_rev != topcommit.hexsha or options.reload:
# Check out appropriate branch # Check out appropriate branch
if not options.nocheckout:
out = runcmd("git checkout origin/%s" % options.branch, repodir) out = runcmd("git checkout origin/%s" % options.branch, repodir)
out = runcmd("git clean -f -x", repodir)
if not os.path.exists(layerdir): if not os.path.exists(layerdir):
if options.branch == 'master': if options.branch == 'master':