From a81dbe01b92f7961fd720121a8fd396b42540b63 Mon Sep 17 00:00:00 2001
From: Ryan Brue <ryanbrue.dev@gmail.com>
Date: Sep 29 2024 22:09:54 +0000
Subject: fix: patches for cosmic-launcher and pop-launcher


Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>

---

diff --git a/rpms/cosmic-launcher/pop-launcher-libexec.patch b/rpms/cosmic-launcher/pop-launcher-libexec.patch
index 59b6852..5e7da2a 100644
--- a/rpms/cosmic-launcher/pop-launcher-libexec.patch
+++ b/rpms/cosmic-launcher/pop-launcher-libexec.patch
@@ -1,204 +1,62 @@
-From b255c1b7d48a8a3405ceacd5a78f201ba3ae748b Mon Sep 17 00:00:00 2001
-From: Ryan Brue <ryanbrue.dev@gmail.com>
-Date: Sun, 29 Sep 2024 16:20:58 -0500
-Subject: [PATCH] patch: use pop-launcher patch
- https://github.com/pop-os/launcher/pull/242
-
-Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
+diff -r ./vendor/pop-launcher/debian/pop-launcher.install ./vendor/pop-launcher.new/debian/pop-launcher.install
+2,3c2,3
+< /usr/lib/pop-launcher/plugins/
+< /usr/lib/pop-launcher/scripts/session/
+\ No newline at end of file
 ---
- Cargo.lock | 67 ++++++++++++++++++++----------------------------------
- Cargo.toml |  4 ++--
- 2 files changed, 27 insertions(+), 44 deletions(-)
-
-diff --git a/Cargo.lock b/Cargo.lock
-index e3f8963..ed947c3 100644
---- a/Cargo.lock
-+++ b/Cargo.lock
-@@ -616,15 +616,15 @@ dependencies = [
- 
- [[package]]
- name = "base64"
--version = "0.13.1"
-+version = "0.21.7"
- source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
-+checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
- 
- [[package]]
- name = "base64"
--version = "0.21.7"
-+version = "0.22.1"
- source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
-+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
- 
- [[package]]
- name = "bit-set"
-@@ -1436,15 +1436,6 @@ dependencies = [
-  "dirs-sys 0.3.7",
- ]
- 
--[[package]]
--name = "dirs"
--version = "4.0.0"
--source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
--dependencies = [
-- "dirs-sys 0.3.7",
--]
--
- [[package]]
- name = "dirs"
- version = "5.0.1"
-@@ -1712,7 +1703,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
- checksum = "887d93f60543e9a9362ef8a21beedd0a833c5d9610e18c67abe15a5963dcb1a4"
- dependencies = [
-  "bit_field",
-- "flume 0.11.0",
-+ "flume",
-  "half",
-  "lebe",
-  "miniz_oxide",
-@@ -1843,23 +1834,13 @@ dependencies = [
- 
- [[package]]
- name = "flume"
--version = "0.10.14"
-+version = "0.11.0"
- source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577"
-+checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181"
- dependencies = [
-  "futures-core",
-  "futures-sink",
-  "nanorand",
-- "pin-project 1.1.5",
-- "spin",
--]
--
--[[package]]
--name = "flume"
--version = "0.11.0"
--source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181"
--dependencies = [
-  "spin",
- ]
- 
-@@ -2492,7 +2473,7 @@ dependencies = [
-  "httpdate",
-  "itoa",
-  "pin-project-lite",
-- "socket2 0.5.7",
-+ "socket2 0.4.10",
-  "tokio",
-  "tower-service",
-  "tracing",
-@@ -2874,6 +2855,7 @@ checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
- dependencies = [
-  "equivalent",
-  "hashbrown 0.14.5",
-+ "serde",
- ]
- 
- [[package]]
-@@ -3970,11 +3952,11 @@ checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2"
- 
- [[package]]
- name = "pop-launcher"
--version = "1.2.2"
--source = "git+https://github.com/pop-os/launcher/?rev=091581c#091581c3620a4cf3979e70f68c4af23654104bec"
-+version = "1.2.3"
-+source = "git+https://github.com/ryanabx-contrib/launcher/?rev=e79a9500cc2ff58e02af1e115efebda025c5480a#e79a9500cc2ff58e02af1e115efebda025c5480a"
- dependencies = [
-  "const_format",
-- "dirs 4.0.0",
-+ "dirs 5.0.1",
-  "futures",
-  "serde",
-  "serde_json",
-@@ -3985,14 +3967,14 @@ dependencies = [
- 
- [[package]]
- name = "pop-launcher-service"
--version = "1.2.2"
--source = "git+https://github.com/pop-os/launcher/?rev=091581c#091581c3620a4cf3979e70f68c4af23654104bec"
-+version = "1.2.3"
-+source = "git+https://github.com/ryanabx-contrib/launcher/?rev=e79a9500cc2ff58e02af1e115efebda025c5480a#e79a9500cc2ff58e02af1e115efebda025c5480a"
- dependencies = [
-  "anyhow",
-  "async-oneshot",
-  "async-trait",
-- "dirs 4.0.0",
-- "flume 0.10.14",
-+ "dirs 5.0.1",
-+ "flume",
-  "futures",
-  "futures_codec",
-  "gen-z",
-@@ -4004,12 +3986,11 @@ dependencies = [
-  "serde_json",
-  "serde_with",
-  "slab",
-- "strsim 0.10.0",
-+ "strsim 0.11.1",
-  "tokio",
-  "tokio-stream",
-- "toml 0.5.11",
-+ "toml 0.8.16",
-  "tracing",
-- "tracing-subscriber",
- ]
- 
- [[package]]
-@@ -4615,15 +4596,17 @@ dependencies = [
- 
- [[package]]
- name = "serde_with"
--version = "2.3.3"
-+version = "3.9.0"
- source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe"
-+checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857"
- dependencies = [
-- "base64 0.13.1",
-+ "base64 0.22.1",
-  "chrono",
-  "hex",
-  "indexmap 1.9.3",
-+ "indexmap 2.2.6",
-  "serde",
-+ "serde_derive",
-  "serde_json",
-  "serde_with_macros",
-  "time",
-@@ -4631,9 +4614,9 @@ dependencies = [
- 
- [[package]]
- name = "serde_with_macros"
--version = "2.3.3"
-+version = "3.9.0"
- source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f"
-+checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350"
- dependencies = [
-  "darling",
-  "proc-macro2",
-diff --git a/Cargo.toml b/Cargo.toml
-index 38bcf79..ac0b9fd 100644
---- a/Cargo.toml
-+++ b/Cargo.toml
-@@ -30,8 +30,8 @@ libcosmic = { git = "https://github.com/pop-os/libcosmic/", features = [
- tracing = "0.1"
- nix = { version = "0.27.1", features = ["process"] }
- once_cell = "1.17"
--pop-launcher = { git = "https://github.com/pop-os/launcher/", rev = "091581c" }
--pop-launcher-service = { git = "https://github.com/pop-os/launcher/", rev = "091581c" }
-+pop-launcher = { git = "https://github.com/ryanabx-contrib/launcher/", rev = "e79a9500cc2ff58e02af1e115efebda025c5480a" }
-+pop-launcher-service = { git = "https://github.com/ryanabx-contrib/launcher/", rev = "e79a9500cc2ff58e02af1e115efebda025c5480a" }
- pretty_env_logger = "0.5"
- rust-embed = "6.3.0"
- serde = { version = "1.0.152", features = ["derive"] }
--- 
-2.46.2
-
+> /usr/libexec/pop-launcher/plugins/
+> /usr/libexec/pop-launcher/scripts/session/
+\ No newline at end of file
+diff -r ./vendor/pop-launcher/debian/pop-launcher.links ./vendor/pop-launcher.new/debian/pop-launcher.links
+1,11c1,11
+< /usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/calc/calc
+< /usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/desktop_entries/desktop-entries
+< /usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/files/files
+< /usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/find/find
+< /usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/pop_shell/pop-shell
+< /usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/pulse/pulse
+< /usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/recent/recent
+< /usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/scripts/scripts
+< /usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/terminal/terminal
+< /usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/web/web
+< /usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/cosmic_toplevel/cosmic-toplevel
+---
+> /usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/calc/calc
+> /usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/desktop_entries/desktop-entries
+> /usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/files/files
+> /usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/find/find
+> /usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/pop_shell/pop-shell
+> /usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/pulse/pulse
+> /usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/recent/recent
+> /usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/scripts/scripts
+> /usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/terminal/terminal
+> /usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/web/web
+> /usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/cosmic_toplevel/cosmic-toplevel
+diff -r ./vendor/pop-launcher/debian/pop-launcher-system76-power.install ./vendor/pop-launcher.new/debian/pop-launcher-system76-power.install
+1c1
+< /usr/lib/pop-launcher/scripts/system76-power
+\ No newline at end of file
+---
+> /usr/libexec/pop-launcher/scripts/system76-power
+\ No newline at end of file
+diff -r ./vendor/pop-launcher/debian/rules ./vendor/pop-launcher.new/debian/rules
+35c35
+< 	chmod +x debian/pop-launcher/usr/lib/pop-launcher/scripts/**/*.sh
+\ No newline at end of file
+---
+> 	chmod +x debian/pop-launcher/usr/libexec/pop-launcher/scripts/**/*.sh
+\ No newline at end of file
+diff -r ./vendor/pop-launcher/README.md ./vendor/pop-launcher.new/README.md
+48c48
+< - Distribution packaging: `/usr/lib/pop-launcher/plugins/{plugin}/`
+---
+> - Distribution packaging: `/usr/libexec/pop-launcher/plugins/{plugin}/`
+82c82
+< - Distribution packaging: `/usr/lib/pop-launcher/scripts`
+---
+> - Distribution packaging: `/usr/libexec/pop-launcher/scripts`
+diff -r ./vendor/pop-launcher/src/lib.rs ./vendor/pop-launcher.new/src/lib.rs
+22c22
+< pub const DISTRIBUTION: &str = "/usr/lib/pop-launcher";
+---
+> pub const DISTRIBUTION: &str = "/usr/libexec/pop-launcher";
diff --git a/rpms/pop-launcher/pop-launcher.spec b/rpms/pop-launcher/pop-launcher.spec
index f7c274e..41812d9 100644
--- a/rpms/pop-launcher/pop-launcher.spec
+++ b/rpms/pop-launcher/pop-launcher.spec
@@ -27,7 +27,7 @@ Source1:        vendor-%{shortcommit}.tar.gz
 Source2:        vendor-config-%{shortcommit}.toml
 
 # See: https://github.com/pop-os/launcher/pull/242
-Patch0: https://patch-diff.githubusercontent.com/raw/pop-os/launcher/pull/242.patch
+Patch0: use-libexec.patch
 
 BuildRequires:  cargo-rpm-macros >= 25
 BuildRequires:  rustc
diff --git a/rpms/pop-launcher/use-libexec.patch b/rpms/pop-launcher/use-libexec.patch
new file mode 100644
index 0000000..d94bd6e
--- /dev/null
+++ b/rpms/pop-launcher/use-libexec.patch
@@ -0,0 +1,126 @@
+From e79a9500cc2ff58e02af1e115efebda025c5480a Mon Sep 17 00:00:00 2001
+From: Ryan Brue <ryanbrue.dev@gmail.com>
+Date: Sun, 29 Sep 2024 16:04:19 -0500
+Subject: [PATCH] fix: use /usr/libexec/.. for plugins instead of /usr/lib/..
+
+This commit changes plugins to use /usr/libexec instead of /usr/lib. Since the plugins contain executables, the more apt directory for this need is /usr/libexec. Fedora is requiring this in order to package pop-launcher and cosmic-launcher, so this patch will be used for downstream Fedora, but if upstream would like to adopt this change, I've brought it here just in case! :)
+
+Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
+---
+ README.md                                  |  4 ++--
+ debian/pop-launcher-system76-power.install |  2 +-
+ debian/pop-launcher.install                |  4 ++--
+ debian/pop-launcher.links                  | 22 +++++++++++-----------
+ debian/rules                               |  2 +-
+ plugins/src/scripts/mod.rs                 |  2 +-
+ src/lib.rs                                 |  2 +-
+ 7 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/README.md b/README.md
+index 54fefcb..c67f9c0 100644
+--- a/README.md
++++ b/README.md
+@@ -45,7 +45,7 @@ just plugins="calc desktop_entries files find pop_shell pulse recent scripts ter
+ 
+ - User-local plugins: `~/.local/share/pop-launcher/plugins/{plugin}/`
+ - System-wide install for system administrators: `/etc/pop-launcher/plugins/{plugin}/`
+-- Distribution packaging: `/usr/lib/pop-launcher/plugins/{plugin}/`
++- Distribution packaging: `/usr/libexec/pop-launcher/plugins/{plugin}/`
+ 
+ ## Plugin Config
+ 
+@@ -79,7 +79,7 @@ A plugin's metadata is defined `pop-launcher/plugins/{plugin}/plugin.ron`.
+ 
+ - User-local scripts: `~/.local/share/pop-launcher/scripts`
+ - System-wide install for system administrators: `/etc/pop-launcher/scripts`
+-- Distribution packaging: `/usr/lib/pop-launcher/scripts`
++- Distribution packaging: `/usr/libexec/pop-launcher/scripts`
+ 
+ Example script
+ <details>
+diff --git a/debian/pop-launcher-system76-power.install b/debian/pop-launcher-system76-power.install
+index 72e3852..698c3b2 100644
+--- a/debian/pop-launcher-system76-power.install
++++ b/debian/pop-launcher-system76-power.install
+@@ -1 +1 @@
+-/usr/lib/pop-launcher/scripts/system76-power
+\ No newline at end of file
++/usr/libexec/pop-launcher/scripts/system76-power
+\ No newline at end of file
+diff --git a/debian/pop-launcher.install b/debian/pop-launcher.install
+index 6852f59..3c03459 100644
+--- a/debian/pop-launcher.install
++++ b/debian/pop-launcher.install
+@@ -1,3 +1,3 @@
+ /usr/bin/
+-/usr/lib/pop-launcher/plugins/
+-/usr/lib/pop-launcher/scripts/session/
+\ No newline at end of file
++/usr/libexec/pop-launcher/plugins/
++/usr/libexec/pop-launcher/scripts/session/
+\ No newline at end of file
+diff --git a/debian/pop-launcher.links b/debian/pop-launcher.links
+index 99b5032..3549763 100644
+--- a/debian/pop-launcher.links
++++ b/debian/pop-launcher.links
+@@ -1,11 +1,11 @@
+-/usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/calc/calc
+-/usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/desktop_entries/desktop-entries
+-/usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/files/files
+-/usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/find/find
+-/usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/pop_shell/pop-shell
+-/usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/pulse/pulse
+-/usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/recent/recent
+-/usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/scripts/scripts
+-/usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/terminal/terminal
+-/usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/web/web
+-/usr/bin/pop-launcher /usr/lib/pop-launcher/plugins/cosmic_toplevel/cosmic-toplevel
++/usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/calc/calc
++/usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/desktop_entries/desktop-entries
++/usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/files/files
++/usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/find/find
++/usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/pop_shell/pop-shell
++/usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/pulse/pulse
++/usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/recent/recent
++/usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/scripts/scripts
++/usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/terminal/terminal
++/usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/web/web
++/usr/bin/pop-launcher /usr/libexec/pop-launcher/plugins/cosmic_toplevel/cosmic-toplevel
+diff --git a/debian/rules b/debian/rules
+index 30cad5a..30d994b 100755
+--- a/debian/rules
++++ b/debian/rules
+@@ -32,4 +32,4 @@ override_dh_auto_install:
+ 
+ override_dh_fixperms:
+ 	dh_fixperms
+-	chmod +x debian/pop-launcher/usr/lib/pop-launcher/scripts/**/*.sh
+\ No newline at end of file
++	chmod +x debian/pop-launcher/usr/libexec/pop-launcher/scripts/**/*.sh
+\ No newline at end of file
+diff --git a/plugins/src/scripts/mod.rs b/plugins/src/scripts/mod.rs
+index b0b75d7..54faac7 100644
+--- a/plugins/src/scripts/mod.rs
++++ b/plugins/src/scripts/mod.rs
+@@ -15,7 +15,7 @@ use tokio::process::Command;
+ 
+ const LOCAL_PATH: &str = ".local/share/pop-launcher/scripts";
+ const SYSTEM_ADMIN_PATH: &str = "/etc/pop-launcher/scripts";
+-const DISTRIBUTION_PATH: &str = "/usr/lib/pop-launcher/scripts";
++const DISTRIBUTION_PATH: &str = "/usr/libexec/pop-launcher/scripts";
+ 
+ pub async fn main() {
+     let mut requests = json_input_stream(async_stdin());
+diff --git a/src/lib.rs b/src/lib.rs
+index e626e9d..3cb9044 100644
+--- a/src/lib.rs
++++ b/src/lib.rs
+@@ -19,7 +19,7 @@ pub const LOCAL_PLUGINS: &str = concatcp!(LOCAL, "/plugins");
+ pub const SYSTEM: &str = "/etc/pop-launcher";
+ pub const SYSTEM_PLUGINS: &str = concatcp!(SYSTEM, "/plugins");
+ 
+-pub const DISTRIBUTION: &str = "/usr/lib/pop-launcher";
++pub const DISTRIBUTION: &str = "/usr/libexec/pop-launcher";
+ pub const DISTRIBUTION_PLUGINS: &str = concatcp!(DISTRIBUTION, "/plugins");
+ 
+ pub const PLUGIN_PATHS: &[&str] = &[LOCAL_PLUGINS, SYSTEM_PLUGINS, DISTRIBUTION_PLUGINS];

