]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
centos: Write stream dnf variable file when a stream release is used 945/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 4 Apr 2022 12:50:53 +0000 (14:50 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 4 Apr 2022 12:54:14 +0000 (14:54 +0200)
CentOS Stream SIGs use the $stream variable in their repo files to
identify the current CentOS Stream version. Let's make sure we write
this file so that SIG repo files can be copied into mkosi.reposdir
as is without requiring modifications to make them work.

Example SIG repo file using $stream:
https://git.centos.org/rpms/centos-release-hyperscale/blob/c8s-sig-hyperscale/f/SOURCES/CentOS-Stream-Hyperscale.repo

mkosi/__init__.py

index 092ee2eedfd89888459ff2115e5b209d4c6a5585..47f1b1ff93a6e51b12a1a31b7489d5185db6702f 100644 (file)
@@ -2113,6 +2113,9 @@ def setup_dnf(args: MkosiArgs, root: Path, repos: Sequence[Repo] = ()) -> None:
         option = "repodir" if args.distribution == Distribution.photon else "reposdir"
         default_repos  = f"{option}={workspace(root)} {args.repos_dir if args.repos_dir else ''}"
 
+    vars_dir = workspace(root) / "vars"
+    vars_dir.mkdir(exist_ok=True)
+
     config_file = workspace(root) / "dnf.conf"
     config_file.write_text(
         dedent(
@@ -2120,6 +2123,7 @@ def setup_dnf(args: MkosiArgs, root: Path, repos: Sequence[Repo] = ()) -> None:
             [main]
             gpgcheck={'1' if gpgcheck else '0'}
             {default_repos }
+            varsdir={vars_dir}
             """
         )
     )
@@ -2550,6 +2554,9 @@ def install_centos(args: MkosiArgs, root: Path, do_run_build_script: bool) -> No
     else:
         install_centos_stream_repos(args, root, epel_release)
 
+    if "-stream" in args.release:
+        workspace(root).joinpath("vars/stream").write_text(args.release)
+
     packages = {*args.packages}
     add_packages(args, packages, "centos-release", "systemd")
     if not do_run_build_script and args.bootable: