mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 07:17:17 +00:00
feat: add ability to disable debug packages distribution
The feature is implemented as supplying !debug option to makepkg when generating package list. In this case debug packages still will be built, however, they will not be added to the repository
This commit is contained in:
parent
243983ee64
commit
ecfb615f97
@ -81,6 +81,7 @@ Build related configuration. Group name can refer to architecture, e.g. ``build:
|
|||||||
* ``archbuild_flags`` - additional flags passed to ``archbuild`` command, space separated list of strings, optional.
|
* ``archbuild_flags`` - additional flags passed to ``archbuild`` command, space separated list of strings, optional.
|
||||||
* ``build_command`` - default build command, string, required.
|
* ``build_command`` - default build command, string, required.
|
||||||
* ``ignore_packages`` - list packages to ignore during a regular update (manual update will still work), space separated list of strings, optional.
|
* ``ignore_packages`` - list packages to ignore during a regular update (manual update will still work), space separated list of strings, optional.
|
||||||
|
* ``include_debug_packages`` - distribute debug packages, boolean, optional, default ``yes``.
|
||||||
* ``makepkg_flags`` - additional flags passed to ``makepkg`` command, space separated list of strings, optional.
|
* ``makepkg_flags`` - additional flags passed to ``makepkg`` command, space separated list of strings, optional.
|
||||||
* ``makechrootpkg_flags`` - additional flags passed to ``makechrootpkg`` command, space separated list of strings, optional.
|
* ``makechrootpkg_flags`` - additional flags passed to ``makechrootpkg`` command, space separated list of strings, optional.
|
||||||
* ``triggers`` - list of ``ahriman.core.triggers.Trigger`` class implementation (e.g. ``ahriman.core.report.ReportTrigger ahriman.core.upload.UploadTrigger``) which will be loaded and run at the end of processing, space separated list of strings, optional. You can also specify triggers by their paths, e.g. ``/usr/lib/python3.10/site-packages/ahriman/core/report/report.py.ReportTrigger``. Triggers are run in the order of definition.
|
* ``triggers`` - list of ``ahriman.core.triggers.Trigger`` class implementation (e.g. ``ahriman.core.report.ReportTrigger ahriman.core.upload.UploadTrigger``) which will be loaded and run at the end of processing, space separated list of strings, optional. You can also specify triggers by their paths, e.g. ``/usr/lib/python3.10/site-packages/ahriman/core/report/report.py.ReportTrigger``. Triggers are run in the order of definition.
|
||||||
|
@ -46,8 +46,12 @@ allow_read_only = yes
|
|||||||
[build]
|
[build]
|
||||||
; List of additional flags passed to archbuild command.
|
; List of additional flags passed to archbuild command.
|
||||||
;archbuild_flags =
|
;archbuild_flags =
|
||||||
|
; Path to build command
|
||||||
|
;build_command =
|
||||||
; List of packages to be ignored during automatic updates.
|
; List of packages to be ignored during automatic updates.
|
||||||
;ignore_packages =
|
;ignore_packages =
|
||||||
|
; Include debug packages
|
||||||
|
;include_debug_packages = yes
|
||||||
; List of additional flags passed to makechrootpkg command.
|
; List of additional flags passed to makechrootpkg command.
|
||||||
;makechrootpkg_flags =
|
;makechrootpkg_flags =
|
||||||
; List of additional flags passed to makepkg command.
|
; List of additional flags passed to makepkg command.
|
||||||
|
@ -38,6 +38,7 @@ class Task(LazyLogging):
|
|||||||
archbuild_flags(list[str]): command flags for archbuild command
|
archbuild_flags(list[str]): command flags for archbuild command
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
build_command(str): build command
|
build_command(str): build command
|
||||||
|
include_debug_packages(bool): whether to include debug packages or not
|
||||||
makechrootpkg_flags(list[str]): command flags for makechrootpkg command
|
makechrootpkg_flags(list[str]): command flags for makechrootpkg command
|
||||||
makepkg_flags(list[str]): command flags for makepkg command
|
makepkg_flags(list[str]): command flags for makepkg command
|
||||||
package(Package): package definitions
|
package(Package): package definitions
|
||||||
@ -63,6 +64,7 @@ class Task(LazyLogging):
|
|||||||
|
|
||||||
self.archbuild_flags = configuration.getlist("build", "archbuild_flags", fallback=[])
|
self.archbuild_flags = configuration.getlist("build", "archbuild_flags", fallback=[])
|
||||||
self.build_command = configuration.get("build", "build_command")
|
self.build_command = configuration.get("build", "build_command")
|
||||||
|
self.include_debug_packages = configuration.getboolean("build", "include_debug_packages", fallback=True)
|
||||||
self.makepkg_flags = configuration.getlist("build", "makepkg_flags", fallback=[])
|
self.makepkg_flags = configuration.getlist("build", "makepkg_flags", fallback=[])
|
||||||
self.makechrootpkg_flags = configuration.getlist("build", "makechrootpkg_flags", fallback=[])
|
self.makechrootpkg_flags = configuration.getlist("build", "makechrootpkg_flags", fallback=[])
|
||||||
|
|
||||||
@ -99,9 +101,11 @@ class Task(LazyLogging):
|
|||||||
environment=environment,
|
environment=environment,
|
||||||
)
|
)
|
||||||
|
|
||||||
# well it is not actually correct, but we can deal with it
|
package_list_command = ["makepkg", "--packagelist"]
|
||||||
|
if not self.include_debug_packages:
|
||||||
|
package_list_command.append("OPTIONS=(!debug)") # disable debug flag manually
|
||||||
packages = check_output(
|
packages = check_output(
|
||||||
"makepkg", "--packagelist",
|
*package_list_command,
|
||||||
exception=BuildError.from_process(self.package.base),
|
exception=BuildError.from_process(self.package.base),
|
||||||
cwd=sources_dir,
|
cwd=sources_dir,
|
||||||
logger=self.logger,
|
logger=self.logger,
|
||||||
|
@ -176,6 +176,10 @@ CONFIGURATION_SCHEMA: ConfigurationSchema = {
|
|||||||
"empty": False,
|
"empty": False,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"include_debug_packages": {
|
||||||
|
"type": "boolean",
|
||||||
|
"coerce": "boolean",
|
||||||
|
},
|
||||||
"makepkg_flags": {
|
"makepkg_flags": {
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"coerce": "list",
|
"coerce": "list",
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
|
from unittest.mock import call as MockCall
|
||||||
|
|
||||||
from ahriman.core.build_tools.task import Task
|
from ahriman.core.build_tools.task import Task
|
||||||
from ahriman.core.database import SQLite
|
from ahriman.core.database import SQLite
|
||||||
@ -9,9 +12,83 @@ def test_build(task_ahriman: Task, mocker: MockerFixture) -> None:
|
|||||||
"""
|
"""
|
||||||
must build package
|
must build package
|
||||||
"""
|
"""
|
||||||
|
local = Path("local")
|
||||||
check_output_mock = mocker.patch("ahriman.core.build_tools.task.check_output")
|
check_output_mock = mocker.patch("ahriman.core.build_tools.task.check_output")
|
||||||
task_ahriman.build(Path("ahriman"))
|
|
||||||
check_output_mock.assert_called()
|
task_ahriman.build(local)
|
||||||
|
check_output_mock.assert_has_calls([
|
||||||
|
MockCall(
|
||||||
|
"extra-x86_64-build", "-r", str(task_ahriman.paths.chroot), "--", "--", "--skippgpcheck",
|
||||||
|
exception=pytest.helpers.anyvar(int),
|
||||||
|
cwd=local,
|
||||||
|
logger=task_ahriman.logger,
|
||||||
|
user=task_ahriman.uid,
|
||||||
|
environment={},
|
||||||
|
),
|
||||||
|
MockCall(
|
||||||
|
"makepkg", "--packagelist",
|
||||||
|
exception=pytest.helpers.anyvar(int),
|
||||||
|
cwd=local,
|
||||||
|
logger=task_ahriman.logger,
|
||||||
|
environment={},
|
||||||
|
),
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def test_build_environment(task_ahriman: Task, mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must build package with environment variables set
|
||||||
|
"""
|
||||||
|
local = Path("local")
|
||||||
|
check_output_mock = mocker.patch("ahriman.core.build_tools.task.check_output")
|
||||||
|
environment = {"variable": "value"}
|
||||||
|
|
||||||
|
task_ahriman.build(local, **environment, empty=None)
|
||||||
|
check_output_mock.assert_has_calls([
|
||||||
|
MockCall(
|
||||||
|
"extra-x86_64-build", "-r", str(task_ahriman.paths.chroot), "--", "--", "--skippgpcheck",
|
||||||
|
exception=pytest.helpers.anyvar(int),
|
||||||
|
cwd=local,
|
||||||
|
logger=task_ahriman.logger,
|
||||||
|
user=task_ahriman.uid,
|
||||||
|
environment=environment,
|
||||||
|
),
|
||||||
|
MockCall(
|
||||||
|
"makepkg", "--packagelist",
|
||||||
|
exception=pytest.helpers.anyvar(int),
|
||||||
|
cwd=local,
|
||||||
|
logger=task_ahriman.logger,
|
||||||
|
environment=environment,
|
||||||
|
),
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def test_build_no_debug(task_ahriman: Task, mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must filter debug packages from result
|
||||||
|
"""
|
||||||
|
local = Path("local")
|
||||||
|
check_output_mock = mocker.patch("ahriman.core.build_tools.task.check_output")
|
||||||
|
task_ahriman.include_debug_packages = False
|
||||||
|
|
||||||
|
task_ahriman.build(local)
|
||||||
|
check_output_mock.assert_has_calls([
|
||||||
|
MockCall(
|
||||||
|
"extra-x86_64-build", "-r", str(task_ahriman.paths.chroot), "--", "--", "--skippgpcheck",
|
||||||
|
exception=pytest.helpers.anyvar(int),
|
||||||
|
cwd=local,
|
||||||
|
logger=task_ahriman.logger,
|
||||||
|
user=task_ahriman.uid,
|
||||||
|
environment={},
|
||||||
|
),
|
||||||
|
MockCall(
|
||||||
|
"makepkg", "--packagelist", "OPTIONS=(!debug)",
|
||||||
|
exception=pytest.helpers.anyvar(int),
|
||||||
|
cwd=local,
|
||||||
|
logger=task_ahriman.logger,
|
||||||
|
environment={},
|
||||||
|
),
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
def test_init(task_ahriman: Task, database: SQLite, mocker: MockerFixture) -> None:
|
def test_init(task_ahriman: Task, database: SQLite, mocker: MockerFixture) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user