From 8f047f9a9614beb7a27e2969f6c94dca9d8cfd7a Mon Sep 17 00:00:00 2001 From: Evgenii Alekseev Date: Sun, 29 Oct 2023 23:41:20 +0200 Subject: [PATCH] feat: add patch controls to web, review web, enrich info tab (#115) * add ability to specify one-time patch on package addition * support vars in interface --- docs/faq.rst | 8 + .../ahriman/templates/build-status.jinja2 | 13 +- .../build-status/key-import-modal.jinja2 | 12 +- .../templates/build-status/login-modal.jinja2 | 8 +- .../build-status/package-add-modal.jinja2 | 94 ++++++-- .../build-status/package-info-modal.jinja2 | 212 +++++++++++++++--- .../build-status/package-rebuild-modal.jinja2 | 10 +- .../templates/build-status/table.jinja2 | 107 ++++----- .../share/ahriman/templates/repo-index.jinja2 | 11 +- .../templates/utils/bootstrap-scripts.jinja2 | 34 ++- src/ahriman/application/ahriman.py | 1 + src/ahriman/application/handlers/add.py | 6 + src/ahriman/application/handlers/handler.py | 2 +- src/ahriman/application/handlers/patch.py | 2 +- .../database/operations/package_operations.py | 31 +-- .../database/operations/patch_operations.py | 33 ++- src/ahriman/core/spawn.py | 24 +- src/ahriman/core/status/watcher.py | 35 +++ src/ahriman/core/util.py | 33 +++ src/ahriman/models/pkgbuild_patch.py | 41 +++- src/ahriman/models/repository_id.py | 2 + src/ahriman/web/schemas/__init__.py | 6 +- src/ahriman/web/schemas/log_schema.py | 11 +- src/ahriman/web/schemas/logs_schema.py | 18 -- .../web/schemas/package_patch_schema.py | 33 +++ src/ahriman/web/schemas/patch_name_schema.py | 33 +++ src/ahriman/web/schemas/patch_schema.py | 33 +++ .../web/schemas/versioned_log_schema.py | 35 +++ src/ahriman/web/views/v1/service/add.py | 10 +- src/ahriman/web/views/v1/service/request.py | 10 +- src/ahriman/web/views/v1/status/logs.py | 5 +- src/ahriman/web/views/v1/status/patch.py | 103 +++++++++ src/ahriman/web/views/v1/status/patches.py | 108 +++++++++ src/ahriman/web/views/v2/status/logs.py | 23 +- .../application/handlers/test_handler_add.py | 20 +- .../handlers/test_handler_patch.py | 2 +- tests/ahriman/application/test_ahriman.py | 16 ++ tests/ahriman/core/build_tools/test_task.py | 1 + .../migrations/test_m011_repository_name.py | 2 +- .../operations/test_patch_operations.py | 42 ++-- tests/ahriman/core/status/test_watcher.py | 38 ++++ tests/ahriman/core/test_spawn.py | 23 +- tests/ahriman/core/test_util.py | 23 +- tests/ahriman/models/test_pkgbuild_patch.py | 39 +++- tests/ahriman/models/test_repository_id.py | 2 +- .../web/schemas/test_package_patch_schema.py | 1 + .../web/schemas/test_patch_name_schema.py | 1 + .../ahriman/web/schemas/test_patch_schema.py | 1 + .../web/schemas/test_versioned_log_schema.py | 1 + .../v1/service/test_view_v1_service_add.py | 32 ++- .../service/test_view_v1_service_request.py | 32 ++- .../v1/status/test_view_v1_status_patch.py | 81 +++++++ .../v1/status/test_view_v1_status_patches.py | 75 +++++++ .../v2/status/test_view_v2_status_logs.py | 24 +- 54 files changed, 1327 insertions(+), 276 deletions(-) create mode 100644 src/ahriman/web/schemas/package_patch_schema.py create mode 100644 src/ahriman/web/schemas/patch_name_schema.py create mode 100644 src/ahriman/web/schemas/patch_schema.py create mode 100644 src/ahriman/web/schemas/versioned_log_schema.py create mode 100644 src/ahriman/web/views/v1/status/patch.py create mode 100644 src/ahriman/web/views/v1/status/patches.py create mode 100644 tests/ahriman/web/schemas/test_package_patch_schema.py create mode 100644 tests/ahriman/web/schemas/test_patch_name_schema.py create mode 100644 tests/ahriman/web/schemas/test_patch_schema.py create mode 100644 tests/ahriman/web/schemas/test_versioned_log_schema.py create mode 100644 tests/ahriman/web/views/v1/status/test_view_v1_status_patch.py create mode 100644 tests/ahriman/web/views/v1/status/test_view_v1_status_patches.py diff --git a/docs/faq.rst b/docs/faq.rst index 2a2d0909..6caaad2e 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -200,6 +200,14 @@ Alternatively you can create full-diff patches, which are calculated by using `` The last command will calculate diff from current tree to the ``HEAD`` and will store it locally. Patches will be applied on any package actions (e.g. it can be used for dependency management). +It is also possible to create simple patch during package addition, e.g.: + +.. code-block:: shell + + sudo -u ahriman ahriman package-add ahriman --variable PKGEXT=.pkg.tar.xz + +The ``--variable`` argument accepts variables in shell like format: quotation and lists are supported as usual, but functions are not. This feature is useful in particular in order to override specific makepkg variables during build. + How to build package from official repository ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/package/share/ahriman/templates/build-status.jinja2 b/package/share/ahriman/templates/build-status.jinja2 index acf10a2b..1841b01b 100644 --- a/package/share/ahriman/templates/build-status.jinja2 +++ b/package/share/ahriman/templates/build-status.jinja2 @@ -51,7 +51,7 @@
  • -
  • @@ -61,7 +61,7 @@
  • -
  • @@ -77,7 +77,8 @@ - - + - - + +
    package baseversionversion packages groups licenses packagerlast updatestatuslast updatestatus
    diff --git a/package/share/ahriman/templates/build-status/key-import-modal.jinja2 b/package/share/ahriman/templates/build-status/key-import-modal.jinja2 index c06e6acc..fb5b4f0f 100644 --- a/package/share/ahriman/templates/build-status/key-import-modal.jinja2 +++ b/package/share/ahriman/templates/build-status/key-import-modal.jinja2 @@ -8,20 +8,20 @@