From e102e488114673069f879afb3796a8e6fb69aaf4 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Thu, 19 Nov 2020 15:36:48 -0500
Subject: [PATCH] gnu: gajim: Fix loading of os-installed plugins.
* gnu/packages/messaging.scm (gajim) [patches]: Add gajim-plugins-os.patch.
[arguments]<#:phases>['add-plugins-dir]: Remove phase.
[native-search-paths]: Modify.
* gnu/packages/patches/gajim-plugins-os.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
[1] The 'add-plugins-dir phase does not work for version 1.2.2,
so this patch is a work-around.
[2] The variable name is changed from GAJIM_PLUGINS_PATH to PLUGINS_OS,
to resonate close with variable names PLUGINS_BASE and PLUGINS_USER,
as this patch is planned to be merged in gajim's upstream.
---
gnu/local.mk | 1 +
gnu/packages/messaging.scm | 16 ++++---------
gnu/packages/patches/gajim-plugins-os.patch | 25 +++++++++++++++++++++
3 files changed, 30 insertions(+), 12 deletions(-)
create mode 100644 gnu/packages/patches/gajim-plugins-os.patch
@@ -991,6 +991,7 @@ dist_patch_DATA = \
%D%/packages/patches/freedink-engine-fix-sdl-hints.patch \
%D%/packages/patches/freeimage-unbundle.patch \
%D%/packages/patches/fuse-overlapping-headers.patch \
+ %D%/packages/patches/gajim-plugins-os.patch \
%D%/packages/patches/ganeti-deterministic-manual.patch \
%D%/packages/patches/ganeti-disable-version-symlinks.patch \
%D%/packages/patches/ganeti-drbd-compat.patch \
@@ -743,7 +743,9 @@ of xmpppy.")
(version-major+minor version)
"/gajim-" version ".tar.gz"))
(sha256
- (base32 "1gfcp3b5nq43xxz5my8vfhfxnnli726j3hzcgwh9fzrzzd9ic3gx"))))
+ (base32 "1gfcp3b5nq43xxz5my8vfhfxnnli726j3hzcgwh9fzrzzd9ic3gx"))
+ (patches
+ (search-patches "gajim-plugins-os.patch"))))
(build-system python-build-system)
(arguments
`(#:imported-modules
@@ -756,16 +758,6 @@ of xmpppy.")
(guix build utils))
#:phases
(modify-phases %standard-phases
- (add-after 'unpack 'add-plugin-dirs
- (lambda _
- (substitute* "gajim/common/configpaths.py"
- (("_paths\\['PLUGINS_USER'\\]\\]")
- "_paths['PLUGINS_USER']] + \
-([os.getenv('GAJIM_PLUGIN_PATH')] \
-if os.getenv('GAJIM_PLUGIN_PATH') \
-and Path(os.getenv('GAJIM_PLUGIN_PATH')).is_dir() \
-else [])"))
- #t))
(replace 'check
(lambda _
;; Tests require a running X server.
@@ -795,7 +787,7 @@ else [])"))
(native-search-paths
(list
(search-path-specification
- (variable "GAJIM_PLUGIN_PATH")
+ (variable "PLUGINS_OS")
(separator #f) ;single entry
(files
(list
new file mode 100644
@@ -0,0 +1,25 @@
+From c8e8d29243222e52bb30e123f2c7321a9f418995 Mon Sep 17 00:00:00 2001
+From: Raghav Gururajan <raghavgururajan@disroot.org>
+Date: Thu, 19 Nov 2020 15:20:38 -0500
+Subject: [PATCH 3/3] [PATCH]: Fix loading of OS-installed plugins.
+
+---
+ gajim/common/configpaths.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gajim/common/configpaths.py b/gajim/common/configpaths.py
+index 0ac879314..f4418b020 100644
+--- a/gajim/common/configpaths.py
++++ b/gajim/common/configpaths.py
+@@ -47,7 +47,7 @@ def get_plugin_dirs() -> List[Path]:
+ return [Path(_paths['PLUGINS_BASE']),
+ Path('/app/plugins')]
+ return [Path(_paths['PLUGINS_BASE']),
+- Path(_paths['PLUGINS_USER'])]
++ Path(_paths['PLUGINS_USER'])] + ([Path(os.getenv('PLUGINS_OS'))] if os.getenv('PLUGINS_OS') and Path(os.getenv('PLUGINS_OS')).is_dir() else [])
+
+
+ def get_paths(type_: PathType) -> Generator[Path, None, None]:
+--
+2.29.2
+
--
2.29.2