From 42fccb76efc4d60d604e037ceb0efa617a94e6bb Mon Sep 17 00:00:00 2001 From: Evgeniy Alekseev Date: Thu, 17 Aug 2023 16:02:15 +0300 Subject: [PATCH] add dummy type fields for pkgbuild generators This field is required in order to pass config validation in case if section name differs from default one. Also by default keyring_generator and mirrorlist_generator have been renamed to keyring-generator and mirrorlist-generator respectively for consistence --- docs/configuration.rst | 2 ++ docs/faq.rst | 8 ++++---- src/ahriman/core/support/keyring_trigger.py | 6 +++++- src/ahriman/core/support/mirrorlist_trigger.py | 6 +++++- .../ahriman/application/handlers/test_handler_validate.py | 4 ++-- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index eecfd6b4..f54c29c1 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -126,6 +126,7 @@ Keyring package generator plugin. Keyring generator plugin ^^^^^^^^^^^^^^^^^^^^^^^^ +* ``type`` - type of the generator, string, optional, must be set to ``keyring-generator`` if exists. * ``description`` - keyring package description, string, optional, default is ``repo PGP keyring``, where ``repo`` is the repository name. * ``homepage`` - url to homepage location if any, string, optional. * ``license`` - list of licenses which are applied to this package, space separated list of strings, optional, default is ``Unlicense``. @@ -144,6 +145,7 @@ Mirrorlist package generator plugin. Mirrorlist generator plugin ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +* ``type`` - type of the generator, string, optional, must be set to ``mirrorlist-generator`` if exists. * ``description`` - mirrorlist package description, string, optional, default is ``repo mirror list for use by pacman``, where ``repo`` is the repository name. * ``homepage`` - url to homepage location if any, string, optional. * ``license`` - list of licenses which are applied to this package, space separated list of strings, optional, default is ``Unlicense``. diff --git a/docs/faq.rst b/docs/faq.rst index a52ce94a..faa44713 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -767,7 +767,7 @@ The application provides special plugin which generates keyring package. This pl .. code-block:: ini [keyring] - target = keyring_generator + target = keyring-generator By default it will use ``sign.key`` as trusted key and all other keys as packagers ones. For all available options refer to :doc:`configuration `. @@ -802,12 +802,12 @@ The application provides special plugin which generates mirrorlist package also. .. code-block:: ini [mirrorlist] - target = mirrorlist_generator + target = mirrorlist-generator - [mirrorlist_generator] + [mirrorlist-generator] servers = https://repo.example.com/$arch - The ``mirrorlist_generator.servers`` must contain list of available mirrors, the ``$arch`` and ``$repo`` variables are supported. For more options kindly refer to :doc:`configuration `. + The ``mirrorlist-generator.servers`` must contain list of available mirrors, the ``$arch`` and ``$repo`` variables are supported. For more options kindly refer to :doc:`configuration `. #. Create package source files: diff --git a/src/ahriman/core/support/keyring_trigger.py b/src/ahriman/core/support/keyring_trigger.py index fdbd4595..583b3beb 100644 --- a/src/ahriman/core/support/keyring_trigger.py +++ b/src/ahriman/core/support/keyring_trigger.py @@ -46,9 +46,13 @@ class KeyringTrigger(Trigger): }, }, }, - "keyring_generator": { + "keyring-generator": { "type": "dict", "schema": { + "type": { + "type": "string", + "allowed": ["keyring-generator"], + }, "description": { "type": "string", }, diff --git a/src/ahriman/core/support/mirrorlist_trigger.py b/src/ahriman/core/support/mirrorlist_trigger.py index d931adc5..a9e182ca 100644 --- a/src/ahriman/core/support/mirrorlist_trigger.py +++ b/src/ahriman/core/support/mirrorlist_trigger.py @@ -42,9 +42,13 @@ class MirrorlistTrigger(Trigger): }, }, }, - "mirrorlist_generator": { + "mirrorlist-generator": { "type": "dict", "schema": { + "type": { + "type": "string", + "allowed": ["mirrorlist-generator"], + }, "description": { "type": "string", }, diff --git a/tests/ahriman/application/handlers/test_handler_validate.py b/tests/ahriman/application/handlers/test_handler_validate.py index 093aae56..cab07531 100644 --- a/tests/ahriman/application/handlers/test_handler_validate.py +++ b/tests/ahriman/application/handlers/test_handler_validate.py @@ -64,9 +64,9 @@ def test_schema(configuration: Configuration) -> None: assert schema.pop("gitremote") assert schema.pop("html") assert schema.pop("keyring") - assert schema.pop("keyring_generator") + assert schema.pop("keyring-generator") assert schema.pop("mirrorlist") - assert schema.pop("mirrorlist_generator") + assert schema.pop("mirrorlist-generator") assert schema.pop("remote-pull") assert schema.pop("remote-push") assert schema.pop("report")