From d1048a09eb122356cf17ce4e9272770abadf1225 Mon Sep 17 00:00:00 2001
From: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com>
Date: Thu, 19 Sep 2024 09:28:39 -0500
Subject: [PATCH] add: stardust-comet (#2051)

* initial package for stardust-comet

* RPM bug workaround in stardust-comet.spec

Signed-off-by: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com>

* Remove conflicts

Signed-off-by: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com>

* Update stardust-comet.spec

Signed-off-by: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com>

* Update stardust-comet.spec

Add packager

Signed-off-by: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com>

* Update stardust-comet.spec

Remove runtime requirements

Signed-off-by: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com>

* Update update.rhai

Signed-off-by: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com>

* Update update.rhai

Fix indentation

Signed-off-by: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com>

* Update stardust-comet.spec

Lock cargo install

Signed-off-by: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com>

* Update stardust-comet.spec

add %summary

Signed-off-by: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com>

* Update stardust-comet.spec

Unify summaries

Signed-off-by: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com>

---------

Signed-off-by: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com>
(cherry picked from commit 3a7e4fc3753a0800abff18766feef62b7d4fc27c)
---
 anda/stardust/comet/anda.hcl            |  8 +++++
 anda/stardust/comet/stardust-comet.spec | 39 +++++++++++++++++++++++++
 anda/stardust/comet/update.rhai         |  5 ++++
 3 files changed, 52 insertions(+)
 create mode 100644 anda/stardust/comet/anda.hcl
 create mode 100644 anda/stardust/comet/stardust-comet.spec
 create mode 100644 anda/stardust/comet/update.rhai

diff --git a/anda/stardust/comet/anda.hcl b/anda/stardust/comet/anda.hcl
new file mode 100644
index 0000000000..95ba7c5843
--- /dev/null
+++ b/anda/stardust/comet/anda.hcl
@@ -0,0 +1,8 @@
+project pkg {
+	rpm {
+		spec = "stardust-comet.spec"
+	}
+	labels {
+	   nightly = 1
+	}
+}
diff --git a/anda/stardust/comet/stardust-comet.spec b/anda/stardust/comet/stardust-comet.spec
new file mode 100644
index 0000000000..35c8c9159d
--- /dev/null
+++ b/anda/stardust/comet/stardust-comet.spec
@@ -0,0 +1,39 @@
+%global commit afbf6109398794791ffb30317712d742143fd08a
+%global commit_date 20240831
+%global shortcommit %(c=%{commit}; echo ${c:0:7})
+# Exclude input files from mangling
+%global __brp_mangle_shebangs_exclude_from ^/usr/src/.*$
+
+Name:           stardust-comet
+Version:        %commit_date.%shortcommit
+Release:        1%?dist
+Summary:        Annotate things in Stardust XR.
+URL:            https://github.com/StardustXR/comet
+Source0:        %url/archive/%commit/comet-%commit.tar.gz
+License:        MIT
+BuildRequires:  cargo cmake anda-srpm-macros cargo-rpm-macros mold
+
+Provides:       comet
+Packager:       Owen Zimmerman <owen@fyralabs.com>
+
+%description
+%summary
+
+%prep
+%autosetup -n comet-%commit
+%cargo_prep_online
+
+%build
+
+%install
+%define __cargo_common_opts %{?_smp_mflags} -Z avoid-dev-deps --locked
+%cargo_install
+
+%files
+%_bindir/comet
+%license LICENSE
+%doc README.md
+
+%changelog
+* Sat Sep 7 2024 Owen-sz <owen@fyralabs.com>
+- Package StardustXR comet
diff --git a/anda/stardust/comet/update.rhai b/anda/stardust/comet/update.rhai
new file mode 100644
index 0000000000..e9531f24ba
--- /dev/null
+++ b/anda/stardust/comet/update.rhai
@@ -0,0 +1,5 @@
+rpm.global("commit", gh_commit("StardustXR/comet"));
+if rpm.changed() {
+  rpm.release();
+  rpm.global("commit_date", date());
+}