unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#31540] [PATCH] gnu: xapers: Fix recommended packages
@ 2018-05-20 22:56 Adam Massmann
  2018-05-26 19:55 ` bug#31540: " Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Adam Massmann @ 2018-05-20 22:56 UTC (permalink / raw)
  To: 31540

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

Hi Guix,

Below is a patch to fix/update inputs for xapers. When I originally
added xapers I avoided including inputs upstream considers
"recommended."  After using Guix and xapers some more and thinking about
it, I now lean towards including these inputs because in this case not
including them will break xapers functionality in undocumented ways, and
the recommended packages are relatively modest. However, I am also
curious for future use if there is any documentation on standards for
handling "recommended" packages (e.g. packages other disdros would
assign a "recommended tag" to) in Guix? I couldn't find anything in the
manual, but it is very possible I missed something.

I also disabled the "xapers-adder" command from spawning an x-terminal
program (upstream uses Debian's "x-terminal-emulator"). By disabling
this function we avoid pushing an x-terminal program onto users, which I
find undesirable (if users need to spawn a terminal they can just wrap
xapers-adder e.g. "xterm -e xapers-adder %F"). However, I'm open to
other solutions if anyone else has another preference/idea (see comment
in patch).

Feedback very welcome, and thank you very much for your time/help.

Best,
Adam


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-xapers-Fix-recommended-packages.patch --]
[-- Type: text/x-patch, Size: 4012 bytes --]

From 434455c9be92ecb34e220726dfc75b916e0eaa6c Mon Sep 17 00:00:00 2001
From: Adam Massmann <massmannak@gmail.com>
Date: Sun, 20 May 2018 18:50:03 -0400
Subject: [PATCH] gnu: xapers: Fix recommended packages

* gnu/packages/search.scm (xapers): [inputs]: remove python, poppler
[propagated-inputs]: add poppler, xclip, xdg-utils.
[arguments]: modify-phases to disable x-terminal options.
---
 gnu/packages/search.scm | 39 +++++++++++++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/search.scm b/gnu/packages/search.scm
index 02deb5c4a..5c8539d56 100644
--- a/gnu/packages/search.scm
+++ b/gnu/packages/search.scm
@@ -32,12 +32,14 @@
   #:use-module (gnu packages compression)
   #:use-module (gnu packages check)
   #:use-module (gnu packages databases)
+  #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages web)
+  #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml))
 
 (define-public xapian
@@ -326,27 +328,52 @@ search the generated indexes.")
          "0ykz6hn3qj46w3c99d6q0pi5ncq2894simcl7vapv047zm3cylmd"))))
     (build-system python-build-system)
     (propagated-inputs
-     `(("python-urwid" ,python-urwid)))
-    (inputs
      `(("poppler" ,poppler)
-       ("python" ,python)
-       ("python-latexcodec" ,python-latexcodec)
+       ("python-urwid" ,python-urwid)
+       ("xclip" ,xclip)
+       ("xdg-utils" ,xdg-utils)))
+    (inputs
+     `(("python-latexcodec" ,python-latexcodec)
        ("python-pybtex" ,python-pybtex)
        ("python-pycurl" ,python-pycurl)
        ("python-pyyaml" ,python-pyyaml)
        ("python-six" ,python-six)
        ("python-xapian-bindings" ,python-xapian-bindings)))
     (arguments
-     `(#:phases
+     `(#:modules ((ice-9 rdelim)
+                  (guix build python-build-system)
+                  (guix build utils))
+       #:phases
        (modify-phases %standard-phases
          (add-after 'install 'install-doc
            (lambda* (#:key inputs outputs #:allow-other-keys)
+             (define (purge-term-support input output)
+               (let loop ((line (read-line input)))
+                 (if (string-prefix? "if [[ \"$term\"" line)
+                     (begin (display "eval \"$cmd\"\n" output)
+                            #t)
+                     (begin (display (string-append line "\n") output)
+                            (loop (read-line input))))))
              (let* ((out (assoc-ref outputs "out"))
                     (bin (string-append out "/bin"))
+                    (adder-out (string-append bin "/xapers-adder"))
                     (man1 (string-append out "/share/man/man1")))
                (install-file "man/man1/xapers.1"  man1)
                (install-file "man/man1/xapers-adder.1" man1)
-               (install-file "bin/xapers-adder" bin)))))))
+               ;; below is equivalent to setting --no-term option
+               ;; permanently on; this is desirable to avoid imposing
+               ;; an x-terminal installation on the user but breaks
+               ;; some potential xapers-adder uses like auto browser
+               ;; pdf handler, but user could instead still use
+               ;; e.g. "xterm -e xapers-adder %F" for same use.
+               ;; alternatively we could propagate xterm as an input
+               ;; and replace 'x-terminal-emulator' with 'xterm'
+               (call-with-input-file "bin/xapers-adder"
+                 (lambda (input)
+                   (call-with-output-file adder-out
+                     (lambda (output)
+                       (purge-term-support input output)))))
+               (chmod adder-out #o555)))))))
     (home-page "https://finestructure.net/xapers/")
     (synopsis "Personal document indexing system")
     (description
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#31540: [PATCH] gnu: xapers: Fix recommended packages
  2018-05-20 22:56 [bug#31540] [PATCH] gnu: xapers: Fix recommended packages Adam Massmann
@ 2018-05-26 19:55 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2018-05-26 19:55 UTC (permalink / raw)
  To: Adam Massmann; +Cc: 31540-done

Hi Adam,

Adam Massmann <massmannak@gmail.com> skribis:

> Below is a patch to fix/update inputs for xapers. When I originally
> added xapers I avoided including inputs upstream considers
> "recommended."  After using Guix and xapers some more and thinking about
> it, I now lean towards including these inputs because in this case not
> including them will break xapers functionality in undocumented ways, and
> the recommended packages are relatively modest. However, I am also
> curious for future use if there is any documentation on standards for
> handling "recommended" packages (e.g. packages other disdros would
> assign a "recommended tag" to) in Guix? I couldn't find anything in the
> manual, but it is very possible I missed something.

There’s currently no mechanism to recommend a package.  However in this
case the recommend packages need to be present at build time, not just
at configure time IIUC, so a recommendation system wouldn’t help, would
it?

For optional build-time dependencies, a criterion we commonly use is the
benefit vs. space ratio.  So basically you run ‘guix size’ with and
without the optional dependency, and based on that you determine whether
it’s a good idea to add it.

Here I get 323 MiB with your patch and 324 MiB (!) without it for the
whole xapers closure.  I think that’s because the new one no longer
refers to xterm or something?

> I also disabled the "xapers-adder" command from spawning an x-terminal
> program (upstream uses Debian's "x-terminal-emulator"). By disabling
> this function we avoid pushing an x-terminal program onto users, which I
> find undesirable (if users need to spawn a terminal they can just wrap
> xapers-adder e.g. "xterm -e xapers-adder %F"). However, I'm open to
> other solutions if anyone else has another preference/idea (see comment
> in patch).

Makes sense to me.

>>From 434455c9be92ecb34e220726dfc75b916e0eaa6c Mon Sep 17 00:00:00 2001
> From: Adam Massmann <massmannak@gmail.com>
> Date: Sun, 20 May 2018 18:50:03 -0400
> Subject: [PATCH] gnu: xapers: Fix recommended packages
>
> * gnu/packages/search.scm (xapers): [inputs]: remove python, poppler
> [propagated-inputs]: add poppler, xclip, xdg-utils.
> [arguments]: modify-phases to disable x-terminal options.

Applied, thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-26 19:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-20 22:56 [bug#31540] [PATCH] gnu: xapers: Fix recommended packages Adam Massmann
2018-05-26 19:55 ` bug#31540: " Ludovic Courtès

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).