From 1362b613aceb79aa569e6b039e71b5881e0f21e3 Mon Sep 17 00:00:00 2001
From: Davide Cavalca <dcavalca@fedoraproject.org>
Date: Dec 19 2023 02:23:14 +0000
Subject: [PATCH 1/3] Ensure grubby is installed over sdubby


---

diff --git a/components/boot.xml b/components/boot.xml
index 4544be2..f835e4f 100644
--- a/components/boot.xml
+++ b/components/boot.xml
@@ -8,6 +8,7 @@
 		<package name="shim-signed-aa64" arch="aarch64"/>
 		<package name="grub2-efi-aa64" arch="aarch64"/>
 		<package name="uboot-images-armv8" arch="aarch64"/>
+		<package name="grubby"/>
 		<package name="kernel-16k"/>
 		<package name="kernel-16k-modules-extra"/>
 		<package name="systemd-oomd-defaults"/>

From 7a23258337da553c196f47bfdb72241c6069c28d Mon Sep 17 00:00:00 2001
From: Davide Cavalca <dcavalca@fedoraproject.org>
Date: Dec 19 2023 02:23:36 +0000
Subject: [PATCH 2/3] tmt: add missing dependency


---

diff --git a/tmt/plans/build-gnome.fmf b/tmt/plans/build-gnome.fmf
index 894d94f..0f39b9c 100644
--- a/tmt/plans/build-gnome.fmf
+++ b/tmt/plans/build-gnome.fmf
@@ -4,7 +4,7 @@ discover:
     tests:
       - name: build image
         test: |
-          dnf --assumeyes install fatcat git-core kiwi distribution-gpg-keys p7zip-plugins python3-boto3 zip zstd libselinux-utils
+          dnf --assumeyes install fatcat git-core kiwi distribution-gpg-keys p7zip-plugins python3-boto3 zip zstd libselinux-utils rpmdistro-repoquery
           setenforce 0
           $TMT_TREE/builder.py build gnome
           $TMT_TREE/builder.py package gnome
diff --git a/tmt/plans/build-kde.fmf b/tmt/plans/build-kde.fmf
index c4c4411..fe94aba 100644
--- a/tmt/plans/build-kde.fmf
+++ b/tmt/plans/build-kde.fmf
@@ -4,7 +4,7 @@ discover:
     tests:
       - name: build image
         test: |
-          dnf --assumeyes install fatcat git-core kiwi distribution-gpg-keys p7zip-plugins python3-boto3 zip zstd libselinux-utils
+          dnf --assumeyes install fatcat git-core kiwi distribution-gpg-keys p7zip-plugins python3-boto3 zip zstd libselinux-utils rpmdistro-repoquery
           setenforce 0
           $TMT_TREE/builder.py build kde
           $TMT_TREE/builder.py package kde
diff --git a/tmt/plans/build-minimal.fmf b/tmt/plans/build-minimal.fmf
index b98fca9..7130e8b 100644
--- a/tmt/plans/build-minimal.fmf
+++ b/tmt/plans/build-minimal.fmf
@@ -4,7 +4,7 @@ discover:
     tests:
       - name: build image
         test: |
-          dnf --assumeyes install fatcat git-core kiwi distribution-gpg-keys p7zip-plugins python3-boto3 zip zstd libselinux-utils
+          dnf --assumeyes install fatcat git-core kiwi distribution-gpg-keys p7zip-plugins python3-boto3 zip zstd libselinux-utils rpmdistro-repoquery
           setenforce 0
           $TMT_TREE/builder.py build minimal
           $TMT_TREE/builder.py package minimal
diff --git a/tmt/plans/build-server.fmf b/tmt/plans/build-server.fmf
index 9e0344d..77c777b 100644
--- a/tmt/plans/build-server.fmf
+++ b/tmt/plans/build-server.fmf
@@ -4,7 +4,7 @@ discover:
     tests:
       - name: build image
         test: |
-          dnf --assumeyes install fatcat git-core kiwi distribution-gpg-keys p7zip-plugins python3-boto3 zip zstd libselinux-utils
+          dnf --assumeyes install fatcat git-core kiwi distribution-gpg-keys p7zip-plugins python3-boto3 zip zstd libselinux-utils rpmdistro-repoquery
           setenforce 0
           $TMT_TREE/builder.py build server
           $TMT_TREE/builder.py package server

From 9bd4af2286e04b732880d7031d6afc3b0f1168e0 Mon Sep 17 00:00:00 2001
From: Davide Cavalca <dcavalca@fedoraproject.org>
Date: Dec 19 2023 02:23:42 +0000
Subject: [PATCH 3/3] tmt: copy the artifacts over


---

diff --git a/builder.py b/builder.py
index dcf816c..196e042 100755
--- a/builder.py
+++ b/builder.py
@@ -188,6 +188,23 @@ def packageUpload(target):
     uploadToS3(manifest, f"os/{manifest}")
 
 
+def tmtCopy(target):
+    base = f"fedora-{RELEASE}-{target['id']}-{BUILDVER}"
+    package = f"{base}.zip"
+    logs_package = f"{base}.logs.zip"
+    image = f"{base}.raw.zst"
+    manifest = f"{base}.json"
+
+    artifacts = os.getenv("TMT_PLAN_DATA")
+    if not os.path.exists(artifacts):
+        os.mkdir(artifacts)
+
+    shutil.copyfile(package, f"{artifacts}/{package}")
+    shutil.copyfile(logs_package, f"{artifacts}/{logs_package}")
+    shutil.copyfile(image, f"{artifacts}/{image}")
+    shutil.copyfile(manifest, f"{artifacts}/{manifest}")
+
+
 def getManifest():
     if S3_BUCKET is None:
         fail("S3_BUCKET is not set")
@@ -251,6 +268,17 @@ def upload(manifest, target):
 
 
 @cli.command()
+@click.argument("target")
+def tmt(target):
+    if target not in TARGETS.keys():
+        fail(f"Unknown target: {target}")
+
+    target = TARGETS[target]
+
+    tmtCopy(target)
+
+
+@cli.command()
 @click.option("--update/--no-update", default=False)
 @click.option("--upload/--no-upload", default=False)
 def manifest(update, upload):
diff --git a/tmt/plans/build-gnome.fmf b/tmt/plans/build-gnome.fmf
index 0f39b9c..b967251 100644
--- a/tmt/plans/build-gnome.fmf
+++ b/tmt/plans/build-gnome.fmf
@@ -8,6 +8,7 @@ discover:
           setenforce 0
           $TMT_TREE/builder.py build gnome
           $TMT_TREE/builder.py package gnome
+          $TMT_TREE/builder.py tmt gnome
           setenforce 1
 
 execute:
diff --git a/tmt/plans/build-kde.fmf b/tmt/plans/build-kde.fmf
index fe94aba..bc9c1e3 100644
--- a/tmt/plans/build-kde.fmf
+++ b/tmt/plans/build-kde.fmf
@@ -8,6 +8,7 @@ discover:
           setenforce 0
           $TMT_TREE/builder.py build kde
           $TMT_TREE/builder.py package kde
+          $TMT_TREE/builder.py tmt kde
           setenforce 1
 
 execute:
diff --git a/tmt/plans/build-minimal.fmf b/tmt/plans/build-minimal.fmf
index 7130e8b..021d9bd 100644
--- a/tmt/plans/build-minimal.fmf
+++ b/tmt/plans/build-minimal.fmf
@@ -8,6 +8,7 @@ discover:
           setenforce 0
           $TMT_TREE/builder.py build minimal
           $TMT_TREE/builder.py package minimal
+          $TMT_TREE/builder.py tmt minimal
           setenforce 1
 
 execute:
diff --git a/tmt/plans/build-server.fmf b/tmt/plans/build-server.fmf
index 77c777b..7e847ef 100644
--- a/tmt/plans/build-server.fmf
+++ b/tmt/plans/build-server.fmf
@@ -8,6 +8,7 @@ discover:
           setenforce 0
           $TMT_TREE/builder.py build server
           $TMT_TREE/builder.py package server
+          $TMT_TREE/builder.py tmt server
           setenforce 1
 
 execute:

