Skip to contentSkip to conversation

Various UI fixes related to #1468

PATCH New Joshua Lock 1 participant 5 messages Sep 13, 2011

lore
Share & tools
lore
#0 lore raw

cover Various UI fixes related to #1468

Yocto #1468 reports several issues when using the recently fixed build again functionality of hob. This series includes fixes for each of the issues reported in that bug.

Regards,
Joshua

The following changes since commit 459addf13721a6847406f215650fa1882fb83ea9:

runqueue.py: Ensure fakeroot variables are reflected in the datastore (2011-09-09 19:07:45 +0100)

are available in the git repository at:
git://github.com/incandescant/bitbake uifixes
https://github.com/incandescant/bitbake/tree/uifixes

Joshua Lock (4):
ui/crumbs/hobeventhandler: fix test for BBFILES ui/crumbs/hobeventhandler: don't check BBPATH and BBFILES each build
hob: correctly handle an exception
hob: correctly set the selected image when loading a recipe

 lib/bb/ui/crumbs/hobeventhandler.py |   42 +++++++++++++++++-----------------
 lib/bb/ui/hob.py                    |    7 +++++-
 2 files changed, 27 insertions(+), 22 deletions(-)
Signature · 1 line
1.7.6
#1 lore raw

PATCH 1/4 ui/crumbs/hobeventhandler: fix test for BBFILES

It seems we have a race whereby the image_dir variable may not be set before it's tested for, since the variable is always the same set it in the initialiser.

Partially addresses [YOCTO #1468]

---
 lib/bb/ui/crumbs/hobeventhandler.py |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
lib/bb/ui/crumbs/hobeventhandler.py +1 -2
index 66dffac..4ed6590 100644
@@ -77,7 +77,7 @@ class HobHandler(gobject.GObject):
         self.generating = False
         self.build_queue = []
         self.current_phase = None
-        self.image_dir = None
+        self.image_dir = os.path.join(tempfile.gettempdir(), 'hob-images')
 
         self.model = taskmodel
         self.server = server
@@ -329,7 +329,6 @@ class HobHandler(gobject.GObject):
         return self.server.runCommand(["getVariable", "DEPLOY_DIR_IMAGE"])
 
     def make_temp_dir(self):
-        self.image_dir = os.path.join(tempfile.gettempdir(), 'hob-images')
         bb.utils.mkdirhier(self.image_dir)
 
     def remove_temp_dir(self):
Signature · 1 line
1.7.6
#2 lore raw

PATCH 2/4 ui/crumbs/hobeventhandler: don't check BBPATH and BBFILES each build

In reply to Joshua Lock

There's no need to check the BBPATH and BBFILES are set correctly each build when running multiple builds for one launch of the UI.

Partially addresses [YOCTO #1468]

---
 lib/bb/ui/crumbs/hobeventhandler.py |   39 ++++++++++++++++++-----------------
 1 files changed, 20 insertions(+), 19 deletions(-)
lib/bb/ui/crumbs/hobeventhandler.py +20 -19
index 4ed6590..8bf599f 100644
@@ -77,6 +77,8 @@ class HobHandler(gobject.GObject):
         self.generating = False
         self.build_queue = []
         self.current_phase = None
+        self.bbpath_ok = False
+        self.bbfiles_ok = False
         self.image_dir = os.path.join(tempfile.gettempdir(), 'hob-images')
 
         self.model = taskmodel
@@ -247,6 +249,8 @@ class HobHandler(gobject.GObject):
 
     def build_image(self, image, configurator):
         targets = []
+        nbbp = None
+        nbbf = None
         targets.append(image)
         if self.build_toolchain and self.build_toolchain_headers:
             targets.append("meta-toolchain-sdk")
@@ -254,31 +258,28 @@ class HobHandler(gobject.GObject):
             targets.append("meta-toolchain")
         self.build_queue = targets
 
-        bbpath_ok = False
-        bbpath = self.server.runCommand(["getVariable", "BBPATH"])
-        if self.image_dir in bbpath.split(":"):
-            bbpath_ok = True
+        if not self.bbpath_ok:
+            bbpath = self.server.runCommand(["getVariable", "BBPATH"])
+            if self.image_dir in bbpath.split(":"):
+                self.bbpath_ok = True
+            else:
+                nbbp = self.image_dir
 
-        bbfiles_ok = False
-        bbfiles = self.server.runCommand(["getVariable", "BBFILES"]).split(" ")
-        for files in bbfiles:
+        if not self.bbfiles_ok:
             import re
             pattern = "%s/\*.bb" % self.image_dir
-            if re.match(pattern, files):
-                bbfiles_ok = True
-
-        if not bbpath_ok:
-            nbbp = self.image_dir
-        else:
-            nbbp = None
+            bbfiles = self.server.runCommand(["getVariable", "BBFILES"]).split(" ")
+            for files in bbfiles:
+                if re.match(pattern, files):
+                    self.bbfiles_ok = True
 
-        if not bbfiles_ok:
-            nbbf = "%s/*.bb" % self.image_dir
-        else:
-            nbbf = None
+            if not self.bbfiles_ok:
+                nbbf = "%s/*.bb" % self.image_dir
 
-        if not bbfiles_ok or not bbpath_ok:
+        if nbbp or nbbf:
             configurator.insertTempBBPath(nbbp, nbbf)
+            self.bbpath_ok = True
+            self.bbfiles_ok = True
 
         self.current_command = self.REPARSE_FILES
         self.run_next_command()
Signature · 1 line
1.7.6
#3 lore raw

PATCH 3/4 hob: correctly handle an exception

In reply to Joshua Lock

It doesn't matter if we can't remove the temprorary file, for some reason, so catch the exception and ignore it.

Partially addresses [YOCTO #1468]

---
 lib/bb/ui/hob.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
lib/bb/ui/hob.py +5 -1
index 84df37d..8d2d1bd 100644
@@ -495,7 +495,11 @@ class MainWindow (gtk.Window):
         self.back.set_sensitive(True)
         self.cancel.set_sensitive(False)
         for f in self.files_to_clean:
-            os.remove(f)
+            try:
+                os.remove(f)
+            except OSError:
+                pass
+            self.files_to_clean.remove(f)
         self.files_to_clean = []
 
         lbl = "<b>Build completed</b>\n\nClick 'Edit Image' to start another build or 'View Messages' to view the messages output during the build."
Signature · 1 line
1.7.6
#4 lore raw

PATCH 4/4 hob: correctly set the selected image when loading a recipe

In reply to Joshua Lock

When the user saves their recipe based on an existing image type, loads it in a newly run hob instance and clicks bake they should not be asked about building packages vs an empty image up.

Partially addresses [YOCTO #1468]

---
 lib/bb/ui/hob.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
lib/bb/ui/hob.py +1 -0
index 8d2d1bd..51a995e 100644
@@ -144,6 +144,7 @@ class MainWindow (gtk.Window):
         self.build_succeeded = False
 
     def image_changed_string_cb(self, model, new_image):
+        self.selected_image = new_image
         # disconnect the image combo's signal handler
         if self.image_combo_id:
             self.image_combo.disconnect(self.image_combo_id)
Signature · 1 line
1.7.6