mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-10-18 18:58:03 +00:00
feat: only remove packages from build queue which were actually built
This commit is contained in:
1 parent
4537969d5d
commit
b73be7abcc
5 files changed
+19
-9
No files matched your search
@@ -158,6 +158,8 @@ class ApplicationRepository(ApplicationProperties):
|
||||
# process already built packages if any
|
||||
if built_packages := self.repository.packages_built(): # speedup a bit
|
||||
build_result = self.repository.process_update(built_packages, packagers)
|
||||
for package in build_result.success:
|
||||
self.database.build_queue_clear(package.base)
|
||||
self.on_result(build_result)
|
||||
result.merge(build_result)
|
||||
|
||||
@@ -172,6 +174,8 @@ class ApplicationRepository(ApplicationProperties):
|
||||
for num, partition in enumerate(partitions):
|
||||
self.logger.info("processing chunk #%i %s", num, [package.base for package in partition])
|
||||
build_result = builder.update(partition, packagers, bump_pkgrel=bump_pkgrel)
|
||||
for package in partition:
|
||||
self.database.build_queue_clear(package.base)
|
||||
self.on_result(build_result)
|
||||
result.merge(build_result)
|
||||
|
||||
|
||||
@@ -212,7 +212,6 @@ class UpdateHandler(PackageInfo, Cleaner):
|
||||
self.reporter.set_pending(local.base)
|
||||
self.event(local.base, EventType.PackageOutdated, "Manual update is requested")
|
||||
|
||||
self.clear_queue()
|
||||
except Exception:
|
||||
self.logger.exception("could not load packages from database")
|
||||
|
||||
|
||||
@@ -188,6 +188,7 @@ def test_update(application_repository: ApplicationRepository, package_ahriman:
|
||||
"""
|
||||
must process package updates
|
||||
"""
|
||||
application_repository.database.build_queue_insert(package_ahriman)
|
||||
paths = [package.filepath for package in package_ahriman.packages.values()]
|
||||
tree = Tree([Leaf(package_ahriman)])
|
||||
prebuilt_result = Result()
|
||||
@@ -207,12 +208,15 @@ def test_update(application_repository: ApplicationRepository, package_ahriman:
|
||||
update_mock.assert_called_once_with(paths, Packagers("username"))
|
||||
on_result_mock.assert_has_calls([MockCall(prebuilt_result), MockCall(result)])
|
||||
|
||||
assert application_repository.database.build_queue_get() == []
|
||||
|
||||
|
||||
def test_update_prebuilt_filter(application_repository: ApplicationRepository, package_ahriman: Package, result: Result,
|
||||
mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must filter out packages which were successfully prebuilt
|
||||
"""
|
||||
application_repository.database.build_queue_insert(package_ahriman)
|
||||
paths = [package.filepath for package in package_ahriman.packages.values()]
|
||||
|
||||
resolve_mock = mocker.patch("ahriman.application.application.workers.local_updater.LocalUpdater.partition",
|
||||
@@ -224,6 +228,8 @@ def test_update_prebuilt_filter(application_repository: ApplicationRepository, p
|
||||
application_repository.update([package_ahriman], Packagers("username"), bump_pkgrel=True)
|
||||
resolve_mock.assert_called_once_with([])
|
||||
|
||||
assert application_repository.database.build_queue_get() == []
|
||||
|
||||
|
||||
def test_update_empty(application_repository: ApplicationRepository, package_ahriman: Package, result: Result,
|
||||
mocker: MockerFixture) -> None:
|
||||
|
||||
@@ -361,17 +361,16 @@ def test_updates_local_held_metadata(update_handler: UpdateHandler, package_ahri
|
||||
assert update_handler.updates_local(vcs=True) == []
|
||||
|
||||
|
||||
def test_updates_manual_clear(update_handler: UpdateHandler, mocker: MockerFixture) -> None:
|
||||
def test_updates_manual_preserves_queue(update_handler: UpdateHandler, package_ahriman: Package,
|
||||
mocker: MockerFixture) -> None:
|
||||
"""
|
||||
requesting manual updates must clear packages directory
|
||||
discovery must leave manual requests queued for execution
|
||||
"""
|
||||
mocker.patch("pathlib.Path.iterdir", return_value=[])
|
||||
mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.packages")
|
||||
update_handler.database.build_queue_insert(package_ahriman)
|
||||
mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.packages", return_value=[package_ahriman])
|
||||
|
||||
update_handler.updates_manual()
|
||||
|
||||
from ahriman.core.repository.cleaner import Cleaner
|
||||
Cleaner.clear_queue.assert_called_once_with()
|
||||
assert update_handler.updates_manual() == [package_ahriman]
|
||||
assert update_handler.database.build_queue_get() == [package_ahriman]
|
||||
|
||||
|
||||
def test_updates_manual_status_known(update_handler: UpdateHandler, package_ahriman: Package,
|
||||
|
||||
@@ -259,6 +259,8 @@ There are few ways for packages to be marked as out-of-date and hence requiring
|
||||
|
||||
Held packages and bases listed in ``build.ignore_packages`` are excluded from automatic AUR, official-repository, local-source, and broken-dependency update checks. These checks leave their package status unchanged. Manual updates and explicit rebuilds remain available.
|
||||
|
||||
Reading manual updates, including during ``repo-update --dry-run``, leaves the build queue intact. Execution removes requests by package base after a build chunk returns or a remote worker accepts it; successful prebuilt imports also remove requests by package base. Interrupted chunks and work that was not selected remain queued. Concurrent requests for the same package base are not distinguished; request revisions and crash recovery are separate work.
|
||||
|
||||
Update packages
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
Reference in new issue
Block a user