mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-09-09 18:29:55 +00:00
Compare commits
7 Commits
11c8b3f637
...
2.19.1
Author | SHA1 | Date | |
---|---|---|---|
6280c9dbe6 | |||
3d1fdd5517 | |||
ab022071e8 | |||
a01f76df42 | |||
2b1b17a1a3 | |||
9e6705056a | |||
b3a3a81f70 |
12
.github/workflows/release.yml
vendored
12
.github/workflows/release.yml
vendored
@ -13,7 +13,15 @@ jobs:
|
|||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
container:
|
||||||
|
image: archlinux:base
|
||||||
|
options: -w /build
|
||||||
|
volumes:
|
||||||
|
- ${{ github.workspace }}:/build
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- run: pacman --noconfirm -Syu base-devel git python-tox
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Extract version
|
- name: Extract version
|
||||||
@ -27,10 +35,6 @@ jobs:
|
|||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
filter: 'Release \d+\.\d+\.\d+'
|
filter: 'Release \d+\.\d+\.\d+'
|
||||||
|
|
||||||
- uses: ConorMacBride/install-package@v1.1.0
|
|
||||||
with:
|
|
||||||
apt: tox
|
|
||||||
|
|
||||||
- name: Create archive
|
- name: Create archive
|
||||||
run: tox -e archive
|
run: tox -e archive
|
||||||
env:
|
env:
|
||||||
|
9
docs/_static/architecture.dot
vendored
9
docs/_static/architecture.dot
vendored
@ -64,7 +64,7 @@ digraph G {
|
|||||||
ahriman_core_alpm_remote_aur [fillcolor="blue",fontcolor="white",label="ahriman\.\ncore\.\nalpm\.\nremote\.\naur",shape="box"];
|
ahriman_core_alpm_remote_aur [fillcolor="blue",fontcolor="white",label="ahriman\.\ncore\.\nalpm\.\nremote\.\naur",shape="box"];
|
||||||
ahriman_core_alpm_remote_official [fillcolor="blue",fontcolor="white",label="ahriman\.\ncore\.\nalpm\.\nremote\.\nofficial",shape="box"];
|
ahriman_core_alpm_remote_official [fillcolor="blue",fontcolor="white",label="ahriman\.\ncore\.\nalpm\.\nremote\.\nofficial",shape="box"];
|
||||||
ahriman_core_alpm_remote_official_syncdb [fillcolor="blue",fontcolor="white",label="ahriman\.\ncore\.\nalpm\.\nremote\.\nofficial_syncdb",shape="box"];
|
ahriman_core_alpm_remote_official_syncdb [fillcolor="blue",fontcolor="white",label="ahriman\.\ncore\.\nalpm\.\nremote\.\nofficial_syncdb",shape="box"];
|
||||||
ahriman_core_alpm_remote_remote [fillcolor="#ae441e",fontcolor="#ffffff",label="ahriman\.\ncore\.\nalpm\.\nremote\.\nremote"];
|
ahriman_core_alpm_remote_remote [fillcolor="#a5401d",fontcolor="#ffffff",label="ahriman\.\ncore\.\nalpm\.\nremote\.\nremote"];
|
||||||
ahriman_core_alpm_repo [fillcolor="#994d33",fontcolor="#ffffff",label="ahriman\.\ncore\.\nalpm\.\nrepo"];
|
ahriman_core_alpm_repo [fillcolor="#994d33",fontcolor="#ffffff",label="ahriman\.\ncore\.\nalpm\.\nrepo"];
|
||||||
ahriman_core_auth [fillcolor="blue",fontcolor="white",label="ahriman\.\ncore\.\nauth",shape="box"];
|
ahriman_core_auth [fillcolor="blue",fontcolor="white",label="ahriman\.\ncore\.\nauth",shape="box"];
|
||||||
ahriman_core_auth_auth [fillcolor="blue",fontcolor="white",label="ahriman\.\ncore\.\nauth\.\nauth",shape="box"];
|
ahriman_core_auth_auth [fillcolor="blue",fontcolor="white",label="ahriman\.\ncore\.\nauth\.\nauth",shape="box"];
|
||||||
@ -509,9 +509,9 @@ digraph G {
|
|||||||
ahriman_core_alpm_remote_official -> ahriman_core_alpm_remote [fillcolor="blue",minlen="0",weight="4"];
|
ahriman_core_alpm_remote_official -> ahriman_core_alpm_remote [fillcolor="blue",minlen="0",weight="4"];
|
||||||
ahriman_core_alpm_remote_official -> ahriman_core_alpm_remote_official_syncdb [fillcolor="blue",minlen="0",weight="4"];
|
ahriman_core_alpm_remote_official -> ahriman_core_alpm_remote_official_syncdb [fillcolor="blue",minlen="0",weight="4"];
|
||||||
ahriman_core_alpm_remote_official_syncdb -> ahriman_core_alpm_remote [fillcolor="blue",minlen="0",weight="4"];
|
ahriman_core_alpm_remote_official_syncdb -> ahriman_core_alpm_remote [fillcolor="blue",minlen="0",weight="4"];
|
||||||
ahriman_core_alpm_remote_remote -> ahriman_core_alpm_remote [fillcolor="#ae441e",minlen="0",weight="4"];
|
ahriman_core_alpm_remote_remote -> ahriman_core_alpm_remote [fillcolor="#a5401d",minlen="0",weight="4"];
|
||||||
ahriman_core_alpm_remote_remote -> ahriman_core_alpm_remote_aur [fillcolor="#ae441e",minlen="0",weight="4"];
|
ahriman_core_alpm_remote_remote -> ahriman_core_alpm_remote_aur [fillcolor="#a5401d",minlen="0",weight="4"];
|
||||||
ahriman_core_alpm_remote_remote -> ahriman_core_alpm_remote_official [fillcolor="#ae441e",minlen="0",weight="4"];
|
ahriman_core_alpm_remote_remote -> ahriman_core_alpm_remote_official [fillcolor="#a5401d",minlen="0",weight="4"];
|
||||||
ahriman_core_alpm_repo -> ahriman_core_repository_repository_properties [fillcolor="#994d33",minlen="2",weight="2"];
|
ahriman_core_alpm_repo -> ahriman_core_repository_repository_properties [fillcolor="#994d33",minlen="2",weight="2"];
|
||||||
ahriman_core_auth -> ahriman_web_keys [fillcolor="blue",minlen="2"];
|
ahriman_core_auth -> ahriman_web_keys [fillcolor="blue",minlen="2"];
|
||||||
ahriman_core_auth -> ahriman_web_middlewares_auth_handler [fillcolor="blue",minlen="3"];
|
ahriman_core_auth -> ahriman_web_middlewares_auth_handler [fillcolor="blue",minlen="3"];
|
||||||
@ -710,6 +710,7 @@ digraph G {
|
|||||||
ahriman_core_exceptions -> ahriman_core_alpm_remote_aur [fillcolor="#ef4306",minlen="2",weight="2"];
|
ahriman_core_exceptions -> ahriman_core_alpm_remote_aur [fillcolor="#ef4306",minlen="2",weight="2"];
|
||||||
ahriman_core_exceptions -> ahriman_core_alpm_remote_official [fillcolor="#ef4306",minlen="2",weight="2"];
|
ahriman_core_exceptions -> ahriman_core_alpm_remote_official [fillcolor="#ef4306",minlen="2",weight="2"];
|
||||||
ahriman_core_exceptions -> ahriman_core_alpm_remote_official_syncdb [fillcolor="#ef4306",minlen="2",weight="2"];
|
ahriman_core_exceptions -> ahriman_core_alpm_remote_official_syncdb [fillcolor="#ef4306",minlen="2",weight="2"];
|
||||||
|
ahriman_core_exceptions -> ahriman_core_alpm_remote_remote [fillcolor="#ef4306",minlen="2",weight="2"];
|
||||||
ahriman_core_exceptions -> ahriman_core_alpm_repo [fillcolor="#ef4306",minlen="2",weight="2"];
|
ahriman_core_exceptions -> ahriman_core_alpm_repo [fillcolor="#ef4306",minlen="2",weight="2"];
|
||||||
ahriman_core_exceptions -> ahriman_core_auth_oauth [fillcolor="#ef4306",minlen="2",weight="2"];
|
ahriman_core_exceptions -> ahriman_core_auth_oauth [fillcolor="#ef4306",minlen="2",weight="2"];
|
||||||
ahriman_core_exceptions -> ahriman_core_auth_pam [fillcolor="#ef4306",minlen="2",weight="2"];
|
ahriman_core_exceptions -> ahriman_core_auth_pam [fillcolor="#ef4306",minlen="2",weight="2"];
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
pkgbase='ahriman'
|
pkgbase='ahriman'
|
||||||
pkgname=('ahriman' 'ahriman-core' 'ahriman-triggers' 'ahriman-web')
|
pkgname=('ahriman' 'ahriman-core' 'ahriman-triggers' 'ahriman-web')
|
||||||
pkgver=2.18.3
|
pkgver=2.19.1
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="ArcH linux ReposItory MANager"
|
pkgdesc="ArcH linux ReposItory MANager"
|
||||||
arch=('any')
|
arch=('any')
|
||||||
|
@ -55,6 +55,11 @@
|
|||||||
<i class="bi bi-play"></i> update
|
<i class="bi bi-play"></i> update
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<button id="update-repositories-button" class="btn dropdown-item" onclick="refreshDatabases()">
|
||||||
|
<i class="bi bi-arrow-down-circle"></i> update pacman databases
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<button id="package-rebuild-button" class="btn dropdown-item" data-bs-toggle="modal" data-bs-target="#package-rebuild-modal">
|
<button id="package-rebuild-button" class="btn dropdown-item" data-bs-toggle="modal" data-bs-target="#package-rebuild-modal">
|
||||||
<i class="bi bi-arrow-clockwise"></i> rebuild
|
<i class="bi bi-arrow-clockwise"></i> rebuild
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<label class="col-3 col-form-label"></label>
|
<label class="col-3 col-form-label"></label>
|
||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<input id="package-add-refresh-input" type="checkbox" class="form-check-input" value="" checked>
|
<input id="package-add-refresh-input" type="checkbox" class="form-check-input" value="" checked>
|
||||||
<label for="package-add-refresh-input" class="form-check-label">refresh pacman databases</label>
|
<label for="package-add-refresh-input" class="form-check-label">update pacman databases</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
@ -108,16 +108,17 @@
|
|||||||
return {patches: patches};
|
return {patches: patches};
|
||||||
}
|
}
|
||||||
|
|
||||||
function packagesAdd(packages, patches, repository) {
|
function packagesAdd(packages, patches, repository, data) {
|
||||||
packages = packages ?? packageAddInput.value;
|
packages = packages ?? packageAddInput.value;
|
||||||
patches = patches ?? patchesParse();
|
patches = patches ?? patchesParse();
|
||||||
repository = repository ?? getRepositorySelector(packageAddRepositoryInput);
|
repository = repository ?? getRepositorySelector(packageAddRepositoryInput);
|
||||||
const parameters = Object.assign({}, {refresh: packageAddRefreshInput.checked}, patches);
|
data = data ?? {refresh: packageAddRefreshInput.checked};
|
||||||
|
|
||||||
if (packages) {
|
if (packages) {
|
||||||
bootstrap.Modal.getOrCreateInstance(packageAddModal).hide();
|
bootstrap.Modal.getOrCreateInstance(packageAddModal).hide();
|
||||||
const onSuccess = update => `Packages ${update} have been added`;
|
const onSuccess = update => `Packages ${update} have been added`;
|
||||||
const onFailure = error => `Package addition failed: ${error}`;
|
const onFailure = error => `Package addition failed: ${error}`;
|
||||||
|
const parameters = Object.assign({}, data, patches);
|
||||||
doPackageAction("/api/v1/service/add", [packages], repository, onSuccess, onFailure, parameters);
|
doPackageAction("/api/v1/service/add", [packages], repository, onSuccess, onFailure, parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
{% if not auth.enabled or auth.username is not none %}
|
{% if not auth.enabled or auth.username is not none %}
|
||||||
|
<input id="package-info-refresh-input" type="checkbox" class="form-check-input" value="" checked>
|
||||||
|
<label for="package-info-refresh-input" class="form-check-label">update pacman databases</label>
|
||||||
|
|
||||||
<button id="package-info-update-button" type="submit" class="btn btn-success" onclick="packageInfoUpdate()" data-bs-dismiss="modal"><i class="bi bi-play"></i><span class="d-none d-sm-inline"> update</span></button>
|
<button id="package-info-update-button" type="submit" class="btn btn-success" onclick="packageInfoUpdate()" data-bs-dismiss="modal"><i class="bi bi-play"></i><span class="d-none d-sm-inline"> update</span></button>
|
||||||
<button id="package-info-remove-button" type="submit" class="btn btn-danger" onclick="packageInfoRemove()" data-bs-dismiss="modal"><i class="bi bi-trash"></i><span class="d-none d-sm-inline"> remove</span></button>
|
<button id="package-info-remove-button" type="submit" class="btn btn-danger" onclick="packageInfoRemove()" data-bs-dismiss="modal"><i class="bi bi-trash"></i><span class="d-none d-sm-inline"> remove</span></button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -135,6 +138,8 @@
|
|||||||
const packageInfoVariablesBlock = document.getElementById("package-info-variables-block");
|
const packageInfoVariablesBlock = document.getElementById("package-info-variables-block");
|
||||||
const packageInfoVariablesDiv = document.getElementById("package-info-variables-div");
|
const packageInfoVariablesDiv = document.getElementById("package-info-variables-div");
|
||||||
|
|
||||||
|
const packageInfoRefreshInput = document.getElementById("package-info-refresh-input");
|
||||||
|
|
||||||
function clearChart() {
|
function clearChart() {
|
||||||
packageInfoEventsUpdateChartCanvas.hidden = true;
|
packageInfoEventsUpdateChartCanvas.hidden = true;
|
||||||
if (packageInfoEventsUpdateChart) {
|
if (packageInfoEventsUpdateChart) {
|
||||||
@ -404,7 +409,7 @@
|
|||||||
|
|
||||||
function packageInfoUpdate() {
|
function packageInfoUpdate() {
|
||||||
const packageBase = packageInfoModal.package;
|
const packageBase = packageInfoModal.package;
|
||||||
packagesAdd(packageBase, [], repository);
|
packagesAdd(packageBase, [], repository, {refresh: packageInfoRefreshInput.checked});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showPackageInfo(packageBase) {
|
function showPackageInfo(packageBase) {
|
||||||
|
@ -73,6 +73,19 @@
|
|||||||
doPackageAction(url, currentSelection, repository, onSuccess, onFailure);
|
doPackageAction(url, currentSelection, repository, onSuccess, onFailure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function refreshDatabases() {
|
||||||
|
const onSuccess = _ => "Pacman database update has been requested";
|
||||||
|
const onFailure = error => `Could not update pacman databases: ${error}`;
|
||||||
|
const parameters = {
|
||||||
|
refresh: true,
|
||||||
|
aur: false,
|
||||||
|
local: false,
|
||||||
|
manual: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
doPackageAction("/api/v1/service/update", [], repository, onSuccess, onFailure, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
function reload() {
|
function reload() {
|
||||||
table.bootstrapTable("showLoading");
|
table.bootstrapTable("showLoading");
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.TH AHRIMAN "1" "2025\-06\-23" "ahriman 2.18.3" "ArcH linux ReposItory MANager"
|
.TH AHRIMAN "1" "2025\-07\-14" "ahriman 2.19.1" "ArcH linux ReposItory MANager"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
ahriman \- ArcH linux ReposItory MANager
|
ahriman \- ArcH linux ReposItory MANager
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -17,4 +17,4 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
__version__ = "2.18.3"
|
__version__ = "2.19.1"
|
||||||
|
@ -267,7 +267,8 @@ class Pacman(LazyLogging):
|
|||||||
Package: list of packages which were returned by the query
|
Package: list of packages which were returned by the query
|
||||||
"""
|
"""
|
||||||
def is_package_provided(package: Package) -> bool:
|
def is_package_provided(package: Package) -> bool:
|
||||||
return package_name in package.provides
|
provides = [trim_package(name) for name in package.provides]
|
||||||
|
return package_name in provides
|
||||||
|
|
||||||
for database in self.handle.get_syncdbs():
|
for database in self.handle.get_syncdbs():
|
||||||
yield from filter(is_package_provided, database.search(package_name))
|
yield from filter(is_package_provided, database.search(package_name))
|
||||||
|
@ -146,7 +146,7 @@ class AUR(Remote):
|
|||||||
# search api provides reduced models
|
# search api provides reduced models
|
||||||
for stub in self.package_search(package_name, pacman=pacman, search_by="provides")
|
for stub in self.package_search(package_name, pacman=pacman, search_by="provides")
|
||||||
# verity that found package actually provides it
|
# verity that found package actually provides it
|
||||||
if package_name in (package := self.package_info(stub.package_base, pacman=pacman)).provides
|
if package_name in (package := self.package_info(stub.name, pacman=pacman)).provides
|
||||||
]
|
]
|
||||||
|
|
||||||
def package_search(self, *keywords: str, pacman: Pacman | None, search_by: str | None) -> list[AURPackage]:
|
def package_search(self, *keywords: str, pacman: Pacman | None, search_by: str | None) -> list[AURPackage]:
|
||||||
|
@ -203,6 +203,8 @@ def migrate_package_repository(connection: Connection, configuration: Configurat
|
|||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
"""
|
"""
|
||||||
_, repository_id = configuration.check_loaded()
|
_, repository_id = configuration.check_loaded()
|
||||||
|
if repository_id.is_empty:
|
||||||
|
return # no repository available yet
|
||||||
|
|
||||||
connection.execute("""update build_queue set repository = :repository""", {"repository": repository_id.id})
|
connection.execute("""update build_queue set repository = :repository""", {"repository": repository_id.id})
|
||||||
connection.execute("""update package_bases set repository = :repository""", {"repository": repository_id.id})
|
connection.execute("""update package_bases set repository = :repository""", {"repository": repository_id.id})
|
||||||
|
@ -25,7 +25,7 @@ from dataclasses import dataclass, field, fields
|
|||||||
from pyalpm import Package # type: ignore[import-not-found]
|
from pyalpm import Package # type: ignore[import-not-found]
|
||||||
from typing import Any, Self
|
from typing import Any, Self
|
||||||
|
|
||||||
from ahriman.core.utils import filter_json, full_version
|
from ahriman.core.utils import filter_json, full_version, trim_package
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True, kw_only=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
@ -103,6 +103,17 @@ class AURPackage:
|
|||||||
keywords: list[str] = field(default_factory=list)
|
keywords: list[str] = field(default_factory=list)
|
||||||
groups: list[str] = field(default_factory=list)
|
groups: list[str] = field(default_factory=list)
|
||||||
|
|
||||||
|
def __post_init__(self) -> None:
|
||||||
|
"""
|
||||||
|
update packages lists accordingly
|
||||||
|
"""
|
||||||
|
object.__setattr__(self, "depends", [trim_package(package) for package in self.depends])
|
||||||
|
object.__setattr__(self, "make_depends", [trim_package(package) for package in self.make_depends])
|
||||||
|
object.__setattr__(self, "opt_depends", [trim_package(package) for package in self.opt_depends])
|
||||||
|
object.__setattr__(self, "check_depends", [trim_package(package) for package in self.check_depends])
|
||||||
|
object.__setattr__(self, "conflicts", [trim_package(package) for package in self.conflicts])
|
||||||
|
object.__setattr__(self, "provides", [trim_package(package) for package in self.provides])
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_json(cls, dump: dict[str, Any]) -> Self:
|
def from_json(cls, dump: dict[str, Any]) -> Self:
|
||||||
"""
|
"""
|
||||||
|
@ -83,12 +83,13 @@ class PackageDescription:
|
|||||||
|
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
"""
|
"""
|
||||||
update dependencies list accordingly
|
update packages lists accordingly
|
||||||
"""
|
"""
|
||||||
self.depends = [trim_package(package) for package in self.depends]
|
self.depends = [trim_package(package) for package in self.depends]
|
||||||
self.opt_depends = [trim_package(package) for package in self.opt_depends]
|
|
||||||
self.make_depends = [trim_package(package) for package in self.make_depends]
|
self.make_depends = [trim_package(package) for package in self.make_depends]
|
||||||
|
self.opt_depends = [trim_package(package) for package in self.opt_depends]
|
||||||
self.check_depends = [trim_package(package) for package in self.check_depends]
|
self.check_depends = [trim_package(package) for package in self.check_depends]
|
||||||
|
self.provides = [trim_package(package) for package in self.provides]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def filepath(self) -> Path | None:
|
def filepath(self) -> Path | None:
|
||||||
|
@ -289,3 +289,4 @@ def test_package_provided_by(pacman: Pacman) -> None:
|
|||||||
must search through the provides lists
|
must search through the provides lists
|
||||||
"""
|
"""
|
||||||
assert list(pacman.provided_by("sh"))
|
assert list(pacman.provided_by("sh"))
|
||||||
|
assert list(pacman.provided_by("libacl.so")) # case with exact version
|
||||||
|
@ -6,6 +6,7 @@ from unittest.mock import call as MockCall
|
|||||||
|
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.database.migrations.m011_repository_name import migrate_data, migrate_package_repository, steps
|
from ahriman.core.database.migrations.m011_repository_name import migrate_data, migrate_package_repository, steps
|
||||||
|
from ahriman.models.repository_id import RepositoryId
|
||||||
|
|
||||||
|
|
||||||
def test_migration_repository_name() -> None:
|
def test_migration_repository_name() -> None:
|
||||||
@ -37,3 +38,13 @@ def test_migrate_package_repository(connection: Connection, configuration: Confi
|
|||||||
MockCall(pytest.helpers.anyvar(str, strict=True), {"repository": configuration.repository_id.id}),
|
MockCall(pytest.helpers.anyvar(str, strict=True), {"repository": configuration.repository_id.id}),
|
||||||
MockCall(pytest.helpers.anyvar(str, strict=True), {"repository": configuration.repository_id.id}),
|
MockCall(pytest.helpers.anyvar(str, strict=True), {"repository": configuration.repository_id.id}),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def test_migrate_package_repository_empty_id(connection: Connection, configuration: Configuration,
|
||||||
|
mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must do nothing on empty repository id
|
||||||
|
"""
|
||||||
|
mocker.patch("ahriman.core.configuration.Configuration.check_loaded", return_value=("", RepositoryId("", "")))
|
||||||
|
migrate_package_repository(connection, configuration)
|
||||||
|
connection.execute.assert_not_called()
|
||||||
|
@ -2,7 +2,7 @@ import datetime
|
|||||||
import json
|
import json
|
||||||
import pyalpm # typing: ignore
|
import pyalpm # typing: ignore
|
||||||
|
|
||||||
from dataclasses import asdict, fields
|
from dataclasses import asdict, fields, replace
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -38,6 +38,25 @@ def _get_official_data(resource_path_root: Path) -> dict[str, Any]:
|
|||||||
return json.loads(response)["results"][0]
|
return json.loads(response)["results"][0]
|
||||||
|
|
||||||
|
|
||||||
|
def test_post_init(aur_package_ahriman: AURPackage) -> None:
|
||||||
|
"""
|
||||||
|
must trim versions and descriptions from packages list
|
||||||
|
"""
|
||||||
|
package = replace(
|
||||||
|
aur_package_ahriman,
|
||||||
|
depends=["a=1"],
|
||||||
|
make_depends=["b>=3"],
|
||||||
|
opt_depends=["c: a description"],
|
||||||
|
check_depends=["d=4"],
|
||||||
|
provides=["e=5"],
|
||||||
|
)
|
||||||
|
assert package.depends == ["a"]
|
||||||
|
assert package.make_depends == ["b"]
|
||||||
|
assert package.opt_depends == ["c"]
|
||||||
|
assert package.check_depends == ["d"]
|
||||||
|
assert package.provides == ["e"]
|
||||||
|
|
||||||
|
|
||||||
def test_from_json(aur_package_ahriman: AURPackage, resource_path_root: Path) -> None:
|
def test_from_json(aur_package_ahriman: AURPackage, resource_path_root: Path) -> None:
|
||||||
"""
|
"""
|
||||||
must load package from json
|
must load package from json
|
||||||
|
@ -6,10 +6,15 @@ from ahriman.models.package_description import PackageDescription
|
|||||||
|
|
||||||
def test_post_init() -> None:
|
def test_post_init() -> None:
|
||||||
"""
|
"""
|
||||||
must trim versions and descriptions from dependencies list
|
must trim versions and descriptions from packages list
|
||||||
"""
|
"""
|
||||||
assert PackageDescription(depends=["a=1"], make_depends=["b>=3"], opt_depends=["c: a description"]) == \
|
assert PackageDescription(
|
||||||
PackageDescription(depends=["a"], make_depends=["b"], opt_depends=["c"])
|
depends=["a=1"],
|
||||||
|
make_depends=["b>=3"],
|
||||||
|
opt_depends=["c: a description"],
|
||||||
|
check_depends=["d=4"],
|
||||||
|
provides=["e=5"]
|
||||||
|
) == PackageDescription(depends=["a"], make_depends=["b"], opt_depends=["c"], check_depends=["d"], provides=["e"])
|
||||||
|
|
||||||
|
|
||||||
def test_filepath(package_description_ahriman: PackageDescription) -> None:
|
def test_filepath(package_description_ahriman: PackageDescription) -> None:
|
||||||
|
Reference in New Issue
Block a user