unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Oleg Pykhalov <go.wigust@gmail.com>
Cc: 29686@debbugs.gnu.org, Pierre Neidhardt <mail@ambrevar.xyz>
Subject: bug#29686: gnu: aspell: Do not ignore GuixOS system profile.
Date: Wed, 13 Nov 2019 18:51:43 +0100	[thread overview]
Message-ID: <87v9rnmzps.fsf@gnu.org> (raw)
In-Reply-To: <87h8slunjn.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 20 Dec 2017 21:55:40 +0100")

[-- Attachment #1: Type: text/plain, Size: 2761 bytes --]

Hi Oleg & Pierre,

ludo@gnu.org (Ludovic Courtès) skribis:

> Indeed.  I have:
>
> $ guix environment --ad-hoc aspell aspell-dict-ru -C -- aspell --config | grep -A3 dict-dir
> # dict-dir (string)
> #   location of the main word list
> # default: <$ASPELL_DICT_DIR|home-dir/.guix-profile/lib/aspell> = /gnu/store/b411b0fbwc85fjnf0h030gdkbv1qdmqh-profile/lib/aspell
> dict-dir /home/ludo/.guix-profile/lib/aspell
>
> # encoding (string)
> #   encoding to expect data to be in
> --
> # default: <actual-dict-dir> = /home/ludo/.guix-profile/lib/aspell/
>
> # master (string)
> #   base name of the main dictionary to use
>
> The value that shows up after the “=” sign is as expected (it’s
> $ASPELL_DICT_DIR), but the value shown on the line below is not.
>
> Sounds like a problem in ‘aspell-dict-dir.patch’.

Actually the problem is the ‘wrap-aspell’ phase, which predates
‘aspell-dict-dir.patch’ and is unnecessary in the presence of this
patch.

In addition to removing the phase, the patch had to be adjusted so that
it would actually adjust the right-hand size of ‘|’ for ‘dict-dir’ (a
bug that apparently went unnoticed, probably because the ‘wrap-aspell’
phase was hiding it).

With the patch below, I get:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix environment --ad-hoc aspell aspell-dict-ru -C -- aspell --config |grep -A2 '^# dict-dir'
# dict-dir (string)
#   location of the main word list
# default: <$ASPELL_DICT_DIR|$HOME/.guix-profile/lib/aspell> = /gnu/store/adfc4l73nw3ccai3h5im21wblmrhfy4z-profile/lib/aspell
--8<---------------cut here---------------end--------------->8---

and:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix environment --ad-hoc aspell aspell-dict-ru -C -- aspell dicts
ru
ru-ye
ru-yeyo
ru-yo
--8<---------------cut here---------------end--------------->8---

… while still getting the intended result when running it outside ‘guix
environment’:

--8<---------------cut here---------------start------------->8---
$ (unset ASPELL_DICT_DIR;  ./pre-inst-env guix environment --ad-hoc aspell -K -- aspell --config) |grep -A2 '^# dict-dir'
# dict-dir (string)
#   location of the main word list
# default: <$ASPELL_DICT_DIR|$HOME/.guix-profile/lib/aspell> = /home/ludo/.guix-profile/lib/aspell
$ (unset ASPELL_DICT_DIR;  ./pre-inst-env guix environment --ad-hoc aspell -K -- aspell dicts) |wc -l
58
$ (unset HOME;  ./pre-inst-env guix environment --ad-hoc aspell -K -- aspell dicts) |wc -l
58
--8<---------------cut here---------------end--------------->8---

I’ll apply it on ‘core-updates’ if it’s fine with you.

Ludo’.


[-- Attachment #2: Type: text/x-patch, Size: 2890 bytes --]

diff --git a/gnu/packages/aspell.scm b/gnu/packages/aspell.scm
index af38c149c2..a5d02a453d 100644
--- a/gnu/packages/aspell.scm
+++ b/gnu/packages/aspell.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
 ;;; Copyright © 2016, 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
@@ -65,14 +65,6 @@
                  (("\"filter-path(.*)DICT_DIR" _ middle)
                   (string-append "\"filter-path" middle
                                  "\"" libdir "\"")))
-               #t)))
-         (add-after 'install 'wrap-aspell
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((bin/aspell (string-append (assoc-ref outputs "out")
-                                              "/bin/aspell")))
-               (wrap-program bin/aspell
-                 '("ASPELL_CONF" "" =
-                   ("${ASPELL_CONF:-\"dict-dir ${GUIX_PROFILE:-$HOME/.guix-profile}/lib/aspell\"}")))
                #t))))))
     (inputs `(("perl" ,perl)))
 
diff --git a/gnu/packages/patches/aspell-default-dict-dir.patch b/gnu/packages/patches/aspell-default-dict-dir.patch
index 17a6ff606f..5f759a66d9 100644
--- a/gnu/packages/patches/aspell-default-dict-dir.patch
+++ b/gnu/packages/patches/aspell-default-dict-dir.patch
@@ -8,12 +8,34 @@ However it is necessary for applications that use libaspell since
 
 --- a/common/config.cpp
 +++ b/common/config.cpp
+@@ -651,7 +651,20 @@ namespace acommon {
+ 	  } else { // sep == '|'
+ 	    assert(replace[0] == '$');
+ 	    const char * env = getenv(replace.c_str()+1);
+-	    final_str += env ? env : second;
++	    if (env) {
++	      final_str += env;
++	    } else if (second[0] == '$') {
++	      // Expand the right-hand side of '|', which starts with a
++	      // reference to an environment variable.
++	      auto slash = second.find('/');
++	      String variable = second.substr(1, slash - 1);
++	      const char * env = getenv(variable.c_str());
++	      String value = env ? String(env) : "";
++	      value += second.substr(slash, second.size() - slash);
++	      final_str += value;
++	    } else {
++	      final_str += second;
++	    }
+ 	  }
+ 	  replace = "";
+ 	  in_replace = false;
 @@ -1349,6 +1349,9 @@ namespace acommon {
  #  define REPL     ".aspell.<lang>.prepl"
  #endif
  
 +#undef DICT_DIR
-+#define DICT_DIR "<$ASPELL_DICT_DIR|home-dir/.guix-profile/lib/aspell>"
++#define DICT_DIR "<$ASPELL_DICT_DIR|$HOME/.guix-profile/lib/aspell>"
 +
    static const KeyInfo config_keys[] = {
      // the description should be under 50 chars

  reply	other threads:[~2019-11-13 17:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-13  6:43 bug#29686: gnu: aspell: Do not ignore GuixOS system profile Oleg Pykhalov
2017-12-13 21:52 ` Ludovic Courtès
2017-12-20 13:14   ` Ludovic Courtès
2017-12-20 14:47     ` Oleg Pykhalov
2017-12-20 20:55       ` Ludovic Courtès
2019-11-13 17:51         ` Ludovic Courtès [this message]
2019-11-14 11:22           ` Pierre Neidhardt
2019-11-14 21:39             ` Ludovic Courtès
2019-10-17 13:04 ` Pierre Neidhardt
2019-10-26 11:02   ` Pierre Neidhardt
2019-10-27 22:31     ` Ludovic Courtès
2019-10-28  7:42       ` Pierre Neidhardt

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=87v9rnmzps.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=29686@debbugs.gnu.org \
    --cc=go.wigust@gmail.com \
    --cc=mail@ambrevar.xyz \
    /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).