plugin.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # Copyright (C) 2016-2018 Wind River Systems, Inc.
  2. #
  3. # SPDX-License-Identifier: GPL-2.0-only
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License version 2 as
  7. # published by the Free Software Foundation.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. # See the GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. # The file contains:
  18. # LayerIndex exceptions
  19. # Plugin base class
  20. # Utility Functions for working on layerindex data
  21. import argparse
  22. import logging
  23. import os
  24. import bb.msg
  25. logger = logging.getLogger('BitBake.layerindexlib.plugin')
  26. class LayerIndexPluginException(Exception):
  27. """LayerIndex Generic Exception"""
  28. def __init__(self, message):
  29. self.msg = message
  30. Exception.__init__(self, message)
  31. def __str__(self):
  32. return self.msg
  33. class LayerIndexPluginUrlError(LayerIndexPluginException):
  34. """Exception raised when a plugin does not support a given URL type"""
  35. def __init__(self, plugin, url):
  36. msg = "%s does not support %s:" % (plugin, url)
  37. self.plugin = plugin
  38. self.url = url
  39. LayerIndexPluginException.__init__(self, msg)
  40. class IndexPlugin():
  41. def __init__(self):
  42. self.type = None
  43. def init(self, layerindex):
  44. self.layerindex = layerindex
  45. def plugin_type(self):
  46. return self.type
  47. def load_index(self, uri):
  48. raise NotImplementedError('load_index is not implemented')
  49. def store_index(self, uri, index):
  50. raise NotImplementedError('store_index is not implemented')