* [RFC PATCH 0/1] process cmd line parsing result by individual UI
@ 2011-06-14 7:12 Lianhao Lu
2011-06-14 7:12 ` [RFC PATCH 1/1] bitbake cooker/ui: handle " Lianhao Lu
2011-07-08 16:39 ` [RFC PATCH 0/1] process " Richard Purdie
0 siblings, 2 replies; 3+ messages in thread
From: Lianhao Lu @ 2011-06-14 7:12 UTC (permalink / raw)
To: bitbake-devel
This patch tries to allow the individual UI to decide whether it should display the cmd line parsing result.
The command "getCmdLineAction" now returns either None or a dictionary with the key of {'action', 'msg'}.
If it returns None, it means no command line action parameters are provided.
If it returns a dictionary, the entry of the key 'action' stores the list which should be used with server.runCommand(); the entry of the key 'msg' stores the error message from the cmd line parsing result (in which case the 'action' entry is None).
It is up to the individual UI to decide whether and how to display those parsing result.
Please review the following changes for suitability for inclusion. If you have
any objections or suggestions for improvement, please respond to the patches. If
you agree with the changes, please provide your Acked-by.
The following changes since commit a27fbe5e25a5aee956d2a43a2e2bf671c6d985f2:
Scott Rifenbark (1):
documentation/yocto-project-qs/yocto-project-qs.xml: removed 5.0 references
are available in the git repository at:
git://git.pokylinux.org/poky-contrib llu/cmdLineParsing
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=llu/cmdLineParsing
Lianhao Lu (1):
bitbake cooker/ui: handle cmd line parsing result by individual UI.
bitbake/lib/bb/cooker.py | 34 ++++++++++++++++------------------
bitbake/lib/bb/ui/depexp.py | 7 +++++--
bitbake/lib/bb/ui/goggle.py | 6 +++++-
bitbake/lib/bb/ui/knotty.py | 6 +++++-
bitbake/lib/bb/ui/ncurses.py | 6 +++++-
5 files changed, 36 insertions(+), 23 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [RFC PATCH 1/1] bitbake cooker/ui: handle cmd line parsing result by individual UI.
2011-06-14 7:12 [RFC PATCH 0/1] process cmd line parsing result by individual UI Lianhao Lu
@ 2011-06-14 7:12 ` Lianhao Lu
2011-07-08 16:39 ` [RFC PATCH 0/1] process " Richard Purdie
1 sibling, 0 replies; 3+ messages in thread
From: Lianhao Lu @ 2011-06-14 7:12 UTC (permalink / raw)
To: bitbake-devel
Changed the return result of "getCmdLineAction" to a dictionary
{'action', 'msg'} to allow the individual UI decide how to handle the
cmd line parsing result.
Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
---
bitbake/lib/bb/cooker.py | 34 ++++++++++++++++------------------
bitbake/lib/bb/ui/depexp.py | 7 +++++--
bitbake/lib/bb/ui/goggle.py | 6 +++++-
bitbake/lib/bb/ui/knotty.py | 6 +++++-
bitbake/lib/bb/ui/ncurses.py | 6 +++++-
5 files changed, 36 insertions(+), 23 deletions(-)
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index c81baf6..76c29a8 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -176,41 +176,39 @@ class BBCooker:
def parseCommandLine(self):
# Parse any commandline into actions
+ self.commandlineAction = {'action':None, 'msg':None}
if self.configuration.show_environment:
- self.commandlineAction = None
-
if 'world' in self.configuration.pkgs_to_build:
- buildlog.error("'world' is not a valid target for --environment.")
- if 'universe' in self.configuration.pkgs_to_build:
- buildlog.error("'universe' is not a valid target for --environment.")
+ self.commandlineAction['msg'] = "'world' is not a valid target for --environment."
+ elif 'universe' in self.configuration.pkgs_to_build:
+ self.commandlineAction['msg'] = "'universe' is not a valid target for --environment."
elif len(self.configuration.pkgs_to_build) > 1:
- buildlog.error("Only one target can be used with the --environment option.")
+ self.commandlineAction['msg'] = "Only one target can be used with the --environment option."
elif self.configuration.buildfile and len(self.configuration.pkgs_to_build) > 0:
- buildlog.error("No target should be used with the --environment and --buildfile options.")
+ self.commandlineAction['msg'] = "No target should be used with the --environment and --buildfile options."
elif len(self.configuration.pkgs_to_build) > 0:
- self.commandlineAction = ["showEnvironmentTarget", self.configuration.pkgs_to_build]
+ self.commandlineAction['action'] = ["showEnvironmentTarget", self.configuration.pkgs_to_build]
else:
- self.commandlineAction = ["showEnvironment", self.configuration.buildfile]
+ self.commandlineAction['action'] = ["showEnvironment", self.configuration.buildfile]
elif self.configuration.buildfile is not None:
- self.commandlineAction = ["buildFile", self.configuration.buildfile, self.configuration.cmd]
+ self.commandlineAction['action'] = ["buildFile", self.configuration.buildfile, self.configuration.cmd]
elif self.configuration.revisions_changed:
- self.commandlineAction = ["compareRevisions"]
+ self.commandlineAction['action'] = ["compareRevisions"]
elif self.configuration.show_versions:
- self.commandlineAction = ["showVersions"]
+ self.commandlineAction['action'] = ["showVersions"]
elif self.configuration.parse_only:
- self.commandlineAction = ["parseFiles"]
+ self.commandlineAction['action'] = ["parseFiles"]
elif self.configuration.dot_graph:
if self.configuration.pkgs_to_build:
- self.commandlineAction = ["generateDotGraph", self.configuration.pkgs_to_build, self.configuration.cmd]
+ self.commandlineAction['action'] = ["generateDotGraph", self.configuration.pkgs_to_build, self.configuration.cmd]
else:
- self.commandlineAction = None
- buildlog.error("Please specify a package name for dependency graph generation.")
+ self.commandlineAction['msg'] = "Please specify a package name for dependency graph generation."
else:
if self.configuration.pkgs_to_build:
- self.commandlineAction = ["buildTargets", self.configuration.pkgs_to_build, self.configuration.cmd]
+ self.commandlineAction['action'] = ["buildTargets", self.configuration.pkgs_to_build, self.configuration.cmd]
else:
+ #self.commandlineAction['msg'] = "Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information."
self.commandlineAction = None
- buildlog.error("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
def runCommands(self, server, data, abort):
"""
diff --git a/bitbake/lib/bb/ui/depexp.py b/bitbake/lib/bb/ui/depexp.py
index 575dd1c..0d58505 100644
--- a/bitbake/lib/bb/ui/depexp.py
+++ b/bitbake/lib/bb/ui/depexp.py
@@ -199,10 +199,13 @@ class gtkthread(threading.Thread):
def main(server, eventHandler):
try:
cmdline = server.runCommand(["getCmdLineAction"])
- if not cmdline or cmdline[0] != "generateDotGraph":
+ if cmdline and not cmdline['action']:
+ print(cmdline['msg'])
+ return
+ elif not cmdline or (cmdline['action'] and cmdline['action'][0] != "generateDotGraph"):
print("This UI is only compatible with the -g option")
return
- ret = server.runCommand(["generateDepTreeEvent", cmdline[1], cmdline[2]])
+ ret = server.runCommand(["generateDepTreeEvent", cmdline['action'][1], cmdline['action'][2]])
if ret != True:
print("Couldn't run command! %s" % ret)
return
diff --git a/bitbake/lib/bb/ui/goggle.py b/bitbake/lib/bb/ui/goggle.py
index bd03d31..b2fd274 100644
--- a/bitbake/lib/bb/ui/goggle.py
+++ b/bitbake/lib/bb/ui/goggle.py
@@ -82,8 +82,12 @@ def main (server, eventHandler):
try:
cmdline = server.runCommand(["getCmdLineAction"])
if not cmdline:
+ print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
return 1
- ret = server.runCommand(cmdline)
+ elif not cmdline['action']:
+ print(cmdline['msg'])
+ return 1
+ ret = server.runCommand(cmdline['action'])
if ret != True:
print("Couldn't get default commandline! %s" % ret)
return 1
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 997eb3f..a4deb46 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -80,8 +80,12 @@ def main(server, eventHandler):
try:
cmdline = server.runCommand(["getCmdLineAction"])
if not cmdline:
+ print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
return 1
- ret = server.runCommand(cmdline)
+ elif not cmdline['action']:
+ print(cmdline['msg'])
+ return 1
+ ret = server.runCommand(cmdline['action'])
if ret != True:
print("Couldn't get default commandline! %s" % ret)
return 1
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py
index 469f1b7..8684697 100644
--- a/bitbake/lib/bb/ui/ncurses.py
+++ b/bitbake/lib/bb/ui/ncurses.py
@@ -232,8 +232,12 @@ class NCursesUI:
try:
cmdline = server.runCommand(["getCmdLineAction"])
if not cmdline:
+ print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
return
- ret = server.runCommand(cmdline)
+ elif not cmdline['action']:
+ print(cmdline['msg'])
+ return
+ ret = server.runCommand(cmdline['action'])
if ret != True:
print("Couldn't get default commandlind! %s" % ret)
return
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH 0/1] process cmd line parsing result by individual UI
2011-06-14 7:12 [RFC PATCH 0/1] process cmd line parsing result by individual UI Lianhao Lu
2011-06-14 7:12 ` [RFC PATCH 1/1] bitbake cooker/ui: handle " Lianhao Lu
@ 2011-07-08 16:39 ` Richard Purdie
1 sibling, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2011-07-08 16:39 UTC (permalink / raw)
To: Lianhao Lu; +Cc: bitbake-devel
On Tue, 2011-06-14 at 15:12 +0800, Lianhao Lu wrote:
> This patch tries to allow the individual UI to decide whether it should display the cmd line parsing result.
>
> The command "getCmdLineAction" now returns either None or a dictionary with the key of {'action', 'msg'}.
>
> If it returns None, it means no command line action parameters are provided.
>
> If it returns a dictionary, the entry of the key 'action' stores the list which should be used with server.runCommand(); the entry of the key 'msg' stores the error message from the cmd line parsing result (in which case the 'action' entry is None).
>
> It is up to the individual UI to decide whether and how to display those parsing result.
>
> Please review the following changes for suitability for inclusion. If you have
> any objections or suggestions for improvement, please respond to the patches. If
> you agree with the changes, please provide your Acked-by.
>
> The following changes since commit a27fbe5e25a5aee956d2a43a2e2bf671c6d985f2:
> Scott Rifenbark (1):
> documentation/yocto-project-qs/yocto-project-qs.xml: removed 5.0 references
>
> are available in the git repository at:
>
> git://git.pokylinux.org/poky-contrib llu/cmdLineParsing
> http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=llu/cmdLineParsing
Merged to master, thanks.
In future please put the above info in the commit message instead of the
pull request though! :)
Cheers,
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-08 16:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-14 7:12 [RFC PATCH 0/1] process cmd line parsing result by individual UI Lianhao Lu
2011-06-14 7:12 ` [RFC PATCH 1/1] bitbake cooker/ui: handle " Lianhao Lu
2011-07-08 16:39 ` [RFC PATCH 0/1] process " Richard Purdie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.