Re: [PATCH] gnu: password-store: Wrap PATH.

2016-07-29 Thread Mathieu Lirzin
Alex Griffin  writes:

> On Fri, Jul 29, 2016, at 09:02 AM, Thompson, David wrote:
>> Sorry I'm late, but I don't think this is the right fix.  

Sorry for not letting you the time to respond.

>> Wrapping programs should only be considered after other options are
>> exhausted.  The correct fix is to patch the source directly to refer
>> to executables by their absolute path.  Why wasn't it done this way?
>
> Mostly because it would be a lot of on-going work every time the package
> is updated. As a shell script, it invokes an external tool nearly every
> other line. If you look at the discussion that happened in February when
> the package was first added [1], Jessica (the original packager) was
> really discouraged by the prospect of patching every invocation of an
> external tool. She also tried to submit changes upstream so that kind of
> work wouldn't be necessary, but upstream wasn't very receptive to the
> idea. In the end, the package was just committed to Guix in a broken
> state.
>
> Another approach I considered was adding a bunch of shell aliases to the
> top of the script pointing to the Guix store. That makes the problem a
> lot more tractable than replacing every external invocation, but it's
> still kinda complicated and it still requires finding every single
> program that gets called and keeping it up to date with new releases. So
> even if all upstream does is use another program from coreutils, the fix
> would be out-of-date again.
>
> [1]: https://lists.gnu.org/archive/html/guix-devel/2016-02/msg01310.html

This makes sense to me.

-- 
Mathieu Lirzin



Re: [PATCH] gnu: password-store: Wrap PATH.

2016-07-29 Thread Alex Griffin
On Fri, Jul 29, 2016, at 09:02 AM, Thompson, David wrote:
> Sorry I'm late, but I don't think this is the right fix.  Wrapping
> programs should only be considered after other options are exhausted.
> The correct fix is to patch the source directly to refer to
> executables by their absolute path.  Why wasn't it done this way?

Mostly because it would be a lot of on-going work every time the package
is updated. As a shell script, it invokes an external tool nearly every
other line. If you look at the discussion that happened in February when
the package was first added [1], Jessica (the original packager) was
really discouraged by the prospect of patching every invocation of an
external tool. She also tried to submit changes upstream so that kind of
work wouldn't be necessary, but upstream wasn't very receptive to the
idea. In the end, the package was just committed to Guix in a broken
state.

Another approach I considered was adding a bunch of shell aliases to the
top of the script pointing to the Guix store. That makes the problem a
lot more tractable than replacing every external invocation, but it's
still kinda complicated and it still requires finding every single
program that gets called and keeping it up to date with new releases. So
even if all upstream does is use another program from coreutils, the fix
would be out-of-date again.

[1]: https://lists.gnu.org/archive/html/guix-devel/2016-02/msg01310.html
-- 
Alex Griffin



Re: [PATCH] gnu: password-store: Wrap PATH.

2016-07-29 Thread Thompson, David
On Fri, Jul 29, 2016 at 5:07 AM, Mathieu Lirzin  wrote:
> Hello,
>
> Alex Griffin  writes:
>
>> On Thu, Jul 28, 2016, at 07:20 PM, Alex Griffin wrote:
>>
>> From 74b838fea52293386169299881cdd7cfefff7f4d Mon Sep 17 00:00:00 2001
>> From: Alex Griffin 
>> Date: Thu, 28 Jul 2016 19:06:10 -0500
>> Subject: [PATCH] gnu: password-store: Wrap PATH.
>>
>> * gnu/packages/password-utils.scm (password-store):
>> [arguments]: Wrap PATH more thoroughly.
>> [native-inputs]: Move getopt to inputs.
>> [inputs]: Add sed & alphabetize packages.
>   ^^
> Indentation and formatting changes can be omitted in commit log.
>
>> ---
>>  gnu/packages/password-utils.scm | 33 -
>>  1 file changed, 16 insertions(+), 17 deletions(-)
>>
>> diff --git a/gnu/packages/password-utils.scm 
>> b/gnu/packages/password-utils.scm
>> index a03214a..497717f 100644
>> --- a/gnu/packages/password-utils.scm
>> +++ b/gnu/packages/password-utils.scm
>> @@ -6,6 +6,7 @@
>>  ;;; Copyright © 2016 Jessica Tallon 
>>  ;;; Copyright © 2016 Andreas Enge 
>>  ;;; Copyright © 2016 Lukas Gradl 
>> +;;; Copyright © 2016 Alex Griffin 
>>  ;;;
>>  ;;; This file is part of GNU Guix.
>>  ;;;
>> @@ -266,27 +267,25 @@ any X11 window.")
>>   '(#:phases
>> (modify-phases %standard-phases
>>   (delete 'configure)
>> - (add-after
>> -  ;; The script requires 'getopt' at run-time, and this allows
>> -  ;; the user to not install the providing package 'util-linux'
>> -  ;; in their profile.
>> -  'unpack 'patch-path
>> -  (lambda* (#:key inputs outputs #:allow-other-keys)
>> -(let ((getopt (string-append (assoc-ref inputs "getopt")
>> - "/bin/getopt")))
>> -  (substitute* "src/password-store.sh"
>> -(("GETOPT=\"getopt\"")
>> - (string-append "GETOPT=\"" getopt "\"")))
>> -  #t
>> + (add-after 'install 'wrap-path
>> +   (lambda* (#:key inputs outputs #:allow-other-keys)
>> + (let* ((out (assoc-ref outputs "out"))
>> +(path (map (lambda (pkg)
>> + (string-append (assoc-ref inputs pkg) 
>> "/bin"))
>> +   '("coreutils" "getopt" "git" "gnupg" "pwgen"
>> + "sed" "tree" "which" "xclip"
>> +   (wrap-program (string-append out "/bin/pass")
>> + `("PATH" ":" prefix (,(string-join path ":"
>
> 'let*' can safely be replaced by 'let' here.
>
>> #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
>> #:test-target "test"))
>> -(native-inputs `(("getopt" ,util-linux))) ; getopt for the tests
>> -(inputs `(("gnupg" ,gnupg)
>> -  ("pwgen" ,pwgen)
>> -  ("xclip" ,xclip)
>> +(inputs `(("getopt" ,util-linux)
>>("git" ,git)
>> +  ("gnupg" ,gnupg)
>> +  ("pwgen" ,pwgen)
>> +  ("sed" ,sed)
>>("tree" ,tree)
>> -  ("which" ,which)))
>> +  ("which" ,which)
>> +  ("xclip" ,xclip)))
>>  (home-page "http://www.passwordstore.org/;)
>>  (synopsis "Encrypted password manager")
>>  (description "Password-store is a password manager which uses GnuPG to
>
> Pushed in commit 61201e46a72b715e1a38ce56932c3f4f2d3885b4.

Sorry I'm late, but I don't think this is the right fix.  Wrapping
programs should only be considered after other options are exhausted.
The correct fix is to patch the source directly to refer to
executables by their absolute path.  Why wasn't it done this way?

- Dave



Re: [PATCH] gnu: password-store: Wrap PATH.

2016-07-28 Thread Alex Griffin
On Thu, Jul 28, 2016, at 07:20 PM, Alex Griffin wrote:
> This patch fixes password-store so that you no longer need to install
> its dependencies into your profile.

Forgot a copyright line. Here's an updated patch.
-- 
Alex Griffin
From 74b838fea52293386169299881cdd7cfefff7f4d Mon Sep 17 00:00:00 2001
From: Alex Griffin 
Date: Thu, 28 Jul 2016 19:06:10 -0500
Subject: [PATCH] gnu: password-store: Wrap PATH.

* gnu/packages/password-utils.scm (password-store):
[arguments]: Wrap PATH more thoroughly.
[native-inputs]: Move getopt to inputs.
[inputs]: Add sed & alphabetize packages.
---
 gnu/packages/password-utils.scm | 33 -
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index a03214a..497717f 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2016 Jessica Tallon 
 ;;; Copyright © 2016 Andreas Enge 
 ;;; Copyright © 2016 Lukas Gradl 
+;;; Copyright © 2016 Alex Griffin 
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -266,27 +267,25 @@ any X11 window.")
  '(#:phases
(modify-phases %standard-phases
  (delete 'configure)
- (add-after
-  ;; The script requires 'getopt' at run-time, and this allows
-  ;; the user to not install the providing package 'util-linux'
-  ;; in their profile.
-  'unpack 'patch-path
-  (lambda* (#:key inputs outputs #:allow-other-keys)
-(let ((getopt (string-append (assoc-ref inputs "getopt")
- "/bin/getopt")))
-  (substitute* "src/password-store.sh"
-(("GETOPT=\"getopt\"")
- (string-append "GETOPT=\"" getopt "\"")))
-  #t
+ (add-after 'install 'wrap-path
+   (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+(path (map (lambda (pkg)
+ (string-append (assoc-ref inputs pkg) "/bin"))
+   '("coreutils" "getopt" "git" "gnupg" "pwgen"
+ "sed" "tree" "which" "xclip"
+   (wrap-program (string-append out "/bin/pass")
+ `("PATH" ":" prefix (,(string-join path ":"
#:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
#:test-target "test"))
-(native-inputs `(("getopt" ,util-linux))) ; getopt for the tests
-(inputs `(("gnupg" ,gnupg)
-  ("pwgen" ,pwgen)
-  ("xclip" ,xclip)
+(inputs `(("getopt" ,util-linux)
   ("git" ,git)
+  ("gnupg" ,gnupg)
+  ("pwgen" ,pwgen)
+  ("sed" ,sed)
   ("tree" ,tree)
-  ("which" ,which)))
+  ("which" ,which)
+  ("xclip" ,xclip)))
 (home-page "http://www.passwordstore.org/;)
 (synopsis "Encrypted password manager")
 (description "Password-store is a password manager which uses GnuPG to
-- 
2.9.2