diff options
| author | Mark Hatle <mark.hatle@windriver.com> | 2018-07-23 22:29:11 -0400 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-08-02 10:18:27 +0100 |
| commit | 1ac19d1bf111a4836625f5cbb28a751d5c427395 (patch) | |
| tree | ae9fa1448b425522952cbc8af90cf79912c746b1 /bitbake/lib/layerindexlib/plugin.py | |
| parent | 0dea95093115acc08f6ad19dc931d532a601cbec (diff) | |
| download | poky-1ac19d1bf111a4836625f5cbb28a751d5c427395.tar.gz | |
bitbake: layerindexlib: Initial layer index processing module implementation
The layer index module is expected to be used by various parts of the system
in order to access a layerindex-web (such as layers.openembedded.org) and
perform basic processing on the information, such as dependency scanning.
Along with the layerindex implementation are associated tests. The tests
properly honor BB_SKIP_NETTESTS='yes' to prevent test failures.
Tests Implemented:
- 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
- LayerIndex setup using simulated cooker data
(Bitbake rev: fd0ee6c10dbb5592731e56f4c592fe687682a3e6)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/layerindexlib/plugin.py')
| -rw-r--r-- | bitbake/lib/layerindexlib/plugin.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/bitbake/lib/layerindexlib/plugin.py b/bitbake/lib/layerindexlib/plugin.py new file mode 100644 index 0000000000..92a2e978ba --- /dev/null +++ b/bitbake/lib/layerindexlib/plugin.py | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | # Copyright (C) 2016-2018 Wind River Systems, Inc. | ||
| 2 | # | ||
| 3 | # This program is free software; you can redistribute it and/or modify | ||
| 4 | # it under the terms of the GNU General Public License version 2 as | ||
| 5 | # published by the Free Software Foundation. | ||
| 6 | # | ||
| 7 | # This program is distributed in the hope that it will be useful, | ||
| 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 10 | # See the GNU General Public License for more details. | ||
| 11 | # | ||
| 12 | # You should have received a copy of the GNU General Public License | ||
| 13 | # along with this program; if not, write to the Free Software | ||
| 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 15 | |||
| 16 | # The file contains: | ||
| 17 | # LayerIndex exceptions | ||
| 18 | # Plugin base class | ||
| 19 | # Utility Functions for working on layerindex data | ||
| 20 | |||
| 21 | import argparse | ||
| 22 | import logging | ||
| 23 | import os | ||
| 24 | import bb.msg | ||
| 25 | |||
| 26 | logger = logging.getLogger('BitBake.layerindexlib.plugin') | ||
| 27 | |||
| 28 | class LayerIndexPluginException(Exception): | ||
| 29 | """LayerIndex Generic Exception""" | ||
| 30 | def __init__(self, message): | ||
| 31 | self.msg = message | ||
| 32 | Exception.__init__(self, message) | ||
| 33 | |||
| 34 | def __str__(self): | ||
| 35 | return self.msg | ||
| 36 | |||
| 37 | class LayerIndexPluginUrlError(LayerIndexPluginException): | ||
| 38 | """Exception raised when a plugin does not support a given URL type""" | ||
| 39 | def __init__(self, plugin, url): | ||
| 40 | msg = "%s does not support %s:" % (plugin, url) | ||
| 41 | self.plugin = plugin | ||
| 42 | self.url = url | ||
| 43 | LayerIndexPluginException.__init__(self, msg) | ||
| 44 | |||
| 45 | class IndexPlugin(): | ||
| 46 | def __init__(self): | ||
| 47 | self.type = None | ||
| 48 | |||
| 49 | def init(self, layerindex): | ||
| 50 | self.layerindex = layerindex | ||
| 51 | |||
| 52 | def plugin_type(self): | ||
| 53 | return self.type | ||
| 54 | |||
| 55 | def load_index(self, uri): | ||
| 56 | raise NotImplementedError('load_index is not implemented') | ||
| 57 | |||
| 58 | def store_index(self, uri, index): | ||
| 59 | raise NotImplementedError('store_index is not implemented') | ||
| 60 | |||
