Compare commits

...

4 Commits

Author SHA1 Message Date
517337144c fix: bump pkgrel if the local version is newer than remote
In case of VCS packages, if PKGBUILD contains older version, the pkgrel
remains the same during the rebuild process. This fix bumps pkgrel in
any case if the local version is newer than the remote
2024-09-23 16:30:33 +03:00
db89ad46b7 build: reduce docker image size 2024-09-23 14:37:36 +03:00
9fc1c53c3d docs: update web preview picture 2024-09-23 14:03:12 +03:00
cd61ab3e5b fix: allow colon in options interpolation 2024-09-23 13:52:49 +03:00
7 changed files with 14 additions and 11 deletions

View File

@ -54,7 +54,6 @@ RUN pacman -S --noconfirm --asdeps \
python-cerberus \ python-cerberus \
python-cryptography \ python-cryptography \
python-jinja \ python-jinja \
python-matplotlib \
python-systemd \ python-systemd \
rsync \ rsync \
&& \ && \

View File

@ -52,7 +52,7 @@ class ShellInterpolator(configparser.Interpolation):
def identifiers() -> Generator[tuple[str | None, str], None, None]: def identifiers() -> Generator[tuple[str | None, str], None, None]:
# extract all found identifiers and parse them # extract all found identifiers and parse them
for identifier in ShellTemplate(value).get_identifiers(): for identifier in ShellTemplate(value).get_identifiers():
match identifier.split(":"): match identifier.rsplit(":", maxsplit=1):
case [lookup_option]: # single option from the same section case [lookup_option]: # single option from the same section
yield None, lookup_option yield None, lookup_option
case [lookup_section, lookup_option]: # reference to another section case [lookup_section, lookup_option]: # reference to another section

View File

@ -538,14 +538,10 @@ class Package(LazyLogging):
if local_version is None: if local_version is None:
return None # local version not found, keep upstream pkgrel return None # local version not found, keep upstream pkgrel
epoch, pkgver, _ = parse_version(self.version)
local_epoch, local_pkgver, local_pkgrel = parse_version(local_version)
if epoch != local_epoch or pkgver != local_pkgver:
return None # epoch or pkgver are different, keep upstream pkgrel
if vercmp(self.version, local_version) > 0: if vercmp(self.version, local_version) > 0:
return None # upstream version is newer than local one, keep upstream pkgrel return None # upstream version is newer than local one, keep upstream pkgrel
*_, local_pkgrel = parse_version(local_version)
if "." in local_pkgrel: if "." in local_pkgrel:
major, minor = local_pkgrel.rsplit(".", maxsplit=1) major, minor = local_pkgrel.rsplit(".", maxsplit=1)
else: else:

View File

@ -134,9 +134,10 @@ def test_init_bump_pkgrel_skip(task_ahriman: Task, mocker: MockerFixture) -> Non
""" """
must keep pkgrel if version is different from provided must keep pkgrel if version is different from provided
""" """
task_ahriman.package.version = "2.0.0-1"
mocker.patch("ahriman.models.package.Package.from_build", return_value=task_ahriman.package) mocker.patch("ahriman.models.package.Package.from_build", return_value=task_ahriman.package)
mocker.patch("ahriman.core.build_tools.sources.Sources.load", return_value="sha") mocker.patch("ahriman.core.build_tools.sources.Sources.load", return_value="sha")
write_mock = mocker.patch("ahriman.models.pkgbuild_patch.PkgbuildPatch.write") write_mock = mocker.patch("ahriman.models.pkgbuild_patch.PkgbuildPatch.write")
assert task_ahriman.init(Path("ahriman"), [], f"2:{task_ahriman.package.version}") == "sha" assert task_ahriman.init(Path("ahriman"), [], "1.0.0-1") == "sha"
write_mock.assert_not_called() write_mock.assert_not_called()

View File

@ -24,6 +24,9 @@ def _parser() -> dict[str, dict[str, str]]:
"key3": "${section1:home}", "key3": "${section1:home}",
"key5": "${section1:key4}", "key5": "${section1:key4}",
}, },
"section4:suffix": {
"key6": "value6"
},
} }
@ -45,6 +48,10 @@ def test_extract_variables() -> None:
assert not dict(ShellInterpolator._extract_variables(parser, "${section4:key1}", parser["section1"])) assert not dict(ShellInterpolator._extract_variables(parser, "${section4:key1}", parser["section1"]))
assert dict(ShellInterpolator._extract_variables(parser, "${section4:suffix:key6}", parser["section1"])) == {
"section4:suffix:key6": "value6",
}
def test_environment() -> None: def test_environment() -> None:
""" """

View File

@ -474,11 +474,11 @@ def test_next_pkgrel(package_ahriman: Package) -> None:
assert package_ahriman.next_pkgrel(package_ahriman.version) == "1.2.2" assert package_ahriman.next_pkgrel(package_ahriman.version) == "1.2.2"
package_ahriman.version = "1:1.0.0-1" package_ahriman.version = "1:1.0.0-1"
assert package_ahriman.next_pkgrel("1:1.0.1-1") is None assert package_ahriman.next_pkgrel("1:1.0.1-1") == "1.1"
assert package_ahriman.next_pkgrel("2:1.0.0-1") is None assert package_ahriman.next_pkgrel("2:1.0.0-1") == "1.1"
package_ahriman.version = "1.0.0-1.1" package_ahriman.version = "1.0.0-1.1"
assert package_ahriman.next_pkgrel("1.0.1-2") is None assert package_ahriman.next_pkgrel("1.0.1-2") == "2.1"
assert package_ahriman.next_pkgrel("1.0.0-2") == "2.1" assert package_ahriman.next_pkgrel("1.0.0-2") == "2.1"
package_ahriman.version = "1.0.0-2" package_ahriman.version = "1.0.0-2"

BIN
web.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 KiB

After

Width:  |  Height:  |  Size: 370 KiB