Skip to contentSkip to conversation

Add file information to package information window

PATCH In review Andrei Dinu 1 participant 8 messages Mar 27, 2013 Arm STM32

lore
Share & tools
lore
#0 lore raw

cover Add file information to package information window

Listing the files that are brought into an image
from each package.

[HOB #3925]

Andrei Dinu (6):
cache_extra.py : added package information cooker.py : added variables related to cache_extra packageinfo.bbclass : extended functionality propertydialog.py : added 'Package files' functionality hoblistmodel.py : passing the package information to hob packageselectionpage.py : added information to hob

 bitbake/lib/bb/cache_extra.py                    |    3 ++
 bitbake/lib/bb/cooker.py                         |    2 +
 bitbake/lib/bb/ui/crumbs/hig/propertydialog.py   |   59 +++++++++++++++++++++-
 bitbake/lib/bb/ui/crumbs/hoblistmodel.py         |    7 ++-
 bitbake/lib/bb/ui/crumbs/packageselectionpage.py |    3 +-
 meta/classes/packageinfo.bbclass                 |   21 ++++++++
 6 files changed, 91 insertions(+), 4 deletions(-)
 mode change 100755 => 100644 bitbake/lib/bb/ui/crumbs/packageselectionpage.py
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/6 cache_extra.py : added package information

Added a new variable to cache_extra so that
the files brought in by a package can be
displayed in hob.

---
 bitbake/lib/bb/cache_extra.py |    3 +++
 1 file changed, 3 insertions(+)
bitbake/lib/bb/cache_extra.py +3 -0
index bf02bb7..9e38a43 100644
@@ -44,6 +44,7 @@ class HobRecipeInfo(RecipeInfoCommon):
         self.homepage = self.getvar('HOMEPAGE', metadata)
         self.bugtracker = self.getvar('BUGTRACKER', metadata)
         self.prevision = self.getvar('PR', metadata)
+        self.files_info = self.getvar('FILES_INFO', metadata)
 
     @classmethod
     def init_cacheData(cls, cachedata):
@@ -55,6 +56,7 @@ class HobRecipeInfo(RecipeInfoCommon):
         cachedata.homepage = {}
         cachedata.bugtracker = {}
         cachedata.prevision = {}
+        cachedata.files_info = {}
 
     def add_cacheData(self, cachedata, fn):
         cachedata.summary[fn] = self.summary
@@ -64,3 +66,4 @@ class HobRecipeInfo(RecipeInfoCommon):
         cachedata.homepage[fn] = self.homepage
         cachedata.bugtracker[fn] = self.bugtracker
         cachedata.prevision[fn] = self.prevision
+        cachedata.files_info[fn] = self.files_info
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/6 cooker.py : added variables related to cache_extra

In reply to Andrei Dinu

So that the information added to cache_extra could be accesed by hob, new variables were added in the cooker.py.

---
 bitbake/lib/bb/cooker.py |    2 ++
 1 file changed, 2 insertions(+)
bitbake/lib/bb/cooker.py +2 -0
index 4650d7c..c7c2ca6 100644
@@ -576,6 +576,7 @@ class BBCooker:
             description = self.status.description[fn]
             homepage = self.status.homepage[fn]
             bugtracker = self.status.bugtracker[fn]
+            files_info = self.status.files_info[fn]
             rdepends = self.status.rundeps[fn]
             rrecs = self.status.runrecs[fn]
             prevision = self.status.prevision[fn]
@@ -591,6 +592,7 @@ class BBCooker:
                 depend_tree["pn"][pn]["inherits"] = inherits
                 depend_tree["pn"][pn]["homepage"] = homepage
                 depend_tree["pn"][pn]["bugtracker"] = bugtracker
+                depend_tree["pn"][pn]["files_info"] = files_info
                 depend_tree["pn"][pn]["revision"] = prevision
 
             if fnid not in seen_fnids:
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/6 packageinfo.bbclass : extended functionality

In reply to Andrei Dinu

Extended the functionality of packageinfo.bbclass so that the sistem retrieves information about the files brought in by each package. This is done (without activating buildhistory) by parsing the packages-split directory for each package.

---
 meta/classes/packageinfo.bbclass |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
meta/classes/packageinfo.bbclass +21 -0
index bd7b249..f55af87 100644
@@ -8,6 +8,25 @@ python packageinfo_handler () {
         package_archs = e.data.getVar('PACKAGE_ARCHS', True)
         packaging = e.data.getVar('PACKAGE_CLASSES', True).split()[0].split('_')[1]
         deploy_dir = e.data.getVar('DEPLOY_DIR', True) + '/' + packaging
+        dirs = os.listdir(tmpdir + '/work/')
+        pkgsplit_dir = tmpdir + '/work/'
+        items = {}
+        passing = ''
+        for directories in dirs:
+                temp_dirs = os.listdir(pkgsplit_dir + directories)
+                for temps1 in temp_dirs:
+                        if os.path.exists(pkgsplit_dir + directories + '/' + temps1 + '/' + os.listdir(pkgsplit_dir + directories + '/' + temps1)[0] + '/packages-split'):
+                                oau = pkgsplit_dir + directories + '/' + temps1 + '/' + os.listdir(pkgsplit_dir + directories + '/' + temps1)[0] + '/packages-split'
+                                for temps in os.listdir(oau):
+                                        items[temps] = {}
+                                        for path, dirs, files in os.walk(pkgsplit_dir + directories + '/' + temps1 + '/' + os.listdir(pkgsplit_dir + directories + '/' + temps1)[0] + '/packages-split' + '/' + temps):                                                   
+                                                        file_list = []
+                                                        if os.listdir(path) != []:
+                                                                items[temps][path] = []                                                   
+                                                                for f in files:
+                                                                        file_list.append(f)
+                                                                items[temps][path].append(file_list)
+                                           
         for arch in package_archs.split():
             pkgdata_dir = tmpdir + '/pkgdata/' + arch + target_vendor + '-' + target_os + '/runtime/'
             if os.path.exists(pkgdata_dir):
@@ -19,6 +38,8 @@ python packageinfo_handler () {
                             try:
                                 sdata = oe.packagedata.read_pkgdatafile(pkgdatafile)
                                 sdata['PKG'] = pkgname
+                                if pkgname in items:
+                                        sdata['FILES_INFO'] = items[pkgname]        
                                 pkginfolist.append(sdata)
                             except Exception as e:
                                 bb.warn("Failed to read pkgdata file %s: %s: %s" % (pkgdatafile, e.__class__, str(e)))
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/6 propertydialog.py : added 'Package files' functionality

In reply to Andrei Dinu

Extended the packages page information with the
listing of the files brought in by every package.

---
 bitbake/lib/bb/ui/crumbs/hig/propertydialog.py |   59 +++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)
bitbake/lib/bb/ui/crumbs/hig/propertydialog.py +58 -1
index 4420f97..ff4032d 100644
@@ -45,7 +45,7 @@ class PropertyDialog(CrumbsDialog):
 
                 if len(self.properties) == 10:
 		        self.create_recipe_visual_elements()
-                elif len(self.properties) == 4:
+                elif len(self.properties) == 5:
                         self.create_package_visual_elements()
                 else:
                         self.create_information_visual_elements()
@@ -93,6 +93,14 @@ class PropertyDialog(CrumbsDialog):
                 binb = self.properties['binb']
                 size = self.properties['size']
                 recipe = self.properties['recipe']
+                file_list = self.properties['files_list']
+
+                file_list = file_list.strip("{}'")
+                files_temp = ''
+                paths_temp = ''
+                files_binb = []
+                paths_binb = []
+                
 
                 #cleaning out the recipe variable
                 recipe = recipe.split("+")[0]
@@ -151,8 +159,57 @@ class PropertyDialog(CrumbsDialog):
                         self.vbox.add(self.label_short)
                         self.vbox.add(self.label_info)
 
+                #################################### FILES BROUGHT BY PACKAGES ###################################
+
+                if file_list != '':
+                
+                        self.textWindow = gtk.ScrolledWindow()
+                        self.textWindow.set_shadow_type(gtk.SHADOW_IN)
+                        self.textWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+                        self.textWindow.set_size_request(100, 170)
+
+                        sstatemirrors_store = gtk.ListStore(str)
+
+                        self.sstatemirrors_tv = gtk.TreeView()
+                        self.sstatemirrors_tv.set_rules_hint(True)
+                        self.sstatemirrors_tv.set_headers_visible(True)
+                        self.textWindow.add(self.sstatemirrors_tv)
+
+                        self.cell1 = gtk.CellRendererText()
+                        col1 = gtk.TreeViewColumn('Package files', self.cell1)
+                        col1.set_cell_data_func(self.cell1, self.regex_field)
+                        self.sstatemirrors_tv.append_column(col1)
+
+                        for items in file_list.split(']]'):
+                            if len(items) > 1:
+                                paths_temp = items.split(":")[0]
+                                paths_binb.append(paths_temp.strip(" ,'"))
+                                files_temp = items.split(":")[1]
+                                files_binb.append(files_temp.strip(" ['"))
+
+                        unsorted_list = []
+                        
+                        for items in range(len(paths_binb)):
+                              if len(files_binb[items]) > 1:
+                                  for aduse in (files_binb[items].split(",")):
+                                        unsorted_list.append(paths_binb[items].split(name)[len(paths_binb[items].split(name))-1] + '/' + aduse.strip(" '"))
+
+                        unsorted_list.sort()
+                        for items in unsorted_list:
+                                while len(items) > 35:
+                                        items = items[:len(items)/2] + "" + items[len(items)/2+1:]
+                                if len(items) == 35:
+                                        items = items[:len(items)/2] + "..." + items[len(items)/2+3:] 
+                                sstatemirrors_store.append([str(items)])
+
+                        self.sstatemirrors_tv.set_model(sstatemirrors_store)  
+                        self.vbox.add(self.textWindow)                                      
+
                 self.vbox.show_all()
 
+        def regex_field(self, column, cell, model, iter):
+                cell.set_property('text', model.get_value(iter, 0))
+                return
 
 	def create_recipe_visual_elements(self):
 
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 5/6 hoblistmodel.py : passing the package information to hob

In reply to Andrei Dinu

Added a new column to the model and also populating it with the information brought in from the packageinfo.bbclass.

---
 bitbake/lib/bb/ui/crumbs/hoblistmodel.py |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
bitbake/lib/bb/ui/crumbs/hoblistmodel.py +5 -2
index 0f37a06..778eb85 100644
@@ -35,7 +35,7 @@ class PackageListModel(gtk.ListStore):
     provide filtered views of the data.
     """
 
-    (COL_NAME, COL_VER, COL_REV, COL_RNM, COL_SEC, COL_SUM, COL_RDEP, COL_RPROV, COL_SIZE, COL_RCP, COL_BINB, COL_INC, COL_FADE_INC, COL_FONT) = range(14)
+    (COL_NAME, COL_VER, COL_REV, COL_RNM, COL_SEC, COL_SUM, COL_RDEP, COL_RPROV, COL_SIZE, COL_RCP, COL_BINB, COL_INC, COL_FADE_INC, COL_FONT, COL_FLIST) = range(15)
 
     __gsignals__ = {
         "package-selection-changed" : (gobject.SIGNAL_RUN_LAST,
@@ -61,6 +61,7 @@ class PackageListModel(gtk.ListStore):
                                 gobject.TYPE_STRING,
                                 gobject.TYPE_BOOLEAN,
                                 gobject.TYPE_BOOLEAN,
+                                gobject.TYPE_STRING,
                                 gobject.TYPE_STRING)
 
     """
@@ -166,6 +167,8 @@ class PackageListModel(gtk.ListStore):
             rdep = getpkgvalue(pkginfo, 'RDEPENDS', pkg, "")
             rrec = getpkgvalue(pkginfo, 'RRECOMMENDS', pkg, "")
             rprov = getpkgvalue(pkginfo, 'RPROVIDES', pkg, "")
+            files_list = getpkgvalue(pkginfo, 'FILES_INFO', pkg, "")
+            
             for i in rprov.split():
                 self.rprov_pkg[i] = pkg
 
@@ -185,7 +188,7 @@ class PackageListModel(gtk.ListStore):
                      self.COL_RDEP, rdep + ' ' + rrec,
                      self.COL_RPROV, rprov, self.COL_SIZE, size,
                      self.COL_RCP, recipe, self.COL_BINB, "",
-                     self.COL_INC, False, self.COL_FONT, '10')
+                     self.COL_INC, False, self.COL_FONT, '10', self.COL_FLIST, files_list)
 
         self.pn_path = {}
         it = self.get_iter_first()
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 6/6 packageselectionpage.py : added information to hob

In reply to Andrei Dinu

In order to have information for each package in hob, a new item is added to the dictionary, represeting the files that are brought in by each package.

---
 bitbake/lib/bb/ui/crumbs/packageselectionpage.py |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
 mode change 100755 => 100644 bitbake/lib/bb/ui/crumbs/packageselectionpage.py
bitbake/lib/bb/ui/crumbs/packageselectionpage.py +2 -1
old mode 100755
new mode 100644
index 6f9a4e2..fbb6017
@@ -178,11 +178,12 @@ class PackageSelectionPage (HobPage):
         path, col = widget.table_tree.get_cursor()
         tree_model = widget.table_tree.get_model()
         if path: # else activation is likely a removal
-            properties = {'binb': '' , 'name': '', 'size':'', 'recipe':''}
+            properties = {'binb': '' , 'name': '', 'size':'', 'recipe':'', 'files_list':''}
             properties['binb'] = tree_model.get_value(tree_model.get_iter(path), PackageListModel.COL_BINB)
             properties['name'] = tree_model.get_value(tree_model.get_iter(path), PackageListModel.COL_NAME)
             properties['size'] = tree_model.get_value(tree_model.get_iter(path), PackageListModel.COL_SIZE)
             properties['recipe'] = tree_model.get_value(tree_model.get_iter(path), PackageListModel.COL_RCP)
+            properties['files_list'] = tree_model.get_value(tree_model.get_iter(path), PackageListModel.COL_FLIST)
 
             self.builder.show_recipe_property_dialog(properties)
 
Signature · 1 line
1.7.9.5
#7 lore raw
In reply to Andrei Dinu

Please ignore this patchset.

Thanks,

Andrei Dinu

Quoted 22 lines · Andrei Dinu

Listing the files that are brought into an image
from each package.

[HOB #3925]

Andrei Dinu (6):
cache_extra.py : added package information cooker.py : added variables related to cache_extra packageinfo.bbclass : extended functionality propertydialog.py : added 'Package files' functionality hoblistmodel.py : passing the package information to hob packageselectionpage.py : added information to hob

  bitbake/lib/bb/cache_extra.py                    |    3 ++
  bitbake/lib/bb/cooker.py                         |    2 +
  bitbake/lib/bb/ui/crumbs/hig/propertydialog.py   |   59 +++++++++++++++++++++-
  bitbake/lib/bb/ui/crumbs/hoblistmodel.py         |    7 ++-
  bitbake/lib/bb/ui/crumbs/packageselectionpage.py |    3 +-
  meta/classes/packageinfo.bbclass                 |   21 ++++++++
  6 files changed, 91 insertions(+), 4 deletions(-)

mode change 100755 => 100644 bitbake/lib/bb/ui/crumbs/packageselectionpage.py