Compare commits

...

3 Commits

Author SHA1 Message Date
db46147f0d fix: mount archive to chroot
while file:// repository is automatically mounted by devtools, it
doesn't mount any directory which contains source of symlinks

This commit adds implicit mount of the archive directory (ro) into
chroot
2026-03-03 15:50:21 +02:00
49ebbc34fa fix: do not update package status if it is unchanged
In order to prevent timestamp bumps, filter by status is added
2026-02-24 15:33:06 +02:00
e376f1307f docs: remove required flag from email.template_full option 2026-02-22 02:57:34 +02:00
5 changed files with 34 additions and 12 deletions

View File

@@ -110,7 +110,7 @@ class Task(LazyLogging):
""" """
command = [self.build_command, "-r", str(self.paths.chroot)] command = [self.build_command, "-r", str(self.paths.chroot)]
command.extend(self.archbuild_flags) command.extend(self.archbuild_flags)
command.extend(["--"] + self.makechrootpkg_flags) command.extend(["--", "-D", str(self.paths.archive)] + self.makechrootpkg_flags)
command.extend(["--"] + self.makepkg_flags) command.extend(["--"] + self.makepkg_flags)
if dry_run: if dry_run:
command.extend(["--nobuild"]) command.extend(["--nobuild"])

View File

@@ -292,6 +292,7 @@ class PackageOperations(Operations):
(:package_base, :status, :last_updated, :repository) (:package_base, :status, :last_updated, :repository)
on conflict (package_base, repository) do update set on conflict (package_base, repository) do update set
status = :status, last_updated = :last_updated status = :status, last_updated = :last_updated
where status != :status
""", """,
{ {
"package_base": package_base, "package_base": package_base,

View File

@@ -131,7 +131,6 @@ class ReportTrigger(Trigger):
"template_full": { "template_full": {
"type": "string", "type": "string",
"dependencies": ["templates"], "dependencies": ["templates"],
"required": True,
"empty": False, "empty": False,
}, },
"templates": { "templates": {

View File

@@ -53,7 +53,10 @@ def test_build(task_ahriman: Task, mocker: MockerFixture) -> None:
assert task_ahriman.build(local) == [task_ahriman.package.base] assert task_ahriman.build(local) == [task_ahriman.package.base]
check_output_mock.assert_called_once_with( check_output_mock.assert_called_once_with(
"extra-x86_64-build", "-r", str(task_ahriman.paths.chroot), "--", "--", "--skippgpcheck", "extra-x86_64-build",
"-r", str(task_ahriman.paths.chroot),
"--", "-D", str(task_ahriman.paths.archive),
"--", "--skippgpcheck",
exception=pytest.helpers.anyvar(int), exception=pytest.helpers.anyvar(int),
cwd=local, cwd=local,
logger=task_ahriman.logger, logger=task_ahriman.logger,
@@ -76,7 +79,10 @@ def test_build_environment(task_ahriman: Task, mocker: MockerFixture) -> None:
task_ahriman.build(local, **environment, empty=None) task_ahriman.build(local, **environment, empty=None)
check_output_mock.assert_called_once_with( check_output_mock.assert_called_once_with(
"extra-x86_64-build", "-r", str(task_ahriman.paths.chroot), "--", "--", "--skippgpcheck", "extra-x86_64-build",
"-r", str(task_ahriman.paths.chroot),
"--", "-D", str(task_ahriman.paths.archive),
"--", "--skippgpcheck",
exception=pytest.helpers.anyvar(int), exception=pytest.helpers.anyvar(int),
cwd=local, cwd=local,
logger=task_ahriman.logger, logger=task_ahriman.logger,
@@ -96,7 +102,11 @@ def test_build_dry_run(task_ahriman: Task, mocker: MockerFixture) -> None:
assert task_ahriman.build(local, dry_run=True) == [task_ahriman.package.base] assert task_ahriman.build(local, dry_run=True) == [task_ahriman.package.base]
check_output_mock.assert_called_once_with( check_output_mock.assert_called_once_with(
"extra-x86_64-build", "-r", str(task_ahriman.paths.chroot), "--", "--", "--skippgpcheck", "--nobuild", "extra-x86_64-build",
"-r", str(task_ahriman.paths.chroot),
"--", "-D", str(task_ahriman.paths.archive),
"--", "--skippgpcheck",
"--nobuild",
exception=pytest.helpers.anyvar(int), exception=pytest.helpers.anyvar(int),
cwd=local, cwd=local,
logger=task_ahriman.logger, logger=task_ahriman.logger,

View File

@@ -157,8 +157,7 @@ def test_package_update_get(database: SQLite, package_ahriman: Package) -> None:
database.package_update(package_ahriman) database.package_update(package_ahriman)
database.status_update(package_ahriman.base, status) database.status_update(package_ahriman.base, status)
assert next((db_package, db_status) assert next((db_package, db_status)
for db_package, db_status in database.packages_get() for db_package, db_status in database.packages_get()) == (package_ahriman, status)
if db_package.base == package_ahriman.base) == (package_ahriman, status)
def test_package_update_remove_get(database: SQLite, package_ahriman: Package) -> None: def test_package_update_remove_get(database: SQLite, package_ahriman: Package) -> None:
@@ -176,10 +175,10 @@ def test_package_update_update(database: SQLite, package_ahriman: Package) -> No
""" """
database.package_update(package_ahriman) database.package_update(package_ahriman)
package_ahriman.version = "1.0.0" package_ahriman.version = "1.0.0"
database.package_update(package_ahriman) database.package_update(package_ahriman)
assert next(db_package.version assert next(db_package.version
for db_package, _ in database.packages_get() for db_package, _ in database.packages_get()) == package_ahriman.version
if db_package.base == package_ahriman.base) == package_ahriman.version
def test_status_update(database: SQLite, package_ahriman: Package) -> None: def test_status_update(database: SQLite, package_ahriman: Package) -> None:
@@ -188,6 +187,19 @@ def test_status_update(database: SQLite, package_ahriman: Package) -> None:
""" """
status = BuildStatus() status = BuildStatus()
database.package_update(package_ahriman, database._repository_id) database.package_update(package_ahriman)
database.status_update(package_ahriman.base, status, database._repository_id) database.status_update(package_ahriman.base, status)
assert database.packages_get(database._repository_id) == [(package_ahriman, status)] assert database.packages_get() == [(package_ahriman, status)]
def test_status_update_skip_same_status(database: SQLite, package_ahriman: Package) -> None:
"""
must preserve original timestamp when status is unchanged
"""
status = BuildStatus(timestamp=42)
database.package_update(package_ahriman)
database.status_update(package_ahriman.base, status)
database.status_update(package_ahriman.base, BuildStatus())
assert next(db_status.timestamp
for _, db_status in database.packages_get()) == status.timestamp