* [PATCH 1/3] Hob: lower the limitation for PyGTK
2012-06-02 4:54 [PATCH 0/3] Hob: some fixes Shane Wang
@ 2012-06-02 4:54 ` Shane Wang
2012-06-02 4:54 ` [PATCH 2/3] Hob: add versions for compatibility check between Hob and templates Shane Wang
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Shane Wang @ 2012-06-02 4:54 UTC (permalink / raw)
To: bitbake-devel
Signed-off-by: Shane Wang <shane.wang@intel.com>
---
bitbake/lib/bb/ui/hob.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bitbake/lib/bb/ui/hob.py b/bitbake/lib/bb/ui/hob.py
index 97f54ef..9ec32b1 100755
--- a/bitbake/lib/bb/ui/hob.py
+++ b/bitbake/lib/bb/ui/hob.py
@@ -30,7 +30,7 @@ try:
pygtk.require('2.0') # to be certain we don't have gtk+ 1.x !?!
gtkver = gtk.gtk_version
pygtkver = gtk.pygtk_version
- if gtkver < (2, 20, 0) or pygtkver < (2, 22, 0):
+ if gtkver < (2, 20, 0) or pygtkver < (2, 21, 0):
sys.exit("%s,\nYou have Gtk+ %s and PyGtk %s." % (requirements,
".".join(map(str, gtkver)),
".".join(map(str, pygtkver))))
--
1.7.6
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] Hob: add versions for compatibility check between Hob and templates
2012-06-02 4:54 [PATCH 0/3] Hob: some fixes Shane Wang
2012-06-02 4:54 ` [PATCH 1/3] Hob: lower the limitation for PyGTK Shane Wang
@ 2012-06-02 4:54 ` Shane Wang
2012-06-02 4:54 ` [PATCH 3/3] Hob: Interpret some special characters for label markup Shane Wang
2012-06-08 11:02 ` [PATCH 0/3] Hob: some fixes Richard Purdie
3 siblings, 0 replies; 5+ messages in thread
From: Shane Wang @ 2012-06-02 4:54 UTC (permalink / raw)
To: bitbake-devel
If a user uses a very old version of Hob and does some work,
later on he/she upgrade to the latest version of Hob, because
Hob may change the settings (add more config option into the Adv.
Settings dialog or remove some), then the old templates are not
loadable and workable for the new Hob.
Even though the user hasn't save any template before, the Hob could
remember the settings between Hob sessions as a default template,
(Remember we have a bug to ask Hob remember between sessions?),
the new Hob will also load the default template.
By adding versions, we can easily to fix the issue. If the versions
don't match, Hob will remove the old default template first and
initiate a new build, which has very very little impact on the user.
(Just can't remember from the previous session after the user upgrades
to a new and incompatible Hob)
[Yocto #2492]
Signed-off-by: Shane Wang <shane.wang@intel.com>
---
bitbake/lib/bb/ui/crumbs/builder.py | 14 ++++++++++++--
bitbake/lib/bb/ui/crumbs/template.py | 17 ++++++++++++++++-
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 8d35ea9..eaf18ab 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -40,6 +40,8 @@ from bb.ui.crumbs.hig import CrumbsMessageDialog, ImageSelectionDialog, \
from bb.ui.crumbs.persistenttooltip import PersistentTooltip
import bb.ui.crumbs.utils
+hobVer = 20120530
+
class Configuration:
'''Represents the data structure of configuration.'''
@@ -222,6 +224,7 @@ class Configuration:
self.split_proxy("cvs", template.getVar("CVS_PROXY_HOST") + ":" + template.getVar("CVS_PROXY_PORT"))
def save(self, template, defaults=False):
+ template.setVar("VERSION", "%s" % hobVer)
# bblayers.conf
template.setVar("BBLAYERS", " ".join(self.layers))
# local.conf
@@ -468,7 +471,7 @@ class Builder(gtk.Window):
def initiate_new_build_async(self):
self.switch_page(self.MACHINE_SELECTION)
- if self.load_template(TemplateMgr.convert_to_template_pathfilename("default", ".hob/")) == None:
+ if self.load_template(TemplateMgr.convert_to_template_pathfilename("default", ".hob/")) == False:
self.handler.init_cooker()
self.handler.set_extra_inherit("image_types")
self.handler.generate_configuration()
@@ -537,9 +540,16 @@ class Builder(gtk.Window):
def load_template(self, path):
if not os.path.isfile(path):
- return None
+ return False
self.template = TemplateMgr()
+ # check compatibility
+ tempVer = self.template.getVersion(path)
+ if not tempVer or int(tempVer) < hobVer:
+ self.template.destroy()
+ self.template = None
+ return False
+
try:
self.template.load(path)
self.configuration.load(self.template)
diff --git a/bitbake/lib/bb/ui/crumbs/template.py b/bitbake/lib/bb/ui/crumbs/template.py
index cbed270..7309bb6 100644
--- a/bitbake/lib/bb/ui/crumbs/template.py
+++ b/bitbake/lib/bb/ui/crumbs/template.py
@@ -101,7 +101,19 @@ class HobTemplateFile(ConfigFile):
return self.dictionary[var]
else:
return ""
-
+
+ def getVersion(self):
+ contents = ConfigFile.readFile(self)
+
+ pattern = "^\s*(\S+)\s*=\s*(\".*?\")"
+
+ for line in contents:
+ match = re.search(pattern, line)
+ if match:
+ if match.group(1) == "VERSION":
+ return match.group(2).strip('"')
+ return None
+
def load(self):
contents = ConfigFile.readFile(self)
self.dictionary.clear()
@@ -174,6 +186,9 @@ class TemplateMgr(gobject.GObject):
self.image_bb.save()
self.template_hob.save()
+ def getVersion(self, path):
+ return HobTemplateFile(path).getVersion()
+
def load(self, path):
self.template_hob = HobTemplateFile(path)
self.dictionary = self.template_hob.load()
--
1.7.6
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] Hob: Interpret some special characters for label markup
2012-06-02 4:54 [PATCH 0/3] Hob: some fixes Shane Wang
2012-06-02 4:54 ` [PATCH 1/3] Hob: lower the limitation for PyGTK Shane Wang
2012-06-02 4:54 ` [PATCH 2/3] Hob: add versions for compatibility check between Hob and templates Shane Wang
@ 2012-06-02 4:54 ` Shane Wang
2012-06-08 11:02 ` [PATCH 0/3] Hob: some fixes Richard Purdie
3 siblings, 0 replies; 5+ messages in thread
From: Shane Wang @ 2012-06-02 4:54 UTC (permalink / raw)
To: bitbake-devel
Interpret some special characters for label markup, such as &, <, >, etc.
Otherwise, the message dialog can't show them, and worsely, it makes the
whole message blank.
[Yocto #2492]
Signed-off-by: Shane Wang <shane.wang@intel.com>
---
bitbake/lib/bb/ui/crumbs/builder.py | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index eaf18ab..ed6c6cf 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -374,6 +374,15 @@ class Builder(gtk.Window):
END_NOOP : None,
}
+ @classmethod
+ def interpret_markup(cls, msg):
+ msg = msg.replace('&', '&')
+ msg = msg.replace('<', '<')
+ msg = msg.replace('>', '>')
+ msg = msg.replace('"', '"')
+ msg = msg.replace("'", "´")
+ return msg
+
def __init__(self, hobHandler, recipe_model, package_model):
super(Builder, self).__init__()
@@ -729,7 +738,7 @@ class Builder(gtk.Window):
def show_error_dialog(self, msg):
lbl = "<b>Error</b>\n"
- lbl = lbl + "%s\n\n" % msg
+ lbl = lbl + "%s\n\n" % Builder.interpret_markup(msg)
dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR)
button = dialog.add_button("Close", gtk.RESPONSE_OK)
HobButton.style_button(button)
@@ -909,7 +918,7 @@ class Builder(gtk.Window):
self.build_failed()
def handler_no_provider_cb(self, running_build, msg):
- dialog = CrumbsMessageDialog(self, msg, gtk.STOCK_DIALOG_INFO)
+ dialog = CrumbsMessageDialog(self, Builder.interpret_markup(msg), gtk.STOCK_DIALOG_INFO)
button = dialog.add_button("Close", gtk.RESPONSE_OK)
HobButton.style_button(button)
dialog.run()
--
1.7.6
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/3] Hob: some fixes
2012-06-02 4:54 [PATCH 0/3] Hob: some fixes Shane Wang
` (2 preceding siblings ...)
2012-06-02 4:54 ` [PATCH 3/3] Hob: Interpret some special characters for label markup Shane Wang
@ 2012-06-08 11:02 ` Richard Purdie
3 siblings, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2012-06-08 11:02 UTC (permalink / raw)
To: Shane Wang; +Cc: bitbake-devel
On Sat, 2012-06-02 at 12:54 +0800, Shane Wang wrote:
> Here are some fixes for Hob:
> - lower the limitation of PyGTK so Ubuntu 10.04 can still use Hob
> - we will continue to change Hob, add versions for compatibility check
> - some special chars can be shown as markup, replace them with escape chars
> & -> &
> < -> <
> > -> >
> and so on
>
> The following changes since commit de4cdfd6bc1280ac7ac0559b87734d26294ef773:
>
> documentation/kernel-manual/kernel-how-to.xml: Updated to kernel 3.4 (2012-05-31 21:16:55 +0100)
>
> are available in the git repository at:
> git://git.pokylinux.org/poky-contrib shane/newproxy
> http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=shane/newproxy
>
> Shane Wang (3):
> Hob: lower the limitation for PyGTK
> Hob: add versions for compatibility check between Hob and templates
> Hob: Interpret some special characters for label markup
Merged to master, thanks.
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread