Skip to contentSkip to conversation

Implement a new remote layer module

PATCH Superseded Mark Hatle 2 participants 13 messages Jul 28, 2017 – Aug 3, 2017

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

cover Implement a new remote layer module

The code for this work is available at:

git://git.openembedde.org/poky-contrib mgh/bitbake-setup

A new module 'layers' is being added to bitbake. This module contains two parts that work together. A 'layerindex' piece and a 'manager' piece.

The layerindex piece is designed to connect to layerindex content, such as layers.openembedded.org, pull down layerindex information and provide basic functionality for using the index. It is capable of managing information from multiple layerindex sources and resolving dependencies across indexes.

The connection to the external items is handled through plugins. This permits us to implement both a restapi format (connect to the web), but also an internal 'cooker' implementation. The cooker implementation will allow us to create a mini-layerindex from the currently parsed system contents.

The internal data representation always uses the web style restapi, but is wrapped with a number of layerindex provided object classes.

The layerindex provides object classes for each exported layerindex item, such as Branch, LayerItem, LayerBranches, LayerDependency, etc... Each of these objects contain various accessor functions that simply return the data or further process the data to make it easier to access related objects. For example a LayerBranch object refers to both a Branch-Id and a LayerItem-Id. There are accessor functions designed to return back the Branch or LayerItem without the user needing to know how to process the data structures.

The manager provides connection information to get to cooker instances for some plugins, such as the layerindex's cooker plugin. It also can interpret the basic BBLAYERS and COLLECTIONS information to determine what the user already has. (The layerindex cooker plugin relies on this behavior.)

However, it's primary purpose is to manage downloads of layers, based on layerindex generated dependency information. This download mechanism also uses a plugin architecture. Currently only a 'fetch2' plugin has been implemented. (I expect in the future additional plugins for 'git-repo', and others to be implemented as needed.)

The download portion of the manager takes a 4 step approach:
* setup(dependencies) - takes a dependency list of what to download/install
* fetch() - fetch the layers
* unpack() - unpack the fetched layers
* update_bblayers() - update bblayers based on the previous activities

The code includes a set of bitbake-selftests for the described functionality. Some items are not testable, such as the cooker integration, as cooker is not available and the test data may be too limited to be useful.

The bitbake-layers has been updated to use these new modules for the layerindex-fetch and layerindex-show-depends information.

The 'lsupdate.py' for the toaster has also been updated to use this item. However, the longer term expectation is Toaster will be modified to no longer handle an internal 'snapshot' of the layer index, but will use this new functionality instead of process layer information. That work will begin once these items have been reviewed and agreed upon by the community.

Once toaster has been updated, the intention is to create a new 'bitbake-setup' program, that will have similar functionality to the 'wr-lx-setup' project on github (https://github.com/Wind-River/wr-lx-setup).

Mark Hatle (4):
lib/layers: Initial layer and layer index implementeation
bitbake-selftest: Add layers module tests lib/bblayers: Add support for the new layer modules toaster/orm/management/commands/lsupdates.py: Use new layerindex
module

Paul Eggleton (1):
bitbake-layers: disable parsing for layerindex commands

 bin/bitbake-selftest                             |   5 +-
 lib/bblayers/layerindex.py                       | 317 +++-----
 lib/layers/__init__.py                           |   0
 lib/layers/layerindex/__init__.py                | 974 +++++++++++++++++++++++
 lib/layers/layerindex/common.py                  | 146 ++++
 lib/layers/layerindex/cooker.py                  | 223 ++++++
 lib/layers/layerindex/restapi.py                 | 375 +++++++++
 lib/layers/manager/__init__.py                   | 253 ++++++
 lib/layers/manager/common.py                     |  60 ++
 lib/layers/manager/fetch2.py                     | 210 +++++
 lib/layers/tests/__init__.py                     |   0
 lib/layers/tests/layerindex.py                   | 372 +++++++++
 lib/layers/tests/manager.py                      | 155 ++++
 lib/toaster/orm/management/commands/lsupdates.py | 215 ++---
 14 files changed, 2954 insertions(+), 351 deletions(-)
 create mode 100644 lib/layers/__init__.py
 create mode 100644 lib/layers/layerindex/__init__.py
 create mode 100644 lib/layers/layerindex/common.py
 create mode 100644 lib/layers/layerindex/cooker.py
 create mode 100644 lib/layers/layerindex/restapi.py
 create mode 100644 lib/layers/manager/__init__.py
 create mode 100644 lib/layers/manager/common.py
 create mode 100644 lib/layers/manager/fetch2.py
 create mode 100644 lib/layers/tests/__init__.py
 create mode 100644 lib/layers/tests/layerindex.py
 create mode 100644 lib/layers/tests/manager.py
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 1/5 lib/layers: Initial layer and layer index implementeation

This module provides two components, layerindex, which is used to talk a layerindex, such as layers.openembedded.org.

The other module is the 'manager'. This module will handle downloading, re-writing the bblayers to match the downloads and other related layer management tasks.

---
 lib/layers/__init__.py            |   0
 lib/layers/layerindex/__init__.py | 962 ++++++++++++++++++++++++++++++++++++++
 lib/layers/layerindex/common.py   | 146 ++++++
 lib/layers/layerindex/cooker.py   | 223 +++++++++
 lib/layers/layerindex/restapi.py  | 348 ++++++++++++++
 lib/layers/manager/__init__.py    | 242 ++++++++++
 lib/layers/manager/common.py      |  60 +++
 lib/layers/manager/fetch2.py      | 210 +++++++++
 8 files changed, 2191 insertions(+)
 create mode 100644 lib/layers/__init__.py
 create mode 100644 lib/layers/layerindex/__init__.py
 create mode 100644 lib/layers/layerindex/common.py
 create mode 100644 lib/layers/layerindex/cooker.py
 create mode 100644 lib/layers/layerindex/restapi.py
 create mode 100644 lib/layers/manager/__init__.py
 create mode 100644 lib/layers/manager/common.py
 create mode 100644 lib/layers/manager/fetch2.py
lib/layers/__init__.py new file +0 -0
new file mode 100644
index 0000000..e69de29
lib/layers/layerindex/__init__.py new file +962 -0

962 lines not on this page · raw message

lib/layers/layerindex/common.py new file +146 -0

146 lines not on this page · raw message

lib/layers/layerindex/cooker.py new file +223 -0

223 lines not on this page · raw message

lib/layers/layerindex/restapi.py new file +348 -0

348 lines not on this page · raw message

lib/layers/manager/__init__.py new file +242 -0

242 lines not on this page · raw message

lib/layers/manager/common.py new file +60 -0

60 lines not on this page · raw message

lib/layers/manager/fetch2.py new file +210 -0

210 lines not on this page · raw message

Signature · 1 line
1.8.3.1
author
#4 lore raw

PATCH 2/5 bitbake-selftest: Add layers module tests

In reply to Mark Hatle

The tests cover both the layers/layerindex and the layers/manager.

Both sets of tests included network connection components. They honor the BB_SKIP_NETTESTS='yes' if networking is not available, to prevent test failures.

Tests Implemented:
layers/layerindex:
- Branch, LayerItem, LayerBranch, LayerDependency, Recipe, Machine and Distro objects
- LayerIndex setup using the layers.openembedded.org restapi
- LayerIndex storing and retrieving from a file
- LayerIndex verify dependency resolution ordering

layers/manager:
- manager basic functionality
- manager and fetch2 plugin setup/fetch/unpack of a remote repository
- fetch2 plugin generating a list of downloaded layers

---
 bin/bitbake-selftest           |   5 +-
 lib/layers/tests/__init__.py   |   0
 lib/layers/tests/layerindex.py | 372 +++++++++++++++++++++++++++++++++++++++++
 lib/layers/tests/manager.py    | 155 +++++++++++++++++
 4 files changed, 531 insertions(+), 1 deletion(-)
 create mode 100644 lib/layers/tests/__init__.py
 create mode 100644 lib/layers/tests/layerindex.py
 create mode 100644 lib/layers/tests/manager.py
bin/bitbake-selftest +4 -1
index afe1603..9ad42ab 100755
@@ -22,6 +22,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'lib
 import unittest
 try:
     import bb
+    import layers
 except RuntimeError as exc:
     sys.exit(str(exc))
 
@@ -31,7 +32,9 @@ tests = ["bb.tests.codeparser",
          "bb.tests.event",
          "bb.tests.fetch",
          "bb.tests.parse",
-         "bb.tests.utils"]
+         "bb.tests.utils",
+         "layers.tests.layerindex",
+         "layers.tests.manager"]
 
 for t in tests:
     t = '.'.join(t.split('.')[:3])
lib/layers/tests/__init__.py new file +0 -0
new file mode 100644
index 0000000..e69de29
lib/layers/tests/layerindex.py new file +372 -0

372 lines not on this page · raw message

lib/layers/tests/manager.py new file +155 -0

155 lines not on this page · raw message

Signature · 1 line
1.8.3.1
author
#5 lore raw

PATCH 3/5 lib/bblayers: Add support for the new layer modules

In reply to Mark Hatle
---
 lib/bblayers/layerindex.py        | 313 +++++++++++---------------------------
 lib/layers/layerindex/__init__.py |  28 +++-
 lib/layers/layerindex/cooker.py   |   2 +-
 lib/layers/layerindex/restapi.py  |  95 +++++++-----
 lib/layers/manager/__init__.py    |  59 ++++---
 5 files changed, 210 insertions(+), 287 deletions(-)
lib/bblayers/layerindex.py +93 -220
index 506c110..d1dac0b 100644
@@ -1,10 +1,10 @@
+import layers.manager
+import layers.layerindex
+
 import argparse
-import http.client
-import json
 import logging
 import os
 import subprocess
-import urllib.parse
 
 from bblayers.action import ActionPlugin
 
@@ -21,235 +21,108 @@ class LayerIndexPlugin(ActionPlugin):
     This class inherits ActionPlugin to get do_add_layer.
     """
 
-    def get_json_data(self, apiurl):
-        proxy_settings = os.environ.get("http_proxy", None)
-        conn = None
-        _parsedurl = urllib.parse.urlparse(apiurl)
-        path = _parsedurl.path
-        query = _parsedurl.query
-
-        def parse_url(url):
-            parsedurl = urllib.parse.urlparse(url)
-            if parsedurl.netloc[0] == '[':
-                host, port = parsedurl.netloc[1:].split(']', 1)
-                if ':' in port:
-                    port = port.rsplit(':', 1)[1]
-                else:
-                    port = None
-            else:
-                if parsedurl.netloc.count(':') == 1:
-                    (host, port) = parsedurl.netloc.split(":")
-                else:
-                    host = parsedurl.netloc
-                    port = None
-            return (host, 80 if port is None else int(port))
-
-        if proxy_settings is None:
-            host, port = parse_url(apiurl)
-            conn = http.client.HTTPConnection(host, port)
-            conn.request("GET", path + "?" + query)
-        else:
-            host, port = parse_url(proxy_settings)
-            conn = http.client.HTTPConnection(host, port)
-            conn.request("GET", apiurl)
-
-        r = conn.getresponse()
-        if r.status != 200:
-            raise Exception("Failed to read " + path + ": %d %s" % (r.status, r.reason))
-        return json.loads(r.read().decode())
-
-    def get_layer_deps(self, layername, layeritems, layerbranches, layerdependencies, branchnum, selfname=False):
-        def layeritems_info_id(items_name, layeritems):
-            litems_id = None
-            for li in layeritems:
-                if li['name'] == items_name:
-                    litems_id = li['id']
-                    break
-            return litems_id
-
-        def layerbranches_info(items_id, layerbranches):
-            lbranch = {}
-            for lb in layerbranches:
-                if lb['layer'] == items_id and lb['branch'] == branchnum:
-                    lbranch['id'] = lb['id']
-                    lbranch['vcs_subdir'] = lb['vcs_subdir']
-                    break
-            return lbranch
-
-        def layerdependencies_info(lb_id, layerdependencies):
-            ld_deps = []
-            for ld in layerdependencies:
-                if ld['layerbranch'] == lb_id and not ld['dependency'] in ld_deps:
-                    ld_deps.append(ld['dependency'])
-            if not ld_deps:
-                logger.error("The dependency of layerDependencies is not found.")
-            return ld_deps
-
-        def layeritems_info_name_subdir(items_id, layeritems):
-            litems = {}
-            for li in layeritems:
-                if li['id'] == items_id:
-                    litems['vcs_url'] = li['vcs_url']
-                    litems['name'] = li['name']
-                    break
-            return litems
-
-        if selfname:
-            selfid = layeritems_info_id(layername, layeritems)
-            lbinfo = layerbranches_info(selfid, layerbranches)
-            if lbinfo:
-                selfsubdir = lbinfo['vcs_subdir']
-            else:
-                logger.error("%s is not found in the specified branch" % layername)
-                return
-            selfurl = layeritems_info_name_subdir(selfid, layeritems)['vcs_url']
-            if selfurl:
-                return selfurl, selfsubdir
-            else:
-                logger.error("Cannot get layer %s git repo and subdir" % layername)
-                return
-        ldict = {}
-        itemsid = layeritems_info_id(layername, layeritems)
-        if not itemsid:
-            return layername, None
-        lbid = layerbranches_info(itemsid, layerbranches)
-        if lbid:
-            lbid = layerbranches_info(itemsid, layerbranches)['id']
-        else:
-            logger.error("%s is not found in the specified branch" % layername)
-            return None, None
-        for dependency in layerdependencies_info(lbid, layerdependencies):
-            lname = layeritems_info_name_subdir(dependency, layeritems)['name']
-            lurl = layeritems_info_name_subdir(dependency, layeritems)['vcs_url']
-            lsubdir = layerbranches_info(dependency, layerbranches)['vcs_subdir']
-            ldict[lname] = lurl, lsubdir
-        return None, ldict
-
-    def get_fetch_layer(self, fetchdir, url, subdir, fetch_layer):
-        layername = self.get_layer_name(url)
-        if os.path.splitext(layername)[1] == '.git':
-            layername = os.path.splitext(layername)[0]
-        repodir = os.path.join(fetchdir, layername)
-        layerdir = os.path.join(repodir, subdir)
-        if not os.path.exists(repodir):
-            if fetch_layer:
-                result = subprocess.call('git clone %s %s' % (url, repodir), shell = True)
-                if result:
-                    logger.error("Failed to download %s" % url)
-                    return None, None
-                else:
-                    return layername, layerdir
-            else:
-                logger.plain("Repository %s needs to be fetched" % url)
-                return layername, layerdir
-        elif os.path.exists(layerdir):
-            return layername, layerdir
-        else:
-            logger.error("%s is not in %s" % (url, subdir))
-        return None, None
-
     def do_layerindex_fetch(self, args):
         """Fetches a layer from a layer index along with its dependent layers, and adds them to conf/bblayers.conf.
 """
-        apiurl = self.tinfoil.config_data.getVar('BBLAYERS_LAYERINDEX_URL')
-        if not apiurl:
+
+        def _construct_url(baseurl, branch):
+            if baseurl[-1] != '/':
+                baseurl += '/'
+            baseurl += "api/"
+            baseurl += ";type=restapi"
+
+            if branch:
+                baseurl += ";branch=%s" % branch
+
+            return baseurl
+
+
+        # General URL to use based on standard setting
+        indexurl = self.tinfoil.config_data.getVar('BBLAYERS_LAYERINDEX_URL')
+
+        if not indexurl:
             logger.error("Cannot get BBLAYERS_LAYERINDEX_URL")
             return 1
-        else:
-            if apiurl[-1] != '/':
-                apiurl += '/'
-            apiurl += "api/"
-        apilinks = self.get_json_data(apiurl)
-        branches = self.get_json_data(apilinks['branches'])
-
-        branchnum = 0
-        for branch in branches:
-            if branch['name'] == args.branch:
-                branchnum = branch['id']
-                break
-        if branchnum == 0:
-            validbranches = ', '.join([branch['name'] for branch in branches])
-            logger.error('Invalid layer branch name "%s". Valid branches: %s' % (args.branch, validbranches))
+
+        layerManager = layers.manager.LayerManager(self.tinfoil.config_data, self.tinfoil.cooker)
+
+        remoteIndex = layers.layerindex.LayerIndex(self.tinfoil.config_data)
+
+        # Set the default...
+        branch = self.tinfoil.config_data.getVar('LAYERSERIES_CORENAMES') or 'master'
+        if args.branch:
+            branch = args.branch
+
+        logger.debug(1, 'Trying branch %s' % branch)
+        try:
+            remoteIndex.load_layerindex(_construct_url(indexurl, branch))
+        except Exception:
+            if branch == args.branch:
+                logger.error('Branch %s is not available' % branch)
+                return 1
+            logger.debug(1, 'Falling back to branch master')
+            remoteIndex.load_layerindex(_construct_url(indexurl, 'master'), reload=True)
+
+        if remoteIndex.is_empty():
             return 1
 
-        ignore_layers = []
-        for collection in self.tinfoil.config_data.getVar('BBFILE_COLLECTIONS').split():
-            lname = self.tinfoil.config_data.getVar('BBLAYERS_LAYERINDEX_NAME_%s' % collection)
-            if lname:
-                ignore_layers.append(lname)
+        # If we want the display to include already downloaded
+        # keep the following line, otherwise comment out.
+        cookerIndex = layers.layerindex.LayerIndex(self.tinfoil.config_data)
+        cookerIndex.load_layerindex('file://local;type=cooker', load='layerDependencies')
+
+        lIndex = cookerIndex + remoteIndex
 
+        ignore_layers = []
         if args.ignore:
             ignore_layers.extend(args.ignore.split(','))
 
-        layeritems = self.get_json_data(apilinks['layerItems'])
-        layerbranches = self.get_json_data(apilinks['layerBranches'])
-        layerdependencies = self.get_json_data(apilinks['layerDependencies'])
-        invaluenames = []
-        repourls = {}
-        printlayers = []
-
-        def query_dependencies(layers, layeritems, layerbranches, layerdependencies, branchnum):
-            depslayer = []
-            for layername in layers:
-                invaluename, layerdict = self.get_layer_deps(layername, layeritems, layerbranches, layerdependencies, branchnum)
-                if layerdict:
-                    repourls[layername] = self.get_layer_deps(layername, layeritems, layerbranches, layerdependencies, branchnum, selfname=True)
-                    for layer in layerdict:
-                        if not layer in ignore_layers:
-                            depslayer.append(layer)
-                        printlayers.append((layername, layer, layerdict[layer][0], layerdict[layer][1]))
-                        if not layer in ignore_layers and not layer in repourls:
-                            repourls[layer] = (layerdict[layer][0], layerdict[layer][1])
-                if invaluename and not invaluename in invaluenames:
-                    invaluenames.append(invaluename)
-            return depslayer
-
-        depslayers = query_dependencies(args.layername, layeritems, layerbranches, layerdependencies, branchnum)
-        while depslayers:
-            depslayer = query_dependencies(depslayers, layeritems, layerbranches, layerdependencies, branchnum)
-            depslayers = depslayer
-        if invaluenames:
-            for invaluename in invaluenames:
+        layernames = ' '.join(args.layername)
+        (dependencies, invalidnames) = lIndex.get_dependencies(names=layernames, ignores=ignore_layers)
+
+        if invalidnames:
+            for invaluename in invalidnames:
                 logger.error('Layer "%s" not found in layer index' % invaluename)
             return 1
-        logger.plain("%s  %s  %s  %s" % ("Layer".ljust(19), "Required by".ljust(19), "Git repository".ljust(54), "Subdirectory"))
-        logger.plain('=' * 115)
-        for layername in args.layername:
-            layerurl = repourls[layername]
-            logger.plain("%s %s %s %s" % (layername.ljust(20), '-'.ljust(20), layerurl[0].ljust(55), layerurl[1]))
-        printedlayers = []
-        for layer, dependency, gitrepo, subdirectory in printlayers:
-            if dependency in printedlayers:
-                continue
-            logger.plain("%s %s %s %s" % (dependency.ljust(20), layer.ljust(20), gitrepo.ljust(55), subdirectory))
-            printedlayers.append(dependency)
-
-        if repourls:
-            fetchdir = self.tinfoil.config_data.getVar('BBLAYERS_FETCH_DIR')
-            if not fetchdir:
-                logger.error("Cannot get BBLAYERS_FETCH_DIR")
-                return 1
-            if not os.path.exists(fetchdir):
-                os.makedirs(fetchdir)
-            addlayers = []
-            for repourl, subdir in repourls.values():
-                name, layerdir = self.get_fetch_layer(fetchdir, repourl, subdir, not args.show_only)
-                if not name:
-                    # Error already shown
-                    return 1
-                addlayers.append((subdir, name, layerdir))
-        if not args.show_only:
-            for subdir, name, layerdir in set(addlayers):
-                if os.path.exists(layerdir):
-                    if subdir:
-                        logger.plain("Adding layer \"%s\" to conf/bblayers.conf" % subdir)
-                    else:
-                        logger.plain("Adding layer \"%s\" to conf/bblayers.conf" % name)
-                    localargs = argparse.Namespace()
-                    localargs.layerdir = layerdir
-                    self.do_add_layer(localargs)
+        logger.plain("%s  %s  %s" % ("Layer".ljust(49), "Git repository (branch)".ljust(54), "Subdirectory"))
+        logger.plain('=' * 125)
+
+        for deplayerbranch in dependencies:
+            layerBranch = dependencies[deplayerbranch][0]
+
+            # This is the local content, uncomment to hide local
+            # layers from the display.
+            #if layerBranch.index['CONFIG']['TYPE'] == 'cooker':
+            #    continue
+
+            layerDeps = dependencies[deplayerbranch][1:]
+
+            requiredby = []
+            recommendedby = []
+            for dep in layerDeps:
+                if dep.is_required():
+                    requiredby.append(dep.get_layer().get_name())
                 else:
-                    break
+                    recommendedby.append(dep.get_layer().get_name())
+
+            logger.plain('%s %s %s' % (("%s:%s:%s" %
+                                  (layerBranch.index['CONFIG']['DESCRIPTION'],
+                                  layerBranch.get_branch().get_name(),
+                                  layerBranch.get_layer().get_name())).ljust(50),
+                                  ("%s (%s)" % (layerBranch.get_layer().get_vcs_url(),
+                                  layerBranch.get_actual_branch())).ljust(55),
+                                  layerBranch.get_vcs_subdir()
+                                               ))
+            if requiredby:
+                logger.plain('  required by: %s' % ' '.join(requiredby))
+            if recommendedby:
+                logger.plain('  recommended by: %s' % ' '.join(recommendedby))
+
+        if args.show_only != True:
+            layerManager.setup(dependencies)
+            layerManager.fetch()
+            layerManager.unpack()
+            layerManager.update_bblayers()
 
     def do_layerindex_show_depends(self, args):
         """Find layer dependencies from layer index.
@@ -261,10 +134,10 @@ class LayerIndexPlugin(ActionPlugin):
     def register_commands(self, sp):
         parser_layerindex_fetch = self.add_command(sp, 'layerindex-fetch', self.do_layerindex_fetch)
         parser_layerindex_fetch.add_argument('-n', '--show-only', help='show dependencies and do nothing else', action='store_true')
-        parser_layerindex_fetch.add_argument('-b', '--branch', help='branch name to fetch (default %(default)s)', default='master')
+        parser_layerindex_fetch.add_argument('-b', '--branch', help='branch name to fetch (default %(default)s)')
         parser_layerindex_fetch.add_argument('-i', '--ignore', help='assume the specified layers do not need to be fetched/added (separate multiple layers with commas, no spaces)', metavar='LAYER')
         parser_layerindex_fetch.add_argument('layername', nargs='+', help='layer to fetch')
 
         parser_layerindex_show_depends = self.add_command(sp, 'layerindex-show-depends', self.do_layerindex_show_depends)
-        parser_layerindex_show_depends.add_argument('-b', '--branch', help='branch name to fetch (default %(default)s)', default='master')
+        parser_layerindex_show_depends.add_argument('-b', '--branch', help='branch name to fetch (default %(default)s)')
         parser_layerindex_show_depends.add_argument('layername', nargs='+', help='layer to query')
lib/layers/layerindex/__init__.py +20 -8
index 0c7c483..beb7df9 100644
@@ -407,7 +407,7 @@ invalid is just a list of dependencies that were not found.
 
         if names:
             for name in names.split():
-                if name in ignores:
+                if ignores and name in ignores:
                     continue
 
                 # Since we don't have a branch, we have to just find the first
@@ -441,7 +441,7 @@ invalid is just a list of dependencies that were not found.
         for layerBranch in layerBranches:
             name = layerBranch.get_layer().get_name()
             # Do we ignore it?
-            if name in ignores:
+            if ignores and name in ignores:
                 continue
 
             if 'layerDependencies_layerBranchId' not in layerBranch.index:
@@ -469,7 +469,7 @@ invalid is just a list of dependencies that were not found.
                             depLayerBranch = rdepLayerBranch
 
                     # Is this dependency on the list to be ignored?
-                    if depLayerBranch.get_layer().get_name() in ignores:
+                    if ignores and depLayerBranch.get_layer().get_name() in ignores:
                         continue
 
                     # Previously found dependencies have been processed, as
@@ -823,7 +823,19 @@ class LayerDependency(LayerIndexItem_LayerBranch):
             branchId = self.get_layerbranch().get_branch_id()
             layerBranch = self.index['layerBranches_layerId_branchId']["%s:%s" % (layerId, branchId)]
         except KeyError:
-            logger.error('Unable to find layerBranches_layerId_branchId in index')
+            logger.warning('Unable to find layerBranches_layerId_branchId in index')
+
+            # We don't have a quick lookup index, doing it the slower way...
+            layerId = self.get_dependency_id()
+            branchId = self.get_layerbranch().get_branch_id()
+            for layerBranchId in self.index['layerBranches']:
+                layerBranch = self.index['layerBranches'][layerBranchId]
+                if layerBranch.get_layer_id() == layerId and \
+                   layerBranch.get_branch_id() == branchId:
+                    break
+            else:
+                logger.error("LayerBranch not found layerId %s -- BranchId %s" % (layerId, branchId))
+                layerBranch = None
         except IndexError:
             logger.error("LayerBranch not found layerId %s -- BranchId %s" % (layerId, branchId))
 
@@ -832,10 +844,10 @@ class LayerDependency(LayerIndexItem_LayerBranch):
 
 class Recipe(LayerIndexItem_LayerBranch):
     def define_data(self, id,
-                    filename, filepath, pn, pv,
-                    summary, description, section, license,
-                    homepage, bugtracker, provides, bbclassextend,
-                    inherits, blacklisted, layerbranch, updated=None):
+                    filename, filepath, pn, pv, layerbranch,
+                    summary="", description="", section="", license="",
+                    homepage="", bugtracker="", provides="", bbclassextend="",
+                    inherits="", blacklisted="", updated=None):
         self.data = {}
         self.data['id'] = id
         self.data['filename'] = filename
lib/layers/layerindex/cooker.py +1 -1
index 229f668..76a8739 100644
@@ -125,7 +125,7 @@ class CookerPlugin(IndexPlugin):
                 if deps:
                     layerDependencyId = add_dependency(layerDependencyId, lindex, deps, False)
 
-        # Need to load recipes here
+        # Need to load recipes here (requires cooker access)
         recipeId = 0
         if False and 'recipes' in load.split():  ## TODO NOT IMPLEMENTED
             lindex['recipes'] = {}
lib/layers/layerindex/restapi.py +61 -34

119 lines not on this page · raw message

lib/layers/manager/__init__.py +35 -24

100 lines not on this page · raw message

Signature · 1 line
1.8.3.1
author
#7 lore raw

PATCH 4/5 toaster/orm/management/commands/lsupdates.py: Use new layerindex module

In reply to Mark Hatle
---
 lib/toaster/orm/management/commands/lsupdates.py | 215 +++++++++--------------
 1 file changed, 87 insertions(+), 128 deletions(-)
lib/toaster/orm/management/commands/lsupdates.py +87 -128
index 0b0d4ff..055ad78 100644
@@ -28,13 +28,16 @@ from orm.models import Distro
 import os
 import sys
 
-import json
 import logging
 import threading
 import time
 logger = logging.getLogger("toaster")
 
-DEFAULT_LAYERINDEX_SERVER = "http://layers.openembedded.org/layerindex/api/"
+DEFAULT_LAYERINDEX_SERVER = "http://layers.openembedded.org/layerindex/api/;type=restapi"
+
+# load Bitbake components
+path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
+sys.path.insert(0, path)
 
 
 class Spinner(threading.Thread):
@@ -83,43 +86,6 @@ class Command(BaseCommand):
         self.apiurl = DEFAULT_LAYERINDEX_SERVER
 
         assert self.apiurl is not None
-        try:
-            from urllib.request import urlopen, URLError
-            from urllib.parse import urlparse
-        except ImportError:
-            from urllib2 import urlopen, URLError
-            from urlparse import urlparse
-
-        proxy_settings = os.environ.get("http_proxy", None)
-
-        def _get_json_response(apiurl=DEFAULT_LAYERINDEX_SERVER):
-            http_progress = Spinner()
-            http_progress.start()
-
-            _parsedurl = urlparse(apiurl)
-            path = _parsedurl.path
-
-            # logger.debug("Fetching %s", apiurl)
-            try:
-                res = urlopen(apiurl)
-            except URLError as e:
-                raise Exception("Failed to read %s: %s" % (path, e.reason))
-
-            parsed = json.loads(res.read().decode('utf-8'))
-
-            http_progress.stop()
-            return parsed
-
-        # verify we can get the basic api
-        try:
-            apilinks = _get_json_response()
-        except Exception as e:
-            import traceback
-            if proxy_settings is not None:
-                logger.info("EE: Using proxy %s" % proxy_settings)
-            logger.warning("EE: could not connect to %s, skipping update:"
-                           "%s\n%s" % (self.apiurl, e, traceback.format_exc()))
-            return
 
         # update branches; only those that we already have names listed in the
         # Releases table
@@ -128,110 +94,115 @@ class Command(BaseCommand):
         if len(whitelist_branch_names) == 0:
             raise Exception("Failed to make list of branches to fetch")
 
+        self.apiurl += ";branch=%s" % "OR".join(whitelist_branch_names)
+
+        http_progress = Spinner()
+
         logger.info("Fetching metadata releases for %s",
                     " ".join(whitelist_branch_names))
 
-        branches_info = _get_json_response(apilinks['branches'] +
-                                           "?filter=name:%s"
-                                           % "OR".join(whitelist_branch_names))
+
+        import layers.layerindex
+
+        layerindex = layers.layerindex.LayerIndex(None)
+
+        http_progress.start()
+        layerindex.load_layerindex(self.apiurl)
+        http_progress.stop()
+
+        # We know we're only processing one entry, so we reference it here
+        # (this is cheating...)
+        lindex = layerindex.lindex[0]
 
         # Map the layer index branches to toaster releases
         li_branch_id_to_toaster_release = {}
 
-        total = len(branches_info)
-        for i, branch in enumerate(branches_info):
-            li_branch_id_to_toaster_release[branch['id']] = \
-                    Release.objects.get(name=branch['name'])
+        logger.info("Processing branches")
+
+        total = len(lindex['branches'])
+        for i, branchId in enumerate(lindex['branches']):
+            li_branch_id_to_toaster_release[branchId] = \
+                    Release.objects.get(name=lindex['branches'][branchId].get_name())
             self.mini_progress("Releases", i, total)
 
         # keep a track of the layerindex (li) id mappings so that
         # layer_versions can be created for these layers later on
         li_layer_id_to_toaster_layer_id = {}
 
-        logger.info("Fetching layers")
-
-        layers_info = _get_json_response(apilinks['layerItems'])
+        logger.info("Processing layers")
 
-        total = len(layers_info)
-        for i, li in enumerate(layers_info):
+        total = len(lindex['layerItems'])
+        for i, liId in enumerate(lindex['layerItems']):
             try:
-                l, created = Layer.objects.get_or_create(name=li['name'])
-                l.up_date = li['updated']
-                l.summary = li['summary']
-                l.description = li['description']
+                l, created = Layer.objects.get_or_create(name=lindex['layerItems'][liId].get_name())
+                l.up_date = lindex['layerItems'][liId].get_updated()
+                l.summary = lindex['layerItems'][liId].get_summary()
+                l.description = lindex['layerItems'][liId].get_description()
 
                 if created:
-                    l.vcs_url = li['vcs_url']
-                    l.vcs_web_url = li['vcs_web_url']
-                    l.vcs_web_tree_base_url = li['vcs_web_tree_base_url']
-                    l.vcs_web_file_base_url = li['vcs_web_file_base_url']
+                    l.vcs_url = lindex['layerItems'][liId].get_vcs_url()
+                    l.vcs_web_url = lindex['layerItems'][liId].get_vcs_web_url()
+                    l.vcs_web_tree_base_url = lindex['layerItems'][liId].get_vcs_web_tree_base_url()
+                    l.vcs_web_file_base_url = lindex['layerItems'][liId].get_vcs_web_file_base_url()
                 l.save()
             except Layer.MultipleObjectsReturned:
                 logger.info("Skipped %s as we found multiple layers and "
                             "don't know which to update" %
                             li['name'])
 
-            li_layer_id_to_toaster_layer_id[li['id']] = l.pk
+            li_layer_id_to_toaster_layer_id[liId] = l.pk
 
             self.mini_progress("layers", i, total)
 
         # update layer_versions
-        logger.info("Fetching layer versions")
-        layerbranches_info = _get_json_response(
-            apilinks['layerBranches'] + "?filter=branch__name:%s" %
-            "OR".join(whitelist_branch_names))
+        logger.info("Processing layer branches")
 
         # Map Layer index layer_branch object id to
         # layer_version toaster object id
         li_layer_branch_id_to_toaster_lv_id = {}
 
-        total = len(layerbranches_info)
-        for i, lbi in enumerate(layerbranches_info):
+        total = len(lindex['layerBranches'])
+        for i, lbiId in enumerate(lindex['layerBranches']):
             # release as defined by toaster map to layerindex branch
-            release = li_branch_id_to_toaster_release[lbi['branch']]
+            release = li_branch_id_to_toaster_release[lindex['layerBranches'][lbiId].get_branch_id()]
 
             try:
                 lv, created = Layer_Version.objects.get_or_create(
                     layer=Layer.objects.get(
-                        pk=li_layer_id_to_toaster_layer_id[lbi['layer']]),
+                        pk=li_layer_id_to_toaster_layer_id[lindex['layerBranches'][lbiId].get_layer_id()]),
                     release=release
                 )
             except KeyError:
                 logger.warning(
                     "No such layerindex layer referenced by layerbranch %d" %
-                    lbi['layer'])
+                    lindex['layerBranches'][lbiId].get_layer_id())
                 continue
 
             if created:
-                lv.release = li_branch_id_to_toaster_release[lbi['branch']]
-                lv.up_date = lbi['updated']
-                lv.commit = lbi['actual_branch']
-                lv.dirpath = lbi['vcs_subdir']
+                lv.release = li_branch_id_to_toaster_release[lindex['layerBranches'][lbiId].get_branch_id()]
+                lv.up_date = lindex['layerBranches'][lbiId].get_updated()
+                lv.commit = lindex['layerBranches'][lbiId].get_actual_branch()
+                lv.dirpath = lindex['layerBranches'][lbiId].get_vcs_subdir()
                 lv.save()
 
-            li_layer_branch_id_to_toaster_lv_id[lbi['id']] =\
+            li_layer_branch_id_to_toaster_lv_id[lindex['layerBranches'][lbiId].get_id()] =\
                 lv.pk
             self.mini_progress("layer versions", i, total)
 
-        logger.info("Fetching layer version dependencies")
-        # update layer dependencies
-        layerdependencies_info = _get_json_response(
-            apilinks['layerDependencies'] +
-            "?filter=layerbranch__branch__name:%s" %
-            "OR".join(whitelist_branch_names))
+        logger.info("Processing layer dependencies")
 
         dependlist = {}
-        for ldi in layerdependencies_info:
+        for ldiId in lindex['layerDependencies']:
             try:
                 lv = Layer_Version.objects.get(
-                    pk=li_layer_branch_id_to_toaster_lv_id[ldi['layerbranch']])
+                    pk=li_layer_branch_id_to_toaster_lv_id[lindex['layerDependencies'][ldiId].get_layerbranch_id()])
             except Layer_Version.DoesNotExist as e:
                 continue
 
             if lv not in dependlist:
                 dependlist[lv] = []
             try:
-                layer_id = li_layer_id_to_toaster_layer_id[ldi['dependency']]
+                layer_id = li_layer_id_to_toaster_layer_id[lindex['layerDependencies'][ldiId].get_dependency_id()]
 
                 dependlist[lv].append(
                     Layer_Version.objects.get(layer__pk=layer_id,
@@ -240,7 +211,7 @@ class Command(BaseCommand):
             except Layer_Version.DoesNotExist:
                 logger.warning("Cannot find layer version (ls:%s),"
                                "up_id:%s lv:%s" %
-                               (self, ldi['dependency'], lv))
+                               (self, lindex['layerDependencies'][ldiId].get_dependency_id(), lv))
 
         total = len(dependlist)
         for i, lv in enumerate(dependlist):
@@ -251,73 +222,61 @@ class Command(BaseCommand):
             self.mini_progress("Layer version dependencies", i, total)
 
         # update Distros
-        logger.info("Fetching distro information")
-        distros_info = _get_json_response(
-            apilinks['distros'] + "?filter=layerbranch__branch__name:%s" %
-            "OR".join(whitelist_branch_names))
+        logger.info("Processing distro information")
 
-        total = len(distros_info)
-        for i, di in enumerate(distros_info):
+        total = len(lindex['distros'])
+        for i, diId in enumerate(lindex['distros']):
             distro, created = Distro.objects.get_or_create(
-                name=di['name'],
+                name=lindex['distros'][diId].get_name(),
                 layer_version=Layer_Version.objects.get(
-                    pk=li_layer_branch_id_to_toaster_lv_id[di['layerbranch']]))
-            distro.up_date = di['updated']
-            distro.name = di['name']
-            distro.description = di['description']
+                    pk=li_layer_branch_id_to_toaster_lv_id[lindex['distros'][diId].get_layerbranch_id()]))
+            distro.up_date = lindex['distros'][diId].get_updated()
+            distro.name = lindex['distros'][diId].get_name()
+            distro.description = lindex['distros'][diId].get_description()
             distro.save()
             self.mini_progress("distros", i, total)
 
         # update machines
-        logger.info("Fetching machine information")
-        machines_info = _get_json_response(
-            apilinks['machines'] + "?filter=layerbranch__branch__name:%s" %
-            "OR".join(whitelist_branch_names))
+        logger.info("Processing machine information")
 
-        total = len(machines_info)
-        for i, mi in enumerate(machines_info):
+        total = len(lindex['machines'])
+        for i, miId in enumerate(lindex['machines']):
             mo, created = Machine.objects.get_or_create(
-                name=mi['name'],
+                name=lindex['machines'][miId].get_name(),
                 layer_version=Layer_Version.objects.get(
-                    pk=li_layer_branch_id_to_toaster_lv_id[mi['layerbranch']]))
-            mo.up_date = mi['updated']
-            mo.name = mi['name']
-            mo.description = mi['description']
+                    pk=li_layer_branch_id_to_toaster_lv_id[lindex['machines'][miId].get_layerbranch_id()]))
+            mo.up_date = lindex['machines'][miId].get_updated()
+            mo.name = lindex['machines'][miId].get_name()
+            mo.description = lindex['machines'][miId].get_description()
             mo.save()
             self.mini_progress("machines", i, total)
 
         # update recipes; paginate by layer version / layer branch
-        logger.info("Fetching recipe information")
-        recipes_info = _get_json_response(
-            apilinks['recipes'] + "?filter=layerbranch__branch__name:%s" %
-            "OR".join(whitelist_branch_names))
+        logger.info("Processing recipe information")
 
-        total = len(recipes_info)
-        for i, ri in enumerate(recipes_info):
+        total = len(lindex['recipes'])
+        for i, riId in enumerate(lindex['recipes']):
             try:
-                lv_id = li_layer_branch_id_to_toaster_lv_id[ri['layerbranch']]
+                lv_id = li_layer_branch_id_to_toaster_lv_id[lindex['recipes'][riId].get_layerbranch_id()]
                 lv = Layer_Version.objects.get(pk=lv_id)
 
                 ro, created = Recipe.objects.get_or_create(
                     layer_version=lv,
-                    name=ri['pn']
+                    name=lindex['recipes'][riId].get_pn()
                 )
 
                 ro.layer_version = lv
-                ro.up_date = ri['updated']
-                ro.name = ri['pn']
-                ro.version = ri['pv']
-                ro.summary = ri['summary']
-                ro.description = ri['description']
-                ro.section = ri['section']
-                ro.license = ri['license']
-                ro.homepage = ri['homepage']
-                ro.bugtracker = ri['bugtracker']
-                ro.file_path = ri['filepath'] + "/" + ri['filename']
-                if 'inherits' in ri:
-                    ro.is_image = 'image' in ri['inherits'].split()
-                else:  # workaround for old style layer index
-                    ro.is_image = "-image-" in ri['pn']
+                ro.up_date = lindex['recipes'][riId].get_updated()
+                ro.name = lindex['recipes'][riId].get_pn()
+                ro.version = lindex['recipes'][riId].get_pv()
+                ro.summary = lindex['recipes'][riId].get_summary()
+                ro.description = lindex['recipes'][riId].get_description()
+                ro.section = lindex['recipes'][riId].get_section()
+                ro.license = lindex['recipes'][riId].get_license()
+                ro.homepage = lindex['recipes'][riId].get_homepage()
+                ro.bugtracker = lindex['recipes'][riId].get_bugtracker()
+                ro.file_path = lindex['recipes'][riId].get_filepath() + "/" + lindex['recipes'][riId].get_filename()
+                ro.is_image = 'image' in lindex['recipes'][riId].get_inherits().split()
                 ro.save()
             except Exception as e:
                 logger.warning("Failed saving recipe %s", e)
Signature · 1 line
1.8.3.1
author
#12 lore raw

PATCH 5/5 bitbake-layers: disable parsing for layerindex commands

In reply to Mark Hatle

From: Paul Eggleton <[email protected]>

These don't need to access recipe information, so let's not waste the user's time parsing all recipes.

---
 lib/bblayers/layerindex.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/bblayers/layerindex.py +2 -2
index d1dac0b..153b0d9 100644
@@ -132,12 +132,12 @@ class LayerIndexPlugin(ActionPlugin):
         self.do_layerindex_fetch(args)
 
     def register_commands(self, sp):
-        parser_layerindex_fetch = self.add_command(sp, 'layerindex-fetch', self.do_layerindex_fetch)
+        parser_layerindex_fetch = self.add_command(sp, 'layerindex-fetch', self.do_layerindex_fetch, parserecipes=False)
         parser_layerindex_fetch.add_argument('-n', '--show-only', help='show dependencies and do nothing else', action='store_true')
         parser_layerindex_fetch.add_argument('-b', '--branch', help='branch name to fetch (default %(default)s)')
         parser_layerindex_fetch.add_argument('-i', '--ignore', help='assume the specified layers do not need to be fetched/added (separate multiple layers with commas, no spaces)', metavar='LAYER')
         parser_layerindex_fetch.add_argument('layername', nargs='+', help='layer to fetch')
 
-        parser_layerindex_show_depends = self.add_command(sp, 'layerindex-show-depends', self.do_layerindex_show_depends)
+        parser_layerindex_show_depends = self.add_command(sp, 'layerindex-show-depends', self.do_layerindex_show_depends, parserecipes=False)
         parser_layerindex_show_depends.add_argument('-b', '--branch', help='branch name to fetch (default %(default)s)')
         parser_layerindex_show_depends.add_argument('layername', nargs='+', help='layer to query')
Signature · 1 line
1.8.3.1
author
#6 lore raw

Re: [PATCH 3/5] lib/bblayers: Add support for the new layer modules

In reply to Mark Hatle
Quoted 8 lines · Mark Hatle
---
 lib/bblayers/layerindex.py        | 313 +++++++++++---------------------------
 lib/layers/layerindex/__init__.py |  28 +++-
 lib/layers/layerindex/cooker.py   |   2 +-
 lib/layers/layerindex/restapi.py  |  95 +++++++-----
 lib/layers/manager/__init__.py    |  59 ++++---
 5 files changed, 210 insertions(+), 287 deletions(-)

Argh, I just realized a bunch of fixes got merge to this patch, they should have been merged to 1/5.

I've fixed this in the git tree.

--Mark

#2 lore raw

Re: [PATCH 1/5] lib/layers: Initial layer and layer index implementeation

In reply to Mark Hatle
Quoted 6 lines · CEST Mark Hatle

This module provides two components, layerindex, which is used to talk a layerindex, such as layers.openembedded.org.

The other module is the 'manager'. This module will handle downloading, re-writing the bblayers to match the downloads and other related layer management tasks.

It's great to have a solid internal API for interacting with the layer index to replace the less than optimal earlier implementation in bitbake-layers - thanks for sorting this out. The only comments I'd make:

1) Can you rename the fetch2 plugin to something like bbfetch or bitbakefetch or something like that. I'd rather we didn't proliferate the fetch2 name any further - IIRC Richard has talked about renaming the module back to fetch at some point.

2) cooker.py has a "## TODO NOT IMPLEMENTED" comment that if still valid needs to be expanded upon - what's actually missing? There's also a moderate size block of commented-out code just below that, since this is new can we drop that if it's genuinely not needed?

3) Can we have a default type for layerindex URLs of "restapi" so we don't need to specify this everywhere in the common case? This would also mean we wouldn't have to change DEFAULT_LAYERINDEX_SERVER in the toaster code.

4) The "layers" naming of the module under lib is a little confusing given that we already have a bblayers module under lib/, and one might incorrectly assume that this was used for all layer handling. I don't actually yet have a naming scheme / structure I like better though :(

5) "OR" to split the branches is a very awkward. Can we use , (comma) instead?

6) I'm not massively thrilled at duplicating the layer index data structures in bitbake. It does make things easier on the bitbake side, and the alternative of making use of the original django models in bitbake isn't practical, but it's just a bit unfortunate in terms of future maintenance. Having said that we made the same choice in Toaster, and the layer index models don't change that often. (I guess I'm just highlighting this so we know what we're getting into.)

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#8 lore raw

Re: [PATCH 4/5] toaster/orm/management/commands/lsupdates.py: Use new layerindex module

In reply to Mark Hatle
Quoted 1 line · CEST Mark Hatle

Missing a commit message - and you wrote the book on proper commit messages :p

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
author
#3 lore raw

Re: [PATCH 1/5] lib/layers: Initial layer and layer index implementeation

In reply to Paul Eggleton
Quoted 8 lines · Paul Eggleton
Quoted 6 lines · CEST Mark Hatle

This module provides two components, layerindex, which is used to talk a layerindex, such as layers.openembedded.org.

The other module is the 'manager'. This module will handle downloading, re-writing the bblayers to match the downloads and other related layer management tasks.

Quoted 8 lines

It's great to have a solid internal API for interacting with the layer index to replace the less than optimal earlier implementation in bitbake-layers - thanks for sorting this out. The only comments I'd make:

1) Can you rename the fetch2 plugin to something like bbfetch or bitbakefetch or something like that. I'd rather we didn't proliferate the fetch2 name any further - IIRC Richard has talked about renaming the module back to fetch at some point.

Yes, I can easily do that. The name used is the name of the fetch plugin, so it is partially use visible.

Quoted 4 lines

2) cooker.py has a "## TODO NOT IMPLEMENTED" comment that if still valid needs to be expanded upon - what's actually missing? There's also a moderate size block of commented-out code just below that, since this is new can we drop that if it's genuinely not needed?

The block immediately below it is what needs to be implemented. This is the loading of recipe data from the cooker store (or even having to parse recipes). As part of the toaster work, I expect to implement it. I left it there specifically as a guide to the implementer on what is likely needed -- even though I know the commented out parts do not work as-is.

(Currently no recipe specific behavior is loaded from the currently running system.)

Quoted 3 lines

3) Can we have a default type for layerindex URLs of "restapi" so we don't need to specify this everywhere in the common case? This would also mean we wouldn't have to change DEFAULT_LAYERINDEX_SERVER in the toaster code.

Yes, I can make it the default unless a type is defined. The toaster code will be changing to match up with the bblayers code. I'd rather not specify the same
thing in multiple places. But I won't be making that change until the toaster
work is in progress.

Quoted 4 lines

4) The "layers" naming of the module under lib is a little confusing given that we already have a bblayers module under lib/, and one might incorrectly assume that this was used for all layer handling. I don't actually yet have a naming scheme / structure I like better though :(

Ya, I couldn't think of one. Initially I had called it layerindex, but the manager (which current does downloading) confused it.. so I changed it.

Quoted 1 line

5) "OR" to split the branches is a very awkward. Can we use , (comma) instead?

The implementation was designed to match the current format of the restapi URL format. But as long as it can be represented in a URI, anything should be fine.

Quoted 7 lines

6) I'm not massively thrilled at duplicating the layer index data structures in bitbake. It does make things easier on the bitbake side, and the alternative of making use of the original django models in bitbake isn't practical, but it's just a bit unfortunate in terms of future maintenance. Having said that we made the same choice in Toaster, and the layer index models don't change that often. (I guess I'm just highlighting this so we know what we're getting into.)

Yes.. The internal 'data' side of things rarely changes -- but by having the class we can handle any changes that do happen in the future more easily -- and as you noted it does simplify some of the django like features.

--Mark

Quoted 3 lines

Cheers,
Paul

author
#9 lore raw

Re: [PATCH 4/5] toaster/orm/management/commands/lsupdates.py: Use new layerindex module

In reply to Paul Eggleton
Quoted 4 lines · Paul Eggleton
Quoted 1 line · CEST Mark Hatle

Missing a commit message - and you wrote the book on proper commit messages :p

In this case, what is wrong with the message. The change doesn't do anything but use the new layer index module. Functionality remains the same.

I can duplicate it in the commit message, but this isn't a place where I see any added value.

--Mark

Quoted 3 lines

Cheers,
Paul

#10 lore raw

Re: [PATCH 4/5] toaster/orm/management/commands/lsupdates.py: Use new layerindex module

Quoted 10 lines · CEST Mark Hatle
Quoted 5 lines · Paul Eggleton
Quoted 1 line · CEST Mark Hatle

Missing a commit message - and you wrote the book on proper commit messages :p

In this case, what is wrong with the message. The change doesn't do anything but use the new layer index module. Functionality remains the same.

Wouldn't you at minimum want to state exactly that last bit then? That isn't clear without carefully looking through the patch.

Same for the other commit, except there what is displayed by bitbake-layers layerindex-fetch has changed a little bit.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
author
#11 lore raw

Re: [PATCH 4/5] toaster/orm/management/commands/lsupdates.py: Use new layerindex module

Quoted 12 lines · Paul Eggleton
Quoted 10 lines · CEST Mark Hatle
Quoted 5 lines · Paul Eggleton
Quoted 1 line · CEST Mark Hatle

Missing a commit message - and you wrote the book on proper commit messages :p

In this case, what is wrong with the message. The change doesn't do anything but use the new layer index module. Functionality remains the same.

Quoted 5 lines

Wouldn't you at minimum want to state exactly that last bit then? That isn't clear without carefully looking through the patch.

Same for the other commit, except there what is displayed by bitbake-layers layerindex-fetch has changed a little bit.

Ok, I can do that.

--Mark

Quoted 3 lines

Cheers,
Paul