diff options
Diffstat (limited to 'scripts/lib/devtool/__init__.py')
-rw-r--r-- | scripts/lib/devtool/__init__.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py index 07a3636e9b..f815ef27fa 100644 --- a/scripts/lib/devtool/__init__.py +++ b/scripts/lib/devtool/__init__.py @@ -170,3 +170,20 @@ def use_external_build(same_dir, no_same_dir, d): else: b_is_s = False return b_is_s + +def setup_git_repo(repodir, version, devbranch, basetag='devtool-base'): + """ + Set up the git repository for the source tree + """ + import bb.process + if not os.path.exists(os.path.join(repodir, '.git')): + bb.process.run('git init', cwd=repodir) + bb.process.run('git add .', cwd=repodir) + if version: + commitmsg = "Initial commit from upstream at version %s" % version + else: + commitmsg = "Initial commit from upstream" + bb.process.run('git commit -q -m "%s"' % commitmsg, cwd=repodir) + + bb.process.run('git checkout -b %s' % devbranch, cwd=repodir) + bb.process.run('git tag -f %s' % basetag, cwd=repodir) |