From patchwork Thu Nov 19 20:50:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Raghav Gururajan X-Patchwork-Id: 25188 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A18CC27BBF6; Fri, 20 Nov 2020 00:15:23 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id BC0FF27BBF7 for ; Fri, 20 Nov 2020 00:15:22 +0000 (GMT) Received: from localhost ([::1]:44796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kfu5B-0004to-Om for patchwork@mira.cbaines.net; Thu, 19 Nov 2020 19:15:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfu4t-0004q6-CS for guix-patches@gnu.org; Thu, 19 Nov 2020 19:15:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:58039) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kfu4s-0000Hr-Vo for guix-patches@gnu.org; Thu, 19 Nov 2020 19:15:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kfu4s-0004fO-Qt for guix-patches@gnu.org; Thu, 19 Nov 2020 19:15:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#44730] [GAJIM]: Fix loading of installed plugins Resent-From: Raghav Gururajan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 20 Nov 2020 00:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44730 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Tobias Geerinckx-Rice Cc: julien@lepiller.eu, 44730@debbugs.gnu.org X-Debbugs-Original-Cc: Julien Lepiller , 44730@debbugs.gnu.org, guix-patches@gnu.org Received: via spool by 44730-submit@debbugs.gnu.org id=B44730.160583124417824 (code B ref 44730); Fri, 20 Nov 2020 00:15:02 +0000 Received: (at 44730) by debbugs.gnu.org; 20 Nov 2020 00:14:04 +0000 Received: from localhost ([127.0.0.1]:41342 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kfu3s-0004cW-Aa for submit@debbugs.gnu.org; Thu, 19 Nov 2020 19:14:04 -0500 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:47681) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kfqtO-00066k-MS for 44730@debbugs.gnu.org; Thu, 19 Nov 2020 15:51:02 -0500 X-Originating-IP: 174.89.21.249 Received: from [192.168.2.62] (bras-vprn-ckvlon0125w-lp130-03-174-89-21-249.dsl.bell.ca [174.89.21.249]) (Authenticated sender: rg@raghavgururajan.name) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 79C591BF205; Thu, 19 Nov 2020 20:50:51 +0000 (UTC) References: <101c1bb4-2513-b1de-2962-436b4431f836@raghavgururajan.name> <87eekp76eo.fsf@nckx> From: Raghav Gururajan Autocrypt: addr=rg@raghavgururajan.name; keydata= xjMEX2ZCJBYJKwYBBAHaRw8BAQdAdiUK33kml2dYjrWidlr4/v0pmjpUv7hOsBN/oSl5wx7N L1JhZ2hhdiBHdXJ1cmFqYW4gKFJHKSA8cmdAcmFnaGF2Z3VydXJhamFuLm5hbWU+wpMEExYI ADsCGwMFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AWIQTNLV6qqYzLN9qR1rBfWBZkf4vlUQUC X28v0AIZAQAKCRBfWBZkf4vlUQf2AQD63gsdJzk0w6Gy0AzpJtMa63mbVRAh4xfnxsRNu6Sb GQD/UDytGjwnQ4nKYsGdoCcA7LM64EkknDvI3ZmlqG7Xuw/OOARfZkIkEgorBgEEAZdVAQUB AQdAZgiqc2NhH/myrCCan9x7gKI6QBPZ/1b+Bz/f3n95ozkDAQgHwngEGBYIACAWIQTNLV6q qYzLN9qR1rBfWBZkf4vlUQUCX2ZCJAIbDAAKCRBfWBZkf4vlUV/OAQD+tMNgmddPSchLpaDP psdDhpvra2uTonNUmnfbTvPgpQD/dG72NCT8hBUVqtzxwQmBrXY/nPEUxctYuvu3unUmzQU= Message-ID: Date: Thu, 19 Nov 2020 15:50:49 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Icedove/78.4.0 MIME-Version: 1.0 In-Reply-To: <87eekp76eo.fsf@nckx> X-Mailman-Approved-At: Thu, 19 Nov 2020 19:13:59 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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. From e102e488114673069f879afb3796a8e6fb69aaf4 Mon Sep 17 00:00:00 2001 From: Raghav Gururajan 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 +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