GNU bug report logs - #39445
[PATCH] gnu: ripgrep: Install the manpage.

Previous Next

Package: guix-patches;

Reported by: Jakub Kądziołka <kuba <at> kadziolka.net>

Date: Wed, 5 Feb 2020 21:37:01 UTC

Severity: normal

Tags: patch

Done: Efraim Flashner <efraim <at> flashner.co.il>

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 39445 in the body.
You can then email your comments to 39445 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#39445; Package guix-patches. (Wed, 05 Feb 2020 21:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jakub Kądziołka <kuba <at> kadziolka.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 05 Feb 2020 21:37:02 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: ripgrep: Install the manpage.
Date: Wed,  5 Feb 2020 22:36:50 +0100
* gnu/packages/rust-apps.scm (ripgrep)[native-inputs]: Add ASCIIDOC to
  compile the manpage.
  (ripgrep)[arguments]: Add phase: 'install-manpage. Add #:modules
  argument to import (ice-9 match).
---
 gnu/packages/rust-apps.scm | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index 90bd146442..b73efc08d9 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019, 2020 John Soo <jsoo1 <at> asu.edu>
 ;;; Copyright © 2019, 2020 Efraim Flashner <efraim <at> flashner.co.il>
+;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,6 +25,7 @@
   #:use-module (guix packages)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages crates-io)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control))
@@ -58,7 +60,24 @@
        (("rust-clap" ,rust-clap-2)
         ("rust-lazy-static" ,rust-lazy-static-1.3)
         ("rust-serde" ,rust-serde-1.0)
-        ("rust-serde-derive" ,rust-serde-derive-1.0))))
+        ("rust-serde-derive" ,rust-serde-derive-1.0))
+       #:modules ((ice-9 match)
+                  (guix build cargo-build-system)
+                  (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'build 'install-manpage
+           ;; NOTE: This is done before 'check so that there's only one output
+           ;; directory with the man page.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (match (find-files "target" "^rg\\.1$")
+               ((manpage)
+                (install-file manpage (string-append
+                                        (assoc-ref outputs "out")
+                                        "/share/man/man1"))))
+             #t)))))
+    (native-inputs
+     `(("asciidoc" ,asciidoc)))
     (home-page "https://github.com/BurntSushi/ripgrep")
     (synopsis "Line-oriented search tool")
     (description
-- 
2.25.0





Information forwarded to guix-patches <at> gnu.org:
bug#39445; Package guix-patches. (Sun, 09 Feb 2020 21:52:01 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: 39445 <at> debbugs.gnu.org
Subject: [PATCH v2 1/2] gnu: ripgrep: Install the manpage.
Date: Sun,  9 Feb 2020 22:51:09 +0100
* gnu/packages/rust-apps.scm (ripgrep)[native-inputs]: Add ASCIIDOC to
  compile the manpage.
  (ripgrep)[arguments]: Add phase: 'install-manpage. Add #:modules
  argument to import (ice-9 match).
---
This patch no longer applies after #39500, so I'm sending a new version
to resolve the conflict. I have also added a second patch to the
patchstack that enables the PCRE2 feature, as sending it separately
would have some potential for generating merge conflicts.

 gnu/packages/rust-apps.scm | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index d1d7d225a7..ddc9f6ed37 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -25,6 +25,7 @@
   #:use-module (guix packages)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages crates-io)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages jemalloc)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages tls)
@@ -226,7 +227,24 @@ provides defaults for 80% of the use cases.")
         ("rust-termcolor" ,rust-termcolor-1.0))
        #:cargo-development-inputs
        (("rust-serde" ,rust-serde-1.0)
-        ("rust-serde-derive" ,rust-serde-derive-1.0))))
+        ("rust-serde-derive" ,rust-serde-derive-1.0))
+       #:modules ((ice-9 match)
+                  (guix build cargo-build-system)
+                  (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'build 'install-manpage
+           ;; NOTE: This is done before 'check so that there's only one output
+           ;; directory with the man page.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (match (find-files "target" "^rg\\.1$")
+               ((manpage)
+                (install-file manpage (string-append
+                                        (assoc-ref outputs "out")
+                                        "/share/man/man1"))))
+             #t)))))
+    (native-inputs
+     `(("asciidoc" ,asciidoc)))
     (home-page "https://github.com/BurntSushi/ripgrep")
     (synopsis "Line-oriented search tool")
     (description
-- 
2.25.0





Information forwarded to guix-patches <at> gnu.org:
bug#39445; Package guix-patches. (Sun, 09 Feb 2020 21:52:02 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: 39445 <at> debbugs.gnu.org
Subject: [PATCH v2 2/2] gnu: ripgrep: enable the 'pcre2' feature
Date: Sun,  9 Feb 2020 22:51:10 +0100
* gnu/packages/rust-apps.scm (ripgrep)[arguments]: Add
  #:cargo-build-flags to specify the feature. Replace the 'install phase
  to work around the cargo-build-system a bit.
---
 gnu/packages/rust-apps.scm | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index ddc9f6ed37..26b5445d98 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -242,9 +242,21 @@ provides defaults for 80% of the use cases.")
                 (install-file manpage (string-append
                                         (assoc-ref outputs "out")
                                         "/share/man/man1"))))
-             #t)))))
+             #t))
+         (replace 'install
+           ;; Adapted from (guix build cargo-build-system). The flags need to
+           ;; be passed to `cargo install' too, as otherwise it will build
+           ;; another binary, without the features.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (mkdir-p out)
+               (setenv "CARGO_TARGET_DIR" "./target")
+               (invoke "cargo" "install" "--path" "." "--root" out
+                       "--features" "pcre2")))))
+       #:cargo-build-flags '("--release" "--features" "pcre2")))
     (native-inputs
-     `(("asciidoc" ,asciidoc)))
+     `(("asciidoc" ,asciidoc)
+       ,@(package-native-inputs rust-pcre2-sys-0.2)))
     (home-page "https://github.com/BurntSushi/ripgrep")
     (synopsis "Line-oriented search tool")
     (description
-- 
2.25.0





Information forwarded to guix-patches <at> gnu.org:
bug#39445; Package guix-patches. (Mon, 10 Feb 2020 08:45:01 GMT) Full text and rfc822 format available.

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

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Jakub Kądziołka <kuba <at> kadziolka.net>
Cc: 39445 <at> debbugs.gnu.org
Subject: Re: [bug#39445] [PATCH v2 2/2] gnu: ripgrep: enable the 'pcre2'
 feature
Date: Mon, 10 Feb 2020 10:43:51 +0200
[Message part 1 (text/plain, inline)]
Should the install phase also get the '--release' flag?

On Sun, Feb 09, 2020 at 10:51:10PM +0100, Jakub Kądziołka wrote:
> * gnu/packages/rust-apps.scm (ripgrep)[arguments]: Add
>   #:cargo-build-flags to specify the feature. Replace the 'install phase
>   to work around the cargo-build-system a bit.
> ---
>  gnu/packages/rust-apps.scm | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
> index ddc9f6ed37..26b5445d98 100644
> --- a/gnu/packages/rust-apps.scm
> +++ b/gnu/packages/rust-apps.scm
> @@ -242,9 +242,21 @@ provides defaults for 80% of the use cases.")
>                  (install-file manpage (string-append
>                                          (assoc-ref outputs "out")
>                                          "/share/man/man1"))))
> -             #t)))))
> +             #t))
> +         (replace 'install
> +           ;; Adapted from (guix build cargo-build-system). The flags need to
> +           ;; be passed to `cargo install' too, as otherwise it will build
> +           ;; another binary, without the features.
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let ((out (assoc-ref outputs "out")))
> +               (mkdir-p out)
> +               (setenv "CARGO_TARGET_DIR" "./target")
> +               (invoke "cargo" "install" "--path" "." "--root" out
> +                       "--features" "pcre2")))))
> +       #:cargo-build-flags '("--release" "--features" "pcre2")))
>      (native-inputs
> -     `(("asciidoc" ,asciidoc)))
> +     `(("asciidoc" ,asciidoc)
> +       ,@(package-native-inputs rust-pcre2-sys-0.2)))
>      (home-page "https://github.com/BurntSushi/ripgrep")
>      (synopsis "Line-oriented search tool")
>      (description
> -- 
> 2.25.0
> 
> 
> 
> 

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#39445; Package guix-patches. (Mon, 10 Feb 2020 11:28:01 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: Efraim Flashner <efraim <at> flashner.co.il>
Cc: 39445 <at> debbugs.gnu.org
Subject: Re: [bug#39445] [PATCH v2 2/2] gnu: ripgrep: enable the 'pcre2'
 feature
Date: Mon, 10 Feb 2020 12:28:13 +0100
[Message part 1 (text/plain, inline)]
On Mon, Feb 10, 2020 at 10:43:51AM +0200, Efraim Flashner wrote:
> Should the install phase also get the '--release' flag?

It's a reasonable question to ask, but no. `cargo install' will always
use a release build. Moreover, passing the --release flag to cargo
install will lead to an unexpected argument error.

Regards,
Jakub Kądziołka
[signature.asc (application/pgp-signature, inline)]

Reply sent to Efraim Flashner <efraim <at> flashner.co.il>:
You have taken responsibility. (Tue, 11 Feb 2020 18:27:02 GMT) Full text and rfc822 format available.

Notification sent to Jakub Kądziołka <kuba <at> kadziolka.net>:
bug acknowledged by developer. (Tue, 11 Feb 2020 18:27:02 GMT) Full text and rfc822 format available.

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

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Jakub Kądziołka <kuba <at> kadziolka.net>
Cc: 39445-done <at> debbugs.gnu.org
Subject: Re: [bug#39445] [PATCH v2 2/2] gnu: ripgrep: enable the 'pcre2'
 feature
Date: Tue, 11 Feb 2020 20:25:42 +0200
[Message part 1 (text/plain, inline)]
On Mon, Feb 10, 2020 at 12:28:13PM +0100, Jakub Kądziołka wrote:
> On Mon, Feb 10, 2020 at 10:43:51AM +0200, Efraim Flashner wrote:
> > Should the install phase also get the '--release' flag?
> 
> It's a reasonable question to ask, but no. `cargo install' will always
> use a release build. Moreover, passing the --release flag to cargo
> install will lead to an unexpected argument error.

That's unfortunate. I was hoping to re-use the cargo-build-flags option.
Might still be worth it, after adding logic to strip out the '--release'
flag.

Patches pushed.


-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

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

This bug report was last modified 5 years and 183 days ago.

Previous Next


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