blob: 7015a1af265c0e4bc769f1d5d431c96947c33ba1 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001# Copyright (C) 2016-2018 Wind River Systems, Inc.
2#
Brad Bishopc342db32019-05-15 21:57:59 -04003# SPDX-License-Identifier: GPL-2.0-only
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08004#
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08005# The file contains:
6# LayerIndex exceptions
7# Plugin base class
8# Utility Functions for working on layerindex data
9
10import argparse
11import logging
12import os
13import bb.msg
14
15logger = logging.getLogger('BitBake.layerindexlib.plugin')
16
17class 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
26class 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
34class 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