]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
pacman: Make sure repositories from dropins take priority 3275/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 13 Dec 2024 11:58:16 +0000 (12:58 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 13 Dec 2024 13:27:14 +0000 (14:27 +0100)
When multiple repositories ship the same package, the repository
defined first in the pacman config file takes priority. Let's make
sure user defined repositories take priority over the ones defined
in mkosi by moving the Include= statement up a little in the config
file.

mkosi/installer/pacman.py

index 3f120492fe4a31222a03294a420259c1e6058ac1..e7db0a8313d1e280ee83836dea80431afc7608d0 100644 (file)
@@ -119,23 +119,23 @@ class Pacman(PackageManager):
             # This has to go first so that our local repository always takes precedence over any other ones.
             f.write("Include = /etc/mkosi-local.conf\n")
 
-            for repo in repositories:
+            if any((context.sandbox_tree / "etc/pacman.d/").glob("*.conf")):
                 f.write(
                     textwrap.dedent(
-                        f"""\
+                        """\
 
-                        [{repo.id}]
-                        Server = {repo.url}
+                        Include = /etc/pacman.d/*.conf
                         """
                     )
                 )
 
-            if any((context.sandbox_tree / "etc/pacman.d/").glob("*.conf")):
+            for repo in repositories:
                 f.write(
                     textwrap.dedent(
-                        """\
+                        f"""\
 
-                        Include = /etc/pacman.d/*.conf
+                        [{repo.id}]
+                        Server = {repo.url}
                         """
                     )
                 )