Unable to create a MetaPackage
I used the external_packages
and external_recipes
configuration items to point to a set of packages and recipes for our organization's GStreamer assets. The main Package points to the recipes, and a MetaPackage is defined like this:
# ourassets-installer.package
# vi:si:et:sw=4:sts=4:ts=4:syntax=python:ft=python
# -*- Mode: Python -*-
from cerbero.packages import package
class MetaPackage(package.MetaPackage):
name = 'ourassets'
shortdesc = 'Our Assets Installer'
longdesc = shortdesc
uuid = '7fe62402-c5a7-4b99-b73e-e4ef5c03e008'
packages = [
# (name, required, selected)
('our-plugins', True, True),
]
When I try to run cerbero-uninstalled ... list-packages
, it dumps an error:
WARNING: Error loading package from file c:/Projects/ourassets-cerbero/packages/ourassets-installer.package
Traceback (most recent call last):
File "C:\cerbero\packages\packagesstore.py", line 198, in _load_packages_from_file
pkg = self._load_package_from_file(package_cls, filepath, custom)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\cerbero\packages\packagesstore.py", line 216, in _load_package_from_file
raise Exception('Uknown package type %s' % package_cls)
Exception: Uknown package type <class 'MetaPackage'>
The error is exact; that function doesn't handle the MetaPackage class. The fix is:
def _load_package_from_file(self, package_cls, filepath, custom=None):
if issubclass(package_cls, package.App):
p = package_cls(self._config, self, self.cookbook)
elif issubclass(package_cls, package.SDKPackage):
p = package_cls(self._config, self)
+ elif issubclass(package_cls, package.MetaPackage):
+ p = package_cls(self._config, self)
elif issubclass(package_cls, package.InstallerPackage):
p = package_cls(self._config, self)
elif issubclass(package_cls, package.Package):
p = package_cls(self._config, self, self.cookbook)
else:
raise Exception('Uknown package type %s' % package_cls)