From f9184799dec7a33574e4e98d74922a60fbc1a530 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Jul 26 2024 15:06:23 +0000
Subject: [PATCH 1/2] Use conditional includes to separate bootable containers


Refactor how we differentiate bootable containers variants from classic
ostree ones using conditional includes.

See: https://coreos.github.io/rpm-ostree/treefile/

---

diff --git a/base-atomic.yaml b/base-atomic.yaml
index d0d3ac7..80df8b4 100644
--- a/base-atomic.yaml
+++ b/base-atomic.yaml
@@ -1,6 +1,9 @@
+variables:
+  bootable_container: true
+  variant: "base-atomic"
+
 include:
   - common.yaml
-  - common-bootable-containers.yaml
 
 ref: fedora/rawhide/${basearch}/base
 rojig:
diff --git a/bootc.yaml b/bootc.yaml
new file mode 100644
index 0000000..91a4aa3
--- /dev/null
+++ b/bootc.yaml
@@ -0,0 +1,4 @@
+# Add bootc for Bootable Container images
+# See: https://fedoraproject.org/wiki/Changes/DNFAndBootcInImageModeFedora
+packages:
+  - bootc
diff --git a/budgie-atomic-common.yaml b/budgie-atomic-common.yaml
index a5b3663..fd4fe39 100644
--- a/budgie-atomic-common.yaml
+++ b/budgie-atomic-common.yaml
@@ -1,3 +1,6 @@
+variables:
+  variant: "budgie-atomic"
+
 include:
   - common.yaml
   - budgie-atomic-packages.yaml
diff --git a/budgie-atomic-ostree.yaml b/budgie-atomic-ostree.yaml
index eda47b9..6ca0f61 100644
--- a/budgie-atomic-ostree.yaml
+++ b/budgie-atomic-ostree.yaml
@@ -1,6 +1,8 @@
+variables:
+  bootable_container: false
+
 include:
   - budgie-atomic-common.yaml
-  - common-ostree.yaml
 
 # Kept in the leaf manifest as they are overwritten by Pungi in composes
 repos:
diff --git a/budgie-atomic.yaml b/budgie-atomic.yaml
index 9dd3d46..bb0d843 100644
--- a/budgie-atomic.yaml
+++ b/budgie-atomic.yaml
@@ -1,6 +1,8 @@
+variables:
+  bootable_container: true
+
 include:
   - budgie-atomic-common.yaml
-  - common-bootable-containers.yaml
 
 # Kept in the leaf manifest as they are overwritten by Pungi in composes
 repos:
diff --git a/cinnamon-atomic.yaml b/cinnamon-atomic.yaml
index c3b1f8a..f93cc88 100644
--- a/cinnamon-atomic.yaml
+++ b/cinnamon-atomic.yaml
@@ -1,7 +1,10 @@
+variables:
+  bootable_container: true
+  variant: "cinnamon-atomic"
+
 include:
   - common.yaml
   - cinnamon-atomic-packages.yaml
-  - common-bootable-containers.yaml
 
 ref: fedora/rawhide/${basearch}/cinnamon
 rojig:
diff --git a/common-bootable-containers-kinoite.yaml b/common-bootable-containers-kinoite.yaml
deleted file mode 100644
index 993d6b3..0000000
--- a/common-bootable-containers-kinoite.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-# Manifests includes that are common only to Bootable Containers
-
-# Temporary Kinoite only manifest
-# See https://pagure.io/fedora-kde/SIG/issue/519
-
-# Add DNF5 and bootc for Bootable Container images
-# See: https://fedoraproject.org/wiki/Changes/DNFAndBootcInImageModeFedora
-packages:
-  # - dnf5
-  # - dnf5-plugins
-  - bootc
-
-include:
-  # - dnf5-bootc.yaml
-  - bootupd.yaml
-  - composefs.yaml
diff --git a/common-bootable-containers.yaml b/common-bootable-containers.yaml
deleted file mode 100644
index f27775f..0000000
--- a/common-bootable-containers.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Manifests includes that are common only to Bootable Containers
-include:
-  - dnf5-bootc.yaml
-  - bootupd.yaml
-  - composefs.yaml
diff --git a/common-ostree.yaml b/common-ostree.yaml
deleted file mode 100644
index fbddc11..0000000
--- a/common-ostree.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
-# Manifest common to classic ostree varaints only and not Bootable Containers
-include:
-  - bootupd.yaml
-
-# Packages only included in the legacy ostree variants and not in Bootable
-# Containers
-packages:
-  - ostree-grub2
-
-# We do not include any version of DNF in the classic ostree Atomic Desktops
-# See: https://fedoraproject.org/wiki/Changes/DNFAndBootcInImageModeFedora
-exclude-packages:
-  - dnf5
-  - dnf5-plugins
diff --git a/common.yaml b/common.yaml
index 9572e7c..426710e 100644
--- a/common.yaml
+++ b/common.yaml
@@ -10,12 +10,31 @@ include:
   # Packages common to all variants
   - common-packages.yaml
   # See: https://gitlab.com/fedora/ostree/sig/-/issues/1
-  # - bootupd.yaml
+  - bootupd.yaml
   # Dracut configuration for the initramfs
   - initramfs.yaml
   # Read only sysroot
   - sysroot-ro.yaml
 
+conditional-include:
+  # Manifests included only for classic ostree variants
+  - if: bootable_container == false
+    include:
+      - ostree-classic.yaml
+  # Manifests included only for the Bootable Container variants
+  - if: bootable_container == true
+    include:
+      - composefs.yaml
+      - bootc.yaml
+  # Only include dnf5 for non KDE Bootable Containers until
+  # https://pagure.io/fedora-kde/SIG/issue/519
+  - if:
+    - bootable_container == true
+    - variant != "kinoite"
+    - variant != "kinoite-mobile"
+    include:
+      - dnf5.yaml
+
 packages:
   # Ensure that we have a kernel. Kernel packages are not in any comps group
   - kernel
diff --git a/deepin-atomic.yaml b/deepin-atomic.yaml
index 970456e..e2ed9c4 100644
--- a/deepin-atomic.yaml
+++ b/deepin-atomic.yaml
@@ -1,7 +1,10 @@
+variables:
+  bootable_container: true
+  variant: "deepin-atomic"
+
 include:
   - common.yaml
   - deepin-atomic-packages.yaml
-  - common-bootable-containers.yaml
 
 ref: fedora/rawhide/${basearch}/deepin
 rojig:
diff --git a/dnf5-bootc.yaml b/dnf5-bootc.yaml
deleted file mode 100644
index 71fc36a..0000000
--- a/dnf5-bootc.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-# Add DNF5 and bootc for Bootable Container images
-# See: https://fedoraproject.org/wiki/Changes/DNFAndBootcInImageModeFedora
-packages:
-  - dnf5
-  - dnf5-plugins
-  - bootc
diff --git a/dnf5.yaml b/dnf5.yaml
new file mode 100644
index 0000000..881c7cd
--- /dev/null
+++ b/dnf5.yaml
@@ -0,0 +1,5 @@
+# Add DNF5 for Bootable Container images
+# See: https://fedoraproject.org/wiki/Changes/DNFAndBootcInImageModeFedora
+packages:
+  - dnf5
+  - dnf5-plugins
diff --git a/kinoite-common.yaml b/kinoite-common.yaml
index e2f6125..de68447 100644
--- a/kinoite-common.yaml
+++ b/kinoite-common.yaml
@@ -1,3 +1,6 @@
+variables:
+  variant: "kinoite"
+
 include:
   - common.yaml
   - kinoite-packages.yaml
diff --git a/kinoite-mobile.yaml b/kinoite-mobile.yaml
index 404309e..155d4d6 100644
--- a/kinoite-mobile.yaml
+++ b/kinoite-mobile.yaml
@@ -1,7 +1,10 @@
+variables:
+  bootable_container: true
+  variant: "kinoite-mobile"
+
 include:
   - common.yaml
   - kinoite-mobile-packages.yaml
-  - common-bootable-containers-kinoite.yaml
 
 ref: fedora/rawhide/${basearch}/kinoite-mobile
 rojig:
diff --git a/kinoite-ostree.yaml b/kinoite-ostree.yaml
index 06b854c..5951235 100644
--- a/kinoite-ostree.yaml
+++ b/kinoite-ostree.yaml
@@ -1,6 +1,8 @@
+variables:
+  bootable_container: false
+
 include:
   - kinoite-common.yaml
-  - common-ostree.yaml
 
 # Kept in the leaf manifest as they are overwritten by Pungi in composes
 repos:
diff --git a/kinoite.yaml b/kinoite.yaml
index e77cbc7..3101586 100644
--- a/kinoite.yaml
+++ b/kinoite.yaml
@@ -1,6 +1,8 @@
+variables:
+  bootable_container: true
+
 include:
   - kinoite-common.yaml
-  - common-bootable-containers-kinoite.yaml
 
 # Kept in the leaf manifest as they are overwritten by Pungi in composes
 repos:
diff --git a/lxqt-atomic.yaml b/lxqt-atomic.yaml
index 69a405f..8721e92 100644
--- a/lxqt-atomic.yaml
+++ b/lxqt-atomic.yaml
@@ -1,7 +1,10 @@
+variables:
+  bootable_container: true
+  variant: "lxqt-atomic"
+
 include:
   - common.yaml
   - lxqt-atomic-packages.yaml
-  - common-bootable-containers.yaml
 
 ref: fedora/rawhide/${basearch}/lazurite
 rojig:
diff --git a/mate-atomic.yaml b/mate-atomic.yaml
index 667defd..eb36df4 100644
--- a/mate-atomic.yaml
+++ b/mate-atomic.yaml
@@ -1,7 +1,10 @@
+variables:
+  bootable_container: true
+  variant: "mate-atomic"
+
 include:
   - common.yaml
   - mate-atomic-packages.yaml
-  - common-bootable-containers.yaml
 
 ref: fedora/rawhide/${basearch}/mate
 rojig:
diff --git a/ostree-classic.yaml b/ostree-classic.yaml
new file mode 100644
index 0000000..a331b17
--- /dev/null
+++ b/ostree-classic.yaml
@@ -0,0 +1,12 @@
+# Manifest for classic ostree varaints only and not Bootable Containers
+
+# Packages only included in the legacy ostree variants and not in Bootable
+# Containers
+packages:
+  - ostree-grub2
+
+# We do not include any version of DNF in the classic ostree Atomic Desktops
+# See: https://fedoraproject.org/wiki/Changes/DNFAndBootcInImageModeFedora
+exclude-packages:
+  - dnf5
+  - dnf5-plugins
diff --git a/silverblue-common.yaml b/silverblue-common.yaml
index 220c019..915e44b 100644
--- a/silverblue-common.yaml
+++ b/silverblue-common.yaml
@@ -1,3 +1,6 @@
+variables:
+  variant: "silverblue"
+
 include:
   - common.yaml
   - silverblue-packages.yaml
diff --git a/silverblue-ostree.yaml b/silverblue-ostree.yaml
index cd58c0f..ac1dd0c 100644
--- a/silverblue-ostree.yaml
+++ b/silverblue-ostree.yaml
@@ -1,6 +1,8 @@
+variables:
+  bootable_container: false
+
 include:
   - silverblue-common.yaml
-  - common-ostree.yaml
 
 # Kept in the leaf manifest as they are overwritten by Pungi in composes
 repos:
diff --git a/silverblue.yaml b/silverblue.yaml
index 6ec63a5..eaba398 100644
--- a/silverblue.yaml
+++ b/silverblue.yaml
@@ -1,6 +1,8 @@
+variables:
+  bootable_container: true
+
 include:
   - silverblue-common.yaml
-  - common-bootable-containers.yaml
 
 # Kept in the leaf manifest as they are overwritten by Pungi in composes
 repos:
diff --git a/sway-atomic-common.yaml b/sway-atomic-common.yaml
index 4967a75..16f3911 100644
--- a/sway-atomic-common.yaml
+++ b/sway-atomic-common.yaml
@@ -1,3 +1,6 @@
+variables:
+  variant: "sway-atomic"
+
 include:
   - common.yaml
   - sway-atomic-packages.yaml
diff --git a/sway-atomic-ostree.yaml b/sway-atomic-ostree.yaml
index d0e5eb7..b09226e 100644
--- a/sway-atomic-ostree.yaml
+++ b/sway-atomic-ostree.yaml
@@ -1,6 +1,8 @@
+variables:
+  bootable_container: false
+
 include:
   - sway-atomic-common.yaml
-  - common-ostree.yaml
 
 # Kept in the leaf manifest as they are overwritten by Pungi in composes
 repos:
diff --git a/sway-atomic.yaml b/sway-atomic.yaml
index c17b6c3..89c7c18 100644
--- a/sway-atomic.yaml
+++ b/sway-atomic.yaml
@@ -1,6 +1,8 @@
+variables:
+  bootable_container: true
+
 include:
   - sway-atomic-common.yaml
-  - common-bootable-containers.yaml
 
 # Kept in the leaf manifest as they are overwritten by Pungi in composes
 repos:
diff --git a/xfce-atomic.yaml b/xfce-atomic.yaml
index 64e8898..d05aa2f 100644
--- a/xfce-atomic.yaml
+++ b/xfce-atomic.yaml
@@ -1,7 +1,10 @@
+variables:
+  bootable_container: true
+  variant: "xfce-atomic"
+
 include:
   - common.yaml
   - xfce-atomic-packages.yaml
-  - common-bootable-containers.yaml
 
 ref: fedora/rawhide/${basearch}/vauxite
 rojig:

From 8a4fcf94cefbbc35d11368fa377bee344c5e1c03 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Jul 26 2024 15:06:23 +0000
Subject: [PATCH 2/2] justfile: Remove checks for manifest command


---

diff --git a/justfile b/justfile
index 94c3531..8e8706c 100644
--- a/justfile
+++ b/justfile
@@ -105,14 +105,6 @@ manifest variant=default_variant:
     #!/bin/bash
     set -euo pipefail
 
-    declare -A pretty_names={{pretty_names}}
-    variant={{variant}}
-    variant_pretty=${pretty_names[$variant]-}
-    if [[ -z $variant_pretty ]]; then
-        echo "Unknown variant"
-        exit 1
-    fi
-
     rpm-ostree compose tree --print-only --repo=repo {{variant}}.yaml
 
 # Perform dependency resolution for a given variant (defaults to Silverblue)

