mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-10-20 19:47:58 +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
|
# process already built packages if any
|
||||||
if built_packages := self.repository.packages_built(): # speedup a bit
|
if built_packages := self.repository.packages_built(): # speedup a bit
|
||||||
build_result = self.repository.process_update(built_packages, packagers)
|
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)
|
self.on_result(build_result)
|
||||||
result.merge(build_result)
|
result.merge(build_result)
|
||||||
|
|
||||||
@@ -172,6 +174,8 @@ class ApplicationRepository(ApplicationProperties):
|
|||||||
for num, partition in enumerate(partitions):
|
for num, partition in enumerate(partitions):
|
||||||
self.logger.info("processing chunk #%i %s", num, [package.base for package in partition])
|
self.logger.info("processing chunk #%i %s", num, [package.base for package in partition])
|
||||||
build_result = builder.update(partition, packagers, bump_pkgrel=bump_pkgrel)
|
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)
|
self.on_result(build_result)
|
||||||
result.merge(build_result)
|
result.merge(build_result)
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,6 @@ class UpdateHandler(PackageInfo, Cleaner):
|
|||||||
self.reporter.set_pending(local.base)
|
self.reporter.set_pending(local.base)
|
||||||
self.event(local.base, EventType.PackageOutdated, "Manual update is requested")
|
self.event(local.base, EventType.PackageOutdated, "Manual update is requested")
|
||||||
|
|
||||||
self.clear_queue()
|
|
||||||
except Exception:
|
except Exception:
|
||||||
self.logger.exception("could not load packages from database")
|
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
|
must process package updates
|
||||||
"""
|
"""
|
||||||
|
application_repository.database.build_queue_insert(package_ahriman)
|
||||||
paths = [package.filepath for package in package_ahriman.packages.values()]
|
paths = [package.filepath for package in package_ahriman.packages.values()]
|
||||||
tree = Tree([Leaf(package_ahriman)])
|
tree = Tree([Leaf(package_ahriman)])
|
||||||
prebuilt_result = Result()
|
prebuilt_result = Result()
|
||||||
@@ -207,12 +208,15 @@ def test_update(application_repository: ApplicationRepository, package_ahriman:
|
|||||||
update_mock.assert_called_once_with(paths, Packagers("username"))
|
update_mock.assert_called_once_with(paths, Packagers("username"))
|
||||||
on_result_mock.assert_has_calls([MockCall(prebuilt_result), MockCall(result)])
|
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,
|
def test_update_prebuilt_filter(application_repository: ApplicationRepository, package_ahriman: Package, result: Result,
|
||||||
mocker: MockerFixture) -> None:
|
mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must filter out packages which were successfully prebuilt
|
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()]
|
paths = [package.filepath for package in package_ahriman.packages.values()]
|
||||||
|
|
||||||
resolve_mock = mocker.patch("ahriman.application.application.workers.local_updater.LocalUpdater.partition",
|
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)
|
application_repository.update([package_ahriman], Packagers("username"), bump_pkgrel=True)
|
||||||
resolve_mock.assert_called_once_with([])
|
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,
|
def test_update_empty(application_repository: ApplicationRepository, package_ahriman: Package, result: Result,
|
||||||
mocker: MockerFixture) -> None:
|
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) == []
|
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=[])
|
update_handler.database.build_queue_insert(package_ahriman)
|
||||||
mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.packages")
|
mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.packages", return_value=[package_ahriman])
|
||||||
|
|
||||||
update_handler.updates_manual()
|
assert update_handler.updates_manual() == [package_ahriman]
|
||||||
|
assert update_handler.database.build_queue_get() == [package_ahriman]
|
||||||
from ahriman.core.repository.cleaner import Cleaner
|
|
||||||
Cleaner.clear_queue.assert_called_once_with()
|
|
||||||
|
|
||||||
|
|
||||||
def test_updates_manual_status_known(update_handler: UpdateHandler, package_ahriman: Package,
|
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.
|
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
|
Update packages
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user