Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | # Copyright (C) 2016-2018 Wind River Systems, Inc. |
| 2 | # |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 3 | # SPDX-License-Identifier: GPL-2.0-only |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 4 | # |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 5 | # The file contains: |
| 6 | # LayerIndex exceptions |
| 7 | # Plugin base class |
| 8 | # Utility Functions for working on layerindex data |
| 9 | |
| 10 | import argparse |
| 11 | import logging |
| 12 | import os |
| 13 | import bb.msg |
| 14 | |
| 15 | logger = logging.getLogger('BitBake.layerindexlib.plugin') |
| 16 | |
| 17 | class LayerIndexPluginException(Exception): |
| 18 | """LayerIndex Generic Exception""" |
| 19 | def __init__(self, message): |
| 20 | self.msg = message |
| 21 | Exception.__init__(self, message) |
| 22 | |
| 23 | def __str__(self): |
| 24 | return self.msg |
| 25 | |
| 26 | class LayerIndexPluginUrlError(LayerIndexPluginException): |
| 27 | """Exception raised when a plugin does not support a given URL type""" |
| 28 | def __init__(self, plugin, url): |
| 29 | msg = "%s does not support %s:" % (plugin, url) |
| 30 | self.plugin = plugin |
| 31 | self.url = url |
| 32 | LayerIndexPluginException.__init__(self, msg) |
| 33 | |
| 34 | class IndexPlugin(): |
| 35 | def __init__(self): |
| 36 | self.type = None |
| 37 | |
| 38 | def init(self, layerindex): |
| 39 | self.layerindex = layerindex |
| 40 | |
| 41 | def plugin_type(self): |
| 42 | return self.type |
| 43 | |
| 44 | def load_index(self, uri): |
| 45 | raise NotImplementedError('load_index is not implemented') |
| 46 | |
| 47 | def store_index(self, uri, index): |
| 48 | raise NotImplementedError('store_index is not implemented') |
| 49 | |