Skip to contentSkip to conversation

Hob: bug fixes

PATCH Applied Shane Wang 3 participants 15 messages Mar 29, 2012 – Mar 30, 2012

lore
Share & tools
lore

Shane Wang

author
#0 lore raw

cover Hob: bug fixes

This patchset includes the several Hob fixes:
- fix the icons to be consistent on the whole GUI
- fix the color style of the HobTabBar per visual design
- add more checks before being used to avoid bitbake exception
- fix the button label, etc.

The following changes since commit 0057d7fde8315694307637c4d23fd414a4a200f9:

lib/bb/ui/crumbs/hig: fix layers_changed test (2012-03-29 10:44:54 +0800)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib shane/hob
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=shane/hob

Liming An (2):
Hob: fixed the 'error' icon source picture and adjusted corresponding
showed icon size
Hob: in build details page, change error icon to denied icon

Shane Wang (6):
Hob: clear the building state after a successful build, as a failed
build does
Hob: Change icon to error because parsing error is an error
Hob: Change "Just bake" to "Build image" as required
Hob: make ORANGE to be the same as the color on the dialog runqueue.py: check results[0] in keys of build_pids before being used
to avoid exceptions
Hob: some color style changes to make HobTabBar more close to visual
design

 bitbake/lib/bb/runqueue.py                         |   20 +++++++++------
 bitbake/lib/bb/ui/crumbs/builder.py                |    3 +-
 bitbake/lib/bb/ui/crumbs/hobcolor.py               |    6 +---
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py        |    3 ++
 bitbake/lib/bb/ui/crumbs/hobwidget.py              |   25 ++++++++++++++++----
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |    6 ++--
 bitbake/lib/bb/ui/crumbs/runningbuild.py           |    2 +-
 7 files changed, 43 insertions(+), 22 deletions(-)
Signature · 1 line
1.7.6
author
#1 lore raw

PATCH 1/8 Hob: clear the building state after a successful build, as a failed build does

---
 bitbake/lib/bb/ui/crumbs/builder.py         |    1 +
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +1 -0
index 0c00d2a..a651bdb 100755
@@ -605,6 +605,7 @@ class Builder(gtk.Window):
         elif self.current_step == self.PACKAGE_GENERATING:
             fraction = 1.0
         self.build_details_page.update_progress_bar("Build Completed: ", fraction)
+        self.handler.build_succeeded_async()
         self.stopping = False
 
     def build_failed(self):
bitbake/lib/bb/ui/crumbs/hobeventhandler.py +3 -0
index 9c5dc77..f1f6168 100644
@@ -365,6 +365,9 @@ class HobHandler(gobject.GObject):
         self.commands_async.append(self.SUB_BUILD_IMAGE)
         self.run_next_command(self.GENERATE_IMAGE)
 
+    def build_succeeded_async(self):
+        self.building = False
+
     def build_failed_async(self):
         self.initcmd = None
         self.commands_async = []
Signature · 1 line
1.7.6
author
#2 lore raw

PATCH 2/8 Hob: Change icon to error because parsing error is an error

---
 bitbake/lib/bb/ui/crumbs/builder.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +1 -1
index a651bdb..0226e1d 100755
@@ -486,7 +486,7 @@ class Builder(gtk.Window):
         if msg:
             lbl = "<b>Error</b>\n"
             lbl = lbl + "%s\n\n" % msg
-            dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING)
+            dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR)
             button = dialog.add_button("Close", gtk.RESPONSE_OK)
             HobButton.style_button(button)
             response = dialog.run()
Signature · 1 line
1.7.6
author
#3 lore raw

PATCH 3/8 Hob: Change "Just bake" to "Build image" as required

In reply to Shane Wang

[Yocto #2160]

---
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py +3 -3
index 0f59dd9..8914b1c 100644
@@ -227,11 +227,11 @@ class ImageConfigurationPage (HobPage):
         self.gtable.attach(self.view_packages_button, 20, 40, 30, 35)
 
     def create_config_build_button(self):
-        # Create the "Build packages" and "Just bake" buttons at the bottom
+        # Create the "Build packages" and "Build image" buttons at the bottom
         button_box = gtk.HBox(False, 6)
 
-        # create button "Just bake"
-        just_bake_button = HobButton("Just bake")
+        # create button "Build image"
+        just_bake_button = HobButton("Build image")
         just_bake_button.set_size_request(205, 49)
         just_bake_button.set_tooltip_text("Build image to get your target image")
         just_bake_button.connect("clicked", self.just_bake_button_clicked_cb)
Signature · 1 line
1.7.6
author
#4 lore raw

PATCH 4/8 Hob: make ORANGE to be the same as the color on the dialog

In reply to Shane Wang
---
 bitbake/lib/bb/ui/crumbs/hobcolor.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
bitbake/lib/bb/ui/crumbs/hobcolor.py +1 -1
index 4595dc1..74a9d46 100644
@@ -21,7 +21,7 @@
 class HobColors:
     WHITE        = "#ffffff"
     PALE_GREEN   = "#aaffaa"
-    ORANGE       = "#ff7c24"
+    ORANGE       = "#eb8e68"
     PALE_RED     = "#ffaaaa"
     GRAY         = "#aaaaaa"
     LIGHT_GRAY   = "#dddddd"
Signature · 1 line
1.7.6
author
#11 lore raw

PATCH 6/8 Hob: some color style changes to make HobTabBar more close to visual design

In reply to Shane Wang

The change includes:
- remove the colors which are not used
- change the background of indicators to deep red
- change the color style of the texts on HobTabBar, i.e., the tab text and the indicator background are gray when the tab is the current tab; the tab text is white and the indicator background is deep red when the tab is not the current tab.

---
 bitbake/lib/bb/ui/crumbs/hobcolor.py  |    4 +---
 bitbake/lib/bb/ui/crumbs/hobwidget.py |   12 +++++++++---
 2 files changed, 10 insertions(+), 6 deletions(-)
bitbake/lib/bb/ui/crumbs/hobcolor.py +1 -3
index 74a9d46..e10f546 100644
@@ -25,13 +25,11 @@ class HobColors:
     PALE_RED     = "#ffaaaa"
     GRAY         = "#aaaaaa"
     LIGHT_GRAY   = "#dddddd"
-    DEEP_GRAY    = "#7c7c77"
     SLIGHT_DARK  = "#5f5f5f"
     DARK         = "#3c3b37"
     BLACK        = "#000000"
-    LIGHT_ORANGE = "#f7a787"
-    YELLOW       = "#ffff00"
     PALE_BLUE    = "#53b8ff"
+    DEEP_RED     = "#aa3e3e"
 
     OK = WHITE
     RUNNING = PALE_GREEN
bitbake/lib/bb/ui/crumbs/hobwidget.py +9 -3
index 413370e..8b176c6 100644
@@ -558,7 +558,10 @@ class HobTabBar(gtk.DrawingArea):
                 off_y = (self.tab_height - fonth) / 2
                 x = child["x"] + off_x
                 y = child["y"] + off_y
-                self.window.draw_layout(self.style.fg_gc[gtk.STATE_NORMAL], int(x), int(y), pangolayout)
+                if not child == self.current_child:
+                    self.window.draw_layout(self.style.fg_gc[gtk.STATE_NORMAL], int(x), int(y), pangolayout, gtk.gdk.Color(HobColors.WHITE))
+                else:
+                    self.window.draw_layout(self.style.fg_gc[gtk.STATE_NORMAL], int(x), int(y), pangolayout)
 
     def draw_toggled_tab(self, cr):
         if not self.current_child:
@@ -616,7 +619,10 @@ class HobTabBar(gtk.DrawingArea):
         y = tab_y + self.tab_height/2 - dest_h/2
 
         r = min(dest_w, dest_h)/2
-        color = cr.set_source_color(gtk.gdk.color_parse(HobColors.ORANGE))
+        if not child == self.current_child:
+            color = cr.set_source_color(gtk.gdk.color_parse(HobColors.DEEP_RED))
+        else:
+            color = cr.set_source_color(gtk.gdk.color_parse(HobColors.GRAY))
         # check round back area can contain the text or not
         back_round_can_contain_width = float(2 * r * 0.707)
         if float(textw) > back_round_can_contain_width:
@@ -635,7 +641,7 @@ class HobTabBar(gtk.DrawingArea):
         x = x + (dest_w/2)-(textw/2)
         y = y + (dest_h/2) - (texth/2)
         cr.move_to(x, y)
-        self.window.draw_layout(self.style.fg_gc[gtk.STATE_NORMAL], int(x), int(y), layout)
+        self.window.draw_layout(self.style.fg_gc[gtk.STATE_NORMAL], int(x), int(y), layout, gtk.gdk.Color(HobColors.WHITE))
 
     def show_indicator_icon(self, child, number):
         child["indicator_show"] = True
Signature · 1 line
1.7.6
author
#5 lore raw

PATCH 5/8 runqueue.py: check results[0] in keys of build_pids before being used to avoid exceptions

In reply to Shane Wang

[Yocto #2186]

---
 bitbake/lib/bb/runqueue.py |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
bitbake/lib/bb/runqueue.py +12 -8
index 6970548..67ad14b 100644
@@ -1049,17 +1049,21 @@ class RunQueueExecute:
         result = os.waitpid(-1, os.WNOHANG)
         if result[0] == 0 and result[1] == 0:
             return None
-        task = self.build_pids[result[0]]
-        del self.build_pids[result[0]]
-        self.build_pipes[result[0]].close()
-        del self.build_pipes[result[0]]
+        task = None
+        if result[0] in self.build_pids.keys():
+            task = self.build_pids[result[0]]
+            del self.build_pids[result[0]]
+        if result[0] in self.build_pipes.keys():
+            self.build_pipes[result[0]].close()
+            del self.build_pipes[result[0]]
         # self.build_stamps[result[0]] may not exist when use shared work directory.
         if result[0] in self.build_stamps.keys():
             del self.build_stamps[result[0]]
-        if result[1] != 0:
-            self.task_fail(task, result[1]>>8)
-        else:
-            self.task_complete(task)
+        if task:
+            if result[1] != 0:
+                self.task_fail(task, result[1]>>8)
+            else:
+                self.task_complete(task)
         return True
 
     def finish_now(self):
Signature · 1 line
1.7.6
author
#12 lore raw

PATCH 7/8 Hob: fixed the 'error' icon source picture and adjusted corresponding showed icon size

In reply to Shane Wang

From: Liming An <[email protected]>

The error source picture is not right, so fixed it and adjusted its size.

[YOCTO #2097]

---
 bitbake/lib/bb/ui/crumbs/hobwidget.py |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
bitbake/lib/bb/ui/crumbs/hobwidget.py +11 -2
index 8b176c6..bcc44cc 100644
@@ -52,7 +52,7 @@ class hic:
     ICON_INFO_DISPLAY_FILE        = os.path.join(HOB_ICON_BASE_DIR, ('info/info_display.png'))
     ICON_INFO_HOVER_FILE          = os.path.join(HOB_ICON_BASE_DIR, ('info/info_hover.png'))
     ICON_INDI_CONFIRM_FILE        = os.path.join(HOB_ICON_BASE_DIR, ('indicators/confirmation.png'))
-    ICON_INDI_ERROR_FILE          = os.path.join(HOB_ICON_BASE_DIR, ('indicators/error.png'))
+    ICON_INDI_ERROR_FILE          = os.path.join(HOB_ICON_BASE_DIR, ('indicators/denied.png'))
     ICON_INDI_REMOVE_FILE         = os.path.join(HOB_ICON_BASE_DIR, ('indicators/remove.png'))
     ICON_INDI_REMOVE_HOVER_FILE   = os.path.join(HOB_ICON_BASE_DIR, ('indicators/remove-hover.png'))
     ICON_INDI_ADD_FILE            = os.path.join(HOB_ICON_BASE_DIR, ('indicators/add.png'))
@@ -933,6 +933,7 @@ class HobCellRendererPixbuf(gtk.CellRendererPixbuf):
         self.control = RefreshRuningController()
         # add icon checker for make the gtk-icon transfer to hob-icon
         self.checker = HobIconChecker()
+        self.set_property("stock-size", gtk.ICON_SIZE_DND)
 
     def get_pixbuf_from_stock_icon(self, widget, stock_id="", size=gtk.ICON_SIZE_DIALOG):
         if widget and stock_id and gtk.icon_factory_lookup_default(stock_id):
@@ -990,7 +991,15 @@ class HobCellRendererPixbuf(gtk.CellRendererPixbuf):
     def on_get_size(self, widget, cell_area):
         if self.props.icon_name or self.props.pixbuf or self.props.stock_id:
             w, h = gtk.icon_size_lookup(self.props.stock_size)
-            return 0, 0, w, h
+            calc_width = self.get_property("xpad") * 2 + w
+            calc_height = self.get_property("ypad") * 2 + h
+            x_offset = 0
+            y_offset = 0
+            if cell_area and w > 0 and h > 0:
+                x_offset = self.get_property("xalign") * (cell_area.width - calc_width - self.get_property("xpad"))
+                y_offset = self.get_property("yalign") * (cell_area.height - calc_height - self.get_property("ypad"))
+
+            return x_offset, y_offset, w, h
 
         return 0, 0, 0, 0
 
Signature · 1 line
1.7.6
author
#13 lore raw

PATCH 8/8 Hob: in build details page, change error icon to denied icon

In reply to Shane Wang

From: Liming An <[email protected]>

For make icongraphy consistently to change the original gtk-icon to hob-icon

[YOCTO #2108]

---
 bitbake/lib/bb/ui/crumbs/runningbuild.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
bitbake/lib/bb/ui/crumbs/runningbuild.py +1 -1
index 8d1f4e1..042902e 100644
@@ -425,7 +425,7 @@ class BuildFailureTreeView(gtk.TreeView):
         self.get_selection().set_mode(gtk.SELECTION_SINGLE)
 
         # The icon that indicates whether we're building or failed.
-        renderer = gtk.CellRendererPixbuf ()
+        renderer = HobCellRendererPixbuf ()
         col = gtk.TreeViewColumn ("Status", renderer)
         col.add_attribute (renderer, "icon-name", RunningBuildModel.COL_ICON)
         self.append_column (col)
Signature · 1 line
1.7.6
#6 lore raw

Re: [PATCH 5/8] runqueue.py: check results[0] in keys of build_pids before being used to avoid exceptions

In reply to Shane Wang
Quoted 15 lines · Shane Wang

[email protected]>

                               To: 

[email protected]
Subject:
[bitbake-devel] [PATCH 5/8]
runqueue.py: check results[0] in
keys of build_pids before being
used to avoid exceptions
Date:
Thu, 29 Mar 2012 20:54:54 +0800
(29/03/12 13:54:54)

Quoted 6 lines

[Yocto #2186]

---
 bitbake/lib/bb/runqueue.py |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

This kind of change sets off alarm bells. The big question is why are you seeing exceptions? I suspect you're forking off processes within hob which are then confusing the waitpid code. I'd have to ask why the UI is forking processes when a build is running and why we're suddenly started seeing this...

So can you please explain the problem further so we can fix the real problem? I did look at #2186 but that doesn't help me either :(

Cheers,

Richard

#14 lore raw
In reply to Shane Wang
Quoted 19 lines · Shane Wang

This patchset includes the several Hob fixes:
- fix the icons to be consistent on the whole GUI
- fix the color style of the HobTabBar per visual design
- add more checks before being used to avoid bitbake exception
- fix the button label, etc.

The following changes since commit 0057d7fde8315694307637c4d23fd414a4a200f9:

lib/bb/ui/crumbs/hig: fix layers_changed test (2012-03-29 10:44:54 +0800)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib shane/hob
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=shane/hob

Liming An (2):
Hob: fixed the 'error' icon source picture and adjusted corresponding
showed icon size
Hob: in build details page, change error icon to denied icon

Quoted 10 lines

Shane Wang (6):
Hob: clear the building state after a successful build, as a failed
build does
Hob: Change icon to error because parsing error is an error
Hob: Change "Just bake" to "Build image" as required
Hob: make ORANGE to be the same as the color on the dialog runqueue.py: check results[0] in keys of build_pids before being used
to avoid exceptions
Hob: some color style changes to make HobTabBar more close to visual
design

Merged to master apart from the runqueue change which I've commented on.

Cheers,

Richard

#7 lore raw

Re: [PATCH 5/8] runqueue.py: check results[0] in keys of build_pids before being used to avoid exceptions

In reply to Richard Purdie

Richard Purdie wrote on 2012-03-30:

Quoted 23 lines · Shane Wang
Quoted 15 lines

[email protected]>

                               To:

[email protected]
Subject:
[bitbake-devel] [PATCH 5/8]
runqueue.py: check results[0] in
keys of build_pids before being
used to avoid exceptions
Date:
Thu, 29 Mar 2012 20:54:54 +0800
(29/03/12 13:54:54)

Quoted 6 lines

[Yocto #2186]

---
 bitbake/lib/bb/runqueue.py |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
Quoted 5 lines

This kind of change sets off alarm bells. The big question is why are you seeing exceptions? I suspect you're forking off processes within hob which are then confusing the waitpid code. I'd have to ask why the UI is forking processes when a build is running and why we're suddenly started seeing this...

The steps I did is to "Force stop" a build and click "build packages" to rebuild. Then I saw the exceptions. In the command mode, there is no issue because the process exits.

In finish_now() in runqueue.py, os.kill() kills all sub-processes but they don't exit.
when I start a new build, self.build_pids is empty, but due to the above reason, os.waitpid still can get the value of pids.

Quoted 3 lines

So can you please explain the problem further so we can fix the real problem? I did look at #2186 but that doesn't help me either :(

OK, I am going to submit another patch, but I think the condition check is also needed. Otherwise, in the current code of runqueue_process_waitpid(), why do we have:
if result[0] in self.build_stamps.keys():
del self.build_stamps[result[0]]

Quoted 4 lines

Cheers,

Richard

--
Shane

#10 lore raw

Re: [PATCH 5/8] runqueue.py: check results[0] in keys of build_pids before being used to avoid exceptions

In reply to Richard Purdie

By the way, I have never met the exception when I do "normally stop" the bitbake.

--
Shane

Wang, Shane wrote on 2012-03-30:

Quoted 53 lines

Richard Purdie wrote on 2012-03-30:

Quoted 23 lines · Shane Wang
Quoted 15 lines

[email protected]>

                               To:

[email protected]
Subject:
[bitbake-devel] [PATCH 5/8]
runqueue.py: check results[0] in
keys of build_pids before being
used to avoid exceptions
Date:
Thu, 29 Mar 2012 20:54:54 +0800
(29/03/12 13:54:54)

Quoted 6 lines

[Yocto #2186]

---
 bitbake/lib/bb/runqueue.py |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
Quoted 5 lines

This kind of change sets off alarm bells. The big question is why are you seeing exceptions? I suspect you're forking off processes within hob which are then confusing the waitpid code. I'd have to ask why the UI is forking processes when a build is running and why we're suddenly started seeing this...

The steps I did is to "Force stop" a build and click "build packages" to rebuild. Then I saw the exceptions.
In the command mode, there is no issue because the process exits.

In finish_now() in runqueue.py, os.kill() kills all sub-processes but they don't exit. when I start a new build, self.build_pids is empty, but due to the above reason, os.waitpid still can get the value of pids.

Quoted 3 lines

So can you please explain the problem further so we can fix the real problem? I did look at #2186 but that doesn't help me either :(

OK, I am going to submit another patch, but I think the condition check is also needed. Otherwise, in the current code of runqueue_process_waitpid(), why do we have:
if result[0] in self.build_stamps.keys():
del self.build_stamps[result[0]]

Quoted 4 lines

Cheers,

Richard

#8 lore raw

Re: [PATCH 5/8] runqueue.py: check results[0] in keys of build_pids before being used to avoid exceptions

In reply to Wang, Shane
Quoted 6 lines · Shane
Quoted 2 lines

So can you please explain the problem further so we can fix the real problem? I did look at #2186 but that doesn't help me either :(

OK, I am going to submit another patch, but I think the condition check is also needed. Otherwise, in the current code of runqueue_process_waitpid(), why do we have:
       if result[0] in self.build_stamps.keys():
           del self.build_stamps[result[0]]

This is also off, from a code standpoint, even assuming it's needed. There's no need to use the keys method at all for a map. 'in' against a map automatically checks by key. result[0] in self.build_stamps.

Signature · 1 line
Christopher Larson
#9 lore raw

Re: [PATCH 5/8] runqueue.py: check results[0] in keys of build_pids before being used to avoid exceptions

In reply to Wang, Shane
Quoted 25 lines · Shane

Richard Purdie wrote on 2012-03-30:

Quoted 23 lines · Shane Wang
Quoted 21 lines

[email protected]>

                               To:

[email protected]
Subject:
[bitbake-devel] [PATCH 5/8]
runqueue.py: check results[0] in
keys of build_pids before being
used to avoid exceptions
Date:
Thu, 29 Mar 2012 20:54:54 +0800
(29/03/12 13:54:54)

[Yocto #2186]

---
 bitbake/lib/bb/runqueue.py |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
Quoted 7 lines
Quoted 5 lines

This kind of change sets off alarm bells. The big question is why are you seeing exceptions? I suspect you're forking off processes within hob which are then confusing the waitpid code. I'd have to ask why the UI is forking processes when a build is running and why we're suddenly started seeing this...

The steps I did is to "Force stop" a build and click "build packages" to rebuild. Then I saw the exceptions. In the command mode, there is no issue because the process exits.

Ok, so what it sounds like is that waitpid() is not being called in the "force stop" mode to collect the exit values of the processes. We should fix the code to collect the exit values even in force stop mode.

Cheers,

Richard (resisting the urge to talk about reaping and zombies)