GNU bug report logs - #26770
[PATCH] gnu: tailon: Add missing inputs.

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Thu, 4 May 2017 06:48:01 UTC

Severity: normal

Tags: patch

Done: Marius Bakke <mbakke <at> fastmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26770 in the body.
You can then email your comments to 26770 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#26770; Package guix-patches. (Thu, 04 May 2017 06:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Baines <mail <at> cbaines.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 04 May 2017 06:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: tailon: Add missing inputs.
Date: Thu,  4 May 2017 07:47:15 +0100
* gnu/packages/logging.scm (tailon)[inputs]: Add grep, gawk, sed and coreutils
  as inputs.
  [arguments]: Wrap bin/tailon to include some inputs in the PATH.
---
 gnu/packages/logging.scm | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/logging.scm b/gnu/packages/logging.scm
index 2523d65f6..060521eab 100644
--- a/gnu/packages/logging.scm
+++ b/gnu/packages/logging.scm
@@ -26,6 +26,8 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages gawk)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages python)
   #:use-module (gnu packages autotools))
@@ -108,7 +110,25 @@ command line.")
     (inputs
      `(("python-pyyaml" ,python-pyyaml)
        ("python-sockjs-tornado" ,python-sockjs-tornado)
-       ("python-tornado" ,python-tornado)))
+       ("python-tornado" ,python-tornado)
+       ("grep" ,grep)
+       ("gawk" ,gawk)
+       ("sed" ,sed)
+       ("tail" ,coreutils)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'wrap-tailon-path
+                    (lambda* (#:key inputs outputs #:allow-other-keys)
+                      (let ((out (assoc-ref outputs "out")))
+                        (wrap-program (string-append out "/bin/tailon")
+                          `("PATH" ":" prefix ,(map
+                                                (lambda (input)
+                                                  (string-append
+                                                   (assoc-ref inputs input)
+                                                   "/bin"))
+                                                '("grep" "gawk" "sed" "tail"))))
+                        #t))))))
     (home-page "https://tailon.readthedocs.io/")
     (synopsis
      "Webapp for looking at and searching through log files")
-- 
2.12.0





Information forwarded to guix-patches <at> gnu.org:
bug#26770; Package guix-patches. (Fri, 05 May 2017 16:34:01 GMT) Full text and rfc822 format available.

Message #8 received at 26770 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: Christopher Baines <mail <at> cbaines.net>, 26770 <at> debbugs.gnu.org
Subject: Re: bug#26770: [PATCH] gnu: tailon: Add missing inputs.
Date: Fri, 05 May 2017 18:33:41 +0200
[Message part 1 (text/plain, inline)]
Christopher Baines <mail <at> cbaines.net> writes:

> * gnu/packages/logging.scm (tailon)[inputs]: Add grep, gawk, sed and coreutils
>   as inputs.
>   [arguments]: Wrap bin/tailon to include some inputs in the PATH.

Generally it's better to fully qualify the paths to these programs in
the code. Is that difficult here?

I think all of these inputs are already available, so you can do e.g.:
(substitute "foo"
  (("'grep'") (which "grep))
  (("'gawk'") (which "gawk")))

...instead of referencing the inputs explicitly.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#26770; Package guix-patches. (Mon, 15 May 2017 06:12:02 GMT) Full text and rfc822 format available.

Message #11 received at 26770 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: 26770 <at> debbugs.gnu.org
Subject: [PATCH] gnu: tailon: Use absolute paths for commands.
Date: Mon, 15 May 2017 07:11:55 +0100
* gnu/packages/logging.scm (tailon)[arguments]: Patch commands.py to reference
  grep, awk, sed and tail by absolute paths.
---
 gnu/packages/logging.scm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gnu/packages/logging.scm b/gnu/packages/logging.scm
index 2523d65f6..11bbfef52 100644
--- a/gnu/packages/logging.scm
+++ b/gnu/packages/logging.scm
@@ -109,6 +109,22 @@ command line.")
      `(("python-pyyaml" ,python-pyyaml)
        ("python-sockjs-tornado" ,python-sockjs-tornado)
        ("python-tornado" ,python-tornado)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'wrap-tailon-path
+                    (lambda* (#:key inputs outputs #:allow-other-keys)
+                      (let ((out (assoc-ref outputs "out")))
+                        (substitute* (find-files out "commands.py")
+                          (("self\\.first_in_path\\('grep'\\)")
+                           (string-append"'" (which "grep") "'"))
+                          (("self\\.first_in_path\\('gawk', 'awk'\\)")
+                           (string-append"'" (which "gawk") "'"))
+                          (("self\\.first_in_path\\('gsed', 'sed'\\)")
+                           (string-append"'" (which "sed") "'"))
+                          (("self\\.first_in_path\\('gtail', 'tail'\\)")
+                           (string-append"'" (which "tail") "'")))
+                        #t))))))
     (home-page "https://tailon.readthedocs.io/")
     (synopsis
      "Webapp for looking at and searching through log files")
-- 
2.12.0





Information forwarded to guix-patches <at> gnu.org:
bug#26770; Package guix-patches. (Mon, 15 May 2017 06:26:01 GMT) Full text and rfc822 format available.

Message #14 received at 26770 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Marius Bakke <mbakke <at> fastmail.com>
Cc: 26770 <at> debbugs.gnu.org
Subject: Re: bug#26770: [PATCH] gnu: tailon: Add missing inputs.
Date: Mon, 15 May 2017 07:25:49 +0100
[Message part 1 (text/plain, inline)]
On Fri, 05 May 2017 18:33:41 +0200
Marius Bakke <mbakke <at> fastmail.com> wrote:

> Christopher Baines <mail <at> cbaines.net> writes:
> 
> > * gnu/packages/logging.scm (tailon)[inputs]: Add grep, gawk, sed
> > and coreutils as inputs.
> >   [arguments]: Wrap bin/tailon to include some inputs in the PATH.  
> 
> Generally it's better to fully qualify the paths to these programs in
> the code. Is that difficult here?

Good point, I've send an updated patch that does this.

> I think all of these inputs are already available, so you can do e.g.:
> (substitute "foo"
>   (("'grep'") (which "grep))
>   (("'gawk'") (which "gawk")))
> 
> ...instead of referencing the inputs explicitly.

That works, I've changed that in the latest patch also.

Thanks for your review :)
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#26770; Package guix-patches. (Mon, 15 May 2017 16:00:02 GMT) Full text and rfc822 format available.

Message #17 received at 26770 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: Christopher Baines <mail <at> cbaines.net>, 26770 <at> debbugs.gnu.org
Subject: Re: bug#26770: [PATCH] gnu: tailon: Use absolute paths for commands.
Date: Mon, 15 May 2017 17:59:42 +0200
[Message part 1 (text/plain, inline)]
Christopher Baines <mail <at> cbaines.net> writes:

> * gnu/packages/logging.scm (tailon)[arguments]: Patch commands.py to reference
>   grep, awk, sed and tail by absolute paths.

Thanks for this!

[...]

> +         (add-after 'install 'wrap-tailon-path
> +                    (lambda* (#:key inputs outputs #:allow-other-keys)
> +                      (let ((out (assoc-ref outputs "out")))
> +                        (substitute* (find-files out "commands.py")
> +                          (("self\\.first_in_path\\('grep'\\)")
> +                           (string-append"'" (which "grep") "'"))
> +                          (("self\\.first_in_path\\('gawk', 'awk'\\)")
> +                           (string-append"'" (which "gawk") "'"))
> +                          (("self\\.first_in_path\\('gsed', 'sed'\\)")
> +                           (string-append"'" (which "sed") "'"))
> +                          (("self\\.first_in_path\\('gtail', 'tail'\\)")
> +                           (string-append"'" (which "tail") "'")))
> +                        #t))))))

Is there any particular reason this phase runs after 'install'? I think
we should try to avoid modifying files after they have been copied to
the store, but if doing this substitution earlier is difficult I guess
it's okay with a comment.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#26770; Package guix-patches. (Tue, 16 May 2017 19:41:02 GMT) Full text and rfc822 format available.

Message #20 received at 26770 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: 26770 <at> debbugs.gnu.org
Subject: [PATCH] gnu: tailon: Use absolute paths for commands.
Date: Tue, 16 May 2017 20:40:01 +0100
* gnu/packages/logging.scm (tailon)[arguments]: Patch commands.py to reference
  grep, awk, sed and tail by absolute paths.
---
 gnu/packages/logging.scm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gnu/packages/logging.scm b/gnu/packages/logging.scm
index 2523d65f6..203279f33 100644
--- a/gnu/packages/logging.scm
+++ b/gnu/packages/logging.scm
@@ -109,6 +109,21 @@ command line.")
      `(("python-pyyaml" ,python-pyyaml)
        ("python-sockjs-tornado" ,python-sockjs-tornado)
        ("python-tornado" ,python-tornado)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-commands.py
+                     (lambda args
+                       (substitute* (find-files "." "commands\\.py")
+                         (("self\\.first_in_path\\('grep'\\)")
+                          (string-append"'" (which "grep") "'"))
+                         (("self\\.first_in_path\\('gawk', 'awk'\\)")
+                          (string-append"'" (which "gawk") "'"))
+                         (("self\\.first_in_path\\('gsed', 'sed'\\)")
+                          (string-append"'" (which "sed") "'"))
+                         (("self\\.first_in_path\\('gtail', 'tail'\\)")
+                          (string-append"'" (which "tail") "'")))
+                       #t)))))
     (home-page "https://tailon.readthedocs.io/")
     (synopsis
      "Webapp for looking at and searching through log files")
-- 
2.12.0





Information forwarded to guix-patches <at> gnu.org:
bug#26770; Package guix-patches. (Tue, 16 May 2017 19:50:01 GMT) Full text and rfc822 format available.

Message #23 received at 26770 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Marius Bakke <mbakke <at> fastmail.com>
Cc: 26770 <at> debbugs.gnu.org
Subject: Re: bug#26770: [PATCH] gnu: tailon: Use absolute paths for commands.
Date: Tue, 16 May 2017 20:49:28 +0100
[Message part 1 (text/plain, inline)]
On Mon, 15 May 2017 17:59:42 +0200
Marius Bakke <mbakke <at> fastmail.com> wrote:

> Christopher Baines <mail <at> cbaines.net> writes:
> > +         (add-after 'install 'wrap-tailon-path
> > +                    (lambda* (#:key inputs outputs
> > #:allow-other-keys)
> > +                      (let ((out (assoc-ref outputs "out")))
> > +                        (substitute* (find-files out "commands.py")
> > +                          (("self\\.first_in_path\\('grep'\\)")
> > +                           (string-append"'" (which "grep") "'"))
> > +                          (("self\\.first_in_path\\('gawk',
> > 'awk'\\)")
> > +                           (string-append"'" (which "gawk") "'"))
> > +                          (("self\\.first_in_path\\('gsed',
> > 'sed'\\)")
> > +                           (string-append"'" (which "sed") "'"))
> > +                          (("self\\.first_in_path\\('gtail',
> > 'tail'\\)")
> > +                           (string-append"'" (which "tail") "'")))
> > +                        #t))))))  
> 
> Is there any particular reason this phase runs after 'install'? I
> think we should try to avoid modifying files after they have been
> copied to the store, but if doing this substitution earlier is
> difficult I guess it's okay with a comment.

No, I just put it there by default, but I can see why doing the
substitution earlier would be better. I've sent another patch that
moves it to after the unpack phase. 
[Message part 2 (application/pgp-signature, inline)]

Reply sent to Marius Bakke <mbakke <at> fastmail.com>:
You have taken responsibility. (Wed, 17 May 2017 14:54:03 GMT) Full text and rfc822 format available.

Notification sent to Christopher Baines <mail <at> cbaines.net>:
bug acknowledged by developer. (Wed, 17 May 2017 14:54:04 GMT) Full text and rfc822 format available.

Message #28 received at 26770-done <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 26770-done <at> debbugs.gnu.org
Subject: Re: bug#26770: [PATCH] gnu: tailon: Use absolute paths for commands.
Date: Wed, 17 May 2017 16:53:45 +0200
[Message part 1 (text/plain, inline)]
Christopher Baines <mail <at> cbaines.net> writes:

> On Mon, 15 May 2017 17:59:42 +0200
> Marius Bakke <mbakke <at> fastmail.com> wrote:
>
>> Christopher Baines <mail <at> cbaines.net> writes:
>> > +         (add-after 'install 'wrap-tailon-path
>> > +                    (lambda* (#:key inputs outputs
>> > #:allow-other-keys)
>> > +                      (let ((out (assoc-ref outputs "out")))
>> > +                        (substitute* (find-files out "commands.py")
>> > +                          (("self\\.first_in_path\\('grep'\\)")
>> > +                           (string-append"'" (which "grep") "'"))
>> > +                          (("self\\.first_in_path\\('gawk',
>> > 'awk'\\)")
>> > +                           (string-append"'" (which "gawk") "'"))
>> > +                          (("self\\.first_in_path\\('gsed',
>> > 'sed'\\)")
>> > +                           (string-append"'" (which "sed") "'"))
>> > +                          (("self\\.first_in_path\\('gtail',
>> > 'tail'\\)")
>> > +                           (string-append"'" (which "tail") "'")))
>> > +                        #t))))))  
>> 
>> Is there any particular reason this phase runs after 'install'? I
>> think we should try to avoid modifying files after they have been
>> copied to the store, but if doing this substitution earlier is
>> difficult I guess it's okay with a comment.
>
> No, I just put it there by default, but I can see why doing the
> substitution earlier would be better. I've sent another patch that
> moves it to after the unpack phase. 

Applied, thank you! My rationale was that the store may be on slow
storage (say NFS), whereas the build directory is probably a tmpfs
or local storage.

Note: I replaced the "find-files" invocation with just the one file
path. Hope that was okay!
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#26770; Package guix-patches. (Thu, 18 May 2017 18:51:02 GMT) Full text and rfc822 format available.

Message #31 received at 26770-done <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Marius Bakke <mbakke <at> fastmail.com>
Cc: 26770-done <at> debbugs.gnu.org
Subject: Re: bug#26770: [PATCH] gnu: tailon: Use absolute paths for commands.
Date: Thu, 18 May 2017 19:50:02 +0100
[Message part 1 (text/plain, inline)]
On 17/05/17 15:53, Marius Bakke wrote:
> Christopher Baines <mail <at> cbaines.net> writes:
> 
>> On Mon, 15 May 2017 17:59:42 +0200
>> Marius Bakke <mbakke <at> fastmail.com> wrote:
>>
>>> Christopher Baines <mail <at> cbaines.net> writes:
>>>> +         (add-after 'install 'wrap-tailon-path
>>>> +                    (lambda* (#:key inputs outputs
>>>> #:allow-other-keys)
>>>> +                      (let ((out (assoc-ref outputs "out")))
>>>> +                        (substitute* (find-files out "commands.py")
>>>> +                          (("self\\.first_in_path\\('grep'\\)")
>>>> +                           (string-append"'" (which "grep") "'"))
>>>> +                          (("self\\.first_in_path\\('gawk',
>>>> 'awk'\\)")
>>>> +                           (string-append"'" (which "gawk") "'"))
>>>> +                          (("self\\.first_in_path\\('gsed',
>>>> 'sed'\\)")
>>>> +                           (string-append"'" (which "sed") "'"))
>>>> +                          (("self\\.first_in_path\\('gtail',
>>>> 'tail'\\)")
>>>> +                           (string-append"'" (which "tail") "'")))
>>>> +                        #t))))))  
>>>
>>> Is there any particular reason this phase runs after 'install'? I
>>> think we should try to avoid modifying files after they have been
>>> copied to the store, but if doing this substitution earlier is
>>> difficult I guess it's okay with a comment.
>>
>> No, I just put it there by default, but I can see why doing the
>> substitution earlier would be better. I've sent another patch that
>> moves it to after the unpack phase. 
> 
> Applied, thank you! My rationale was that the store may be on slow
> storage (say NFS), whereas the build directory is probably a tmpfs
> or local storage.
> 
> Note: I replaced the "find-files" invocation with just the one file
> path. Hope that was okay!

Yep, looks good. Thanks for your review :)


[signature.asc (application/pgp-signature, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 16 Jun 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 98 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.