From: Jiajie Hu <jiajie.hu@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] devtool: execute associated functions while preparing the source tree
Date: Tue, 29 Nov 2016 10:59:09 +0800 [thread overview]
Message-ID: <1480388349-4206-1-git-send-email-jiajie.hu@intel.com> (raw)
Execute prefuncs and postfuncs associated with the task while preparing
the source tree. If any changes are made to the source tree by these
prefuncs or postfuncs, a separate commit will be created so that the
changes won't get incorporated with other patches.
Signed-off-by: Jiajie Hu <jiajie.hu@intel.com>
---
scripts/lib/devtool/standard.py | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index e4d2a57..8302112 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -424,8 +424,7 @@ class BbTaskExecutor(object):
self.rdata = rdata
self.executed = []
- def exec_func(self, func, report):
- """Run bitbake task function"""
+ def _exec_func(self, func, report):
if not func in self.executed:
deps = self.rdata.getVarFlag(func, 'deps', False)
if deps:
@@ -435,12 +434,25 @@ class BbTaskExecutor(object):
logger.info('Executing %s...' % func)
fn = self.rdata.getVar('FILE', True)
localdata = bb.build._task_data(fn, func, self.rdata)
+ prefuncs = localdata.getVarFlag(func, 'prefuncs', True)
+ postfuncs = localdata.getVarFlag(func, 'postfuncs', True)
try:
+ for prefunc in (prefuncs or '').split():
+ bb.build.exec_func(prefunc, localdata)
+ yield prefunc
bb.build.exec_func(func, localdata)
+ for postfunc in (postfuncs or '').split():
+ bb.build.exec_func(postfunc, localdata)
+ yield postfunc
except bb.build.FuncFailed as e:
raise DevtoolError(str(e))
self.executed.append(func)
+ def exec_func(self, func, report):
+ """Run bitbake task function"""
+ for step in self._exec_func(func, report):
+ pass
+
class PatchTaskExecutor(BbTaskExecutor):
def __init__(self, rdata):
@@ -462,7 +474,12 @@ class PatchTaskExecutor(BbTaskExecutor):
else:
os.rmdir(patchdir)
- super(PatchTaskExecutor, self).exec_func(func, report)
+ for step in super(PatchTaskExecutor, self)._exec_func(func, report):
+ if self.check_git and os.path.exists(srcsubdir):
+ stdout, _ = bb.process.run('git status --porcelain', cwd=srcsubdir)
+ if stdout:
+ bb.process.run('git add .; git %s commit -a -m "Committing changes from %s\n\n%s"' % (' '.join(self.useroptions), step, GitApplyTree.ignore_commit_prefix + ' - from %s' % step), cwd=srcsubdir)
+
if self.check_git and os.path.exists(srcsubdir):
if func == 'do_patch':
if os.path.exists(patchdir):
--
1.9.1
next reply other threads:[~2016-11-29 2:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-29 2:59 Jiajie Hu [this message]
2016-11-29 6:04 ` [PATCH] devtool: execute associated functions while preparing the source tree Christopher Larson
2016-11-29 7:37 ` Jiajie Hu
2016-11-29 18:01 ` Paul Eggleton
2016-11-30 1:33 ` Jiajie Hu
2016-11-30 1:39 ` Paul Eggleton
2016-11-30 3:14 ` Paul Eggleton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1480388349-4206-1-git-send-email-jiajie.hu@intel.com \
--to=jiajie.hu@intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox