From: Raghav Gururajan <rg@raghavgururajan.name>
To: Tobias Geerinckx-Rice <me@tobias.gr>
Cc: julien@lepiller.eu, 44730@debbugs.gnu.org
Subject: [bug#44730] [GAJIM]: Fix loading of installed plugins
Date: Thu, 19 Nov 2020 15:50:49 -0500 [thread overview]
Message-ID: <dba8fa42-86b1-a28b-2dc0-dc02ed6cacfd@raghavgururajan.name> (raw)
In-Reply-To: <87eekp76eo.fsf@nckx>
[-- Attachment #1.1.1: Type: text/plain, Size: 3705 bytes --]
Hello Tobias!
> Thanks for taking care of Gajim.
Anytime! :-)
> Raghav Gururajan 写道:
>> fix plugins issue in Gajim.
>
> Please provide more information: what was wrong with the original code,
> and why and how will your patch fix it? It's better to put this in the
> commit message itself (above the change log), not just the cover letter
> (your mail). No more than a few lines.
>
> The more clear your explanation, the faster the fix can be reviewed and
> merged.
I keep doing this, my apologies. I have included comment in commit
message of revised patch.
> I assume that the problem is the empty ‘Plugins’ list when I run:
>
> $ guix environment guix \
> -- ./pre-inst-env guix environment \
> --pure --ad-hoc gajim{,-openpgp,-omemo} \
> -- gajim
Yes!
> However, the fix doesn't look right to me.
>
> After applying your patch, Gajim is broken. Menus don't work.
>
> --8<---------------cut here---------------start------------->8---
> Traceback (most recent call last):
> File
> "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/application.py", line 222, in _activate
> self.interface.run(self)
> File
> "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/gui_interface.py", line 1965, in run
> app.plugin_manager = plugins.PluginManager()
> File
> "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/common/helpers.py", line 1002, in __call__
> cls._instances[cls] = super(Singleton, cls).__call__(
> File
> "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/plugins/pluginmanager.py", line 224, in __init__
> self._load_plugins()
> File
> "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/plugins/pluginmanager.py", line 668, in _load_plugins
> for plugin_dir in configpaths.get_plugin_dirs():
> File
> "/gnu/store/zd02xplbafrmzs2swrj3r3zx1hrsvg4y-gajim-1.2.2/lib/python3.8/site-packages/gajim/common/configpaths.py", line 50, in get_plugin_dirs
> Path(os.getenv['PLUGINS_OS']),
> --8<---------------cut here---------------end--------------->8---
Sorry, I was misled by a dev. I tries your patch instead now.
> I wrote my own patch (attached; no, I don't speak much Python). I think
> it fixes the problem but I can't test it.
Thanks! I just tested it. It works. :-)
> The plug-ins are found, but won't load with my version of Gajim.
>
> --8<---------------cut here---------------start------------->8---
> 11/19/20 15:10:01 (W) gajim.plugin_system Plugin omemo not
> loaded, newer version of gajim required: 1.2.91 <= 1.2.2 <= 1.3.90
> 11/19/20 15:10:01 (W) gajim.plugin_system Plugin openpgp not
> loaded, newer version of gajim required: 1.2.91 <= 1.2.2 <= 1.3.90
> --8<---------------cut here---------------end--------------->8---
>
> This is on current master. How are these plug-ins expected to be used?
I think you installed plugins, both via guix and via gajim's plugin
installer. You should remove one of them.
>> - (variable "GAJIM_PLUGIN_PATH")
>> + (variable "PLUGINS_OS")
>
> This doesn't look related to the fix at hand.
>
> Why remove GAJIM_?
> Why rename _PATH?
> TBH, both strike me as unnecessary regressions.
I was discussing with a Gajim Dev. They agreed to merge our patch in
Gajim's upstream. So it can be useful for other non-conventional distros
as well.
Regards,
RG.
[-- Attachment #1.1.2: 0001-gnu-gajim-Fix-loading-of-os-installed-plugins.patch --]
[-- Type: text/x-patch, Size: 4509 bytes --]
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
diff --git a/gnu/local.mk b/gnu/local.mk
index 217c05eab6..7fd98876d7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -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 \
diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index 624ad72c23..09834bfe63 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -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
diff --git a/gnu/packages/patches/gajim-plugins-os.patch b/gnu/packages/patches/gajim-plugins-os.patch
new file mode 100644
index 0000000000..80a0dfacaf
--- /dev/null
+++ b/gnu/packages/patches/gajim-plugins-os.patch
@@ -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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
next prev parent reply other threads:[~2020-11-20 0:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-18 20:50 [bug#44730] [GAJIM]: Fix loading of installed plugins Raghav Gururajan
2020-11-19 14:44 ` Tobias Geerinckx-Rice via Guix-patches via
2020-11-19 20:50 ` Raghav Gururajan [this message]
2020-11-19 21:44 ` Raghav Gururajan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dba8fa42-86b1-a28b-2dc0-dc02ed6cacfd@raghavgururajan.name \
--to=rg@raghavgururajan.name \
--cc=44730@debbugs.gnu.org \
--cc=julien@lepiller.eu \
--cc=me@tobias.gr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).