diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-09-22 17:21:33 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-23 09:53:17 +0100 |
commit | 3bd0f335058208ce29caffd25391fb023c2d719f (patch) | |
tree | 82366931a022f7923692f33a97e205a2346b5c0a /scripts/lib/devtool/__init__.py | |
parent | e759b0b75db25d0b5f43e9c6e488a6be17fbe332 (diff) | |
download | poky-3bd0f335058208ce29caffd25391fb023c2d719f.tar.gz |
devtool: add: set up fetched source as a git repository by default
If the fetched source isn't already a git repository, initialise it as
one and then branch and tag, just as we do with "devtool modify". This
makes it easier to make changes, commit them and then use the
"devtool update-recipe" command to turn those commits into patches
on the recipe.
(From OE-Core rev: 2dd865086c37c9eff63c6d0bbfa9f2e909f9fffe)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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): | |||
170 | else: | 170 | else: |
171 | b_is_s = False | 171 | b_is_s = False |
172 | return b_is_s | 172 | return b_is_s |
173 | |||
174 | def setup_git_repo(repodir, version, devbranch, basetag='devtool-base'): | ||
175 | """ | ||
176 | Set up the git repository for the source tree | ||
177 | """ | ||
178 | import bb.process | ||
179 | if not os.path.exists(os.path.join(repodir, '.git')): | ||
180 | bb.process.run('git init', cwd=repodir) | ||
181 | bb.process.run('git add .', cwd=repodir) | ||
182 | if version: | ||
183 | commitmsg = "Initial commit from upstream at version %s" % version | ||
184 | else: | ||
185 | commitmsg = "Initial commit from upstream" | ||
186 | bb.process.run('git commit -q -m "%s"' % commitmsg, cwd=repodir) | ||
187 | |||
188 | bb.process.run('git checkout -b %s' % devbranch, cwd=repodir) | ||
189 | bb.process.run('git tag -f %s' % basetag, cwd=repodir) | ||