From: Daan De Meyer Date: Fri, 26 Jan 2024 10:50:37 +0000 (+0100) Subject: pacman: Make sure we pass packages to repo-add in right order X-Git-Tag: v21~80^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7e8d698bcc72b6086bda4ac89901e07214006fe;p=thirdparty%2Fmkosi.git pacman: Make sure we pass packages to repo-add in right order According to https://wiki.archlinux.org/title/pacman/Tips_and_tricks, the newest version has to be added last, so let's make sure we sort the paths we pass to repo-add. --- diff --git a/mkosi/installer/pacman.py b/mkosi/installer/pacman.py index 1669d6613..019fc7ed4 100644 --- a/mkosi/installer/pacman.py +++ b/mkosi/installer/pacman.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1+ import textwrap from collections.abc import Iterable, Sequence +from pathlib import Path from typing import NamedTuple from mkosi.context import Context @@ -10,6 +11,7 @@ from mkosi.run import run from mkosi.sandbox import apivfs_cmd from mkosi.types import PathString from mkosi.util import sort_packages, umask +from mkosi.versioncomp import GenericVersion class PacmanRepository(NamedTuple): @@ -110,7 +112,13 @@ def invoke_pacman( def createrepo_pacman(context: Context) -> None: - run(["repo-add", context.packages / "mkosi-packages.db.tar", *context.packages.glob("*.pkg.tar*")]) + run( + [ + "repo-add", + context.packages / "mkosi-packages.db.tar", + *sorted(context.packages.glob("*.pkg.tar*"), key=lambda p: GenericVersion(Path(p).name)), + ] + ) with (context.pkgmngr / "etc/pacman.conf").open("a") as f: f.write(