diff mbox series

[bug#48630] Acknowledgement ([PATCH] adds `ack' package and it's perl module dependency File::Next)

Message ID 20210726143303.xljnaiuh3mghzyx3@silvi
State Accepted
Headers show
Series [bug#48630] Acknowledgement ([PATCH] adds `ack' package and it's perl module dependency File::Next) | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Gabriel Wicki July 26, 2021, 2:33 p.m. UTC
Please disregard my previous messages.  The previously posted version of
ack only worked when perl-file-next was part of the user's profile.
The new patches address that issue (though I only changed the commit
title of the first patch).
I hope I finally got it all right :)

Thanks to all for pointers and patience!

From 974467a42085e342202339038c644c8579e890d1 Mon Sep 17 00:00:00 2001
From: Gabriel Wicki <gabriel@erlikon.ch>
Date: Mon, 26 Jul 2021 15:43:36 +0200
Subject: [PATCH] gnu: Add perl-file-next.

* gnu/packages/perl.scm (perl-file-next): New variable.
---
 gnu/packages/perl.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index db10c44a20..545ef61d76 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -4789,6 +4789,25 @@  provided base directory and can return files (and/or directories if desired)
 matching a regular expression.")
     (home-page "https://metacpan.org/release/File-List")))
 
+(define-public perl-file-next
+  (package
+   (name "perl-file-next")
+   (version "1.18")
+   (source (origin
+            (method git-fetch)
+            (uri (git-reference
+                  (url "https://github.com/petdance/file-next")
+                  (commit version)))
+            (file-name (git-file-name name version))
+            (sha256
+             (base32
+              "0zdrxk409qxkbbv4fl4wi285kfzyrpaja9wfl00vrxc078rs4afm"))))
+   (build-system perl-build-system)
+   (synopsis "Lightweight, taint-safe file-finding Perl module")
+   (description "File::Next is a Perl CPAN module for finding files.")
+   (home-page "https://metacpan.org/pod/File::Next")
+   (license license:artistic2.0)))
+
 (define-public perl-file-readbackwards
   (package
     (name "perl-file-readbackwards")
-- 
2.32.0


From 8150ec6199e91f53ac36c5c1d217e2f216101324 Mon Sep 17 00:00:00 2001
From: Gabriel Wicki <gabriel@erlikon.ch>
Date: Mon, 26 Jul 2021 16:02:32 +0200
Subject: [PATCH] gnu: Add ack.

* gnu/packages/textutils.scm (ack): New variable.
---
 gnu/packages/textutils.scm | 54 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index c3f4580a47..dcec1088b1 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -45,6 +45,7 @@ 
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system perl)
   #:use-module (guix build-system python)
   #:use-module (guix utils)
   #:use-module (gnu packages)
@@ -1304,3 +1305,56 @@  languages such as HTML, Markdown, Asciidoc, and reStructuredText.  The community
 around it also has a list of style guides implemented with Vale in
 @url{https://github.com/errata-ai/styles, their styles repo}.")
     (license license:expat)))
+
+(define-public ack
+  (package
+   (name "ack")
+   (version "3.5.0")
+   (source (origin
+            (method git-fetch)
+            (uri
+             (git-reference
+              (url "https://github.com/beyondgrep/ack3")
+              (commit (string-append "v" version))))
+            (file-name (git-file-name name version))
+            (sha256
+             (base32 "00131vqjbzcn6w22m0h3j6x9kp59dimfnnqhpmi78vbcj0jws1dv"))))
+   (build-system perl-build-system)
+   (arguments `(#:phases (modify-phases
+                          %standard-phases
+                          (add-after
+                           'patch-generated-file-shebangs 'patch-more-shebangs
+                           (lambda* (#:key inputs outputs #:allow-other-keys)
+                             (let ((perl (string-append
+                                          (assoc-ref inputs "perl")
+                                          "/bin/perl"))
+                                   (append-inc-string
+                                    (lambda (i)
+                                      (string-append
+                                       i "/lib/perl5/site_perl/"
+                                       ,(package-version perl)))))
+                               (substitute*
+                                "t/ack-type.t"
+                                (("/usr/bin/perl")
+                                 perl)
+                                (("/usr/bin/env perl")
+                                 perl))
+                               (substitute*
+                                "ack"
+                                (("/bin/perl") ;; add @INC include paths to perl calls
+                                 (string-append
+                                  "/bin/perl -I "
+                                  (append-inc-string
+                                   (assoc-ref inputs "perl-file-next"))
+                                  " -I "
+                                  (append-inc-string
+                                   (assoc-ref outputs "out")))))))))))
+   (inputs `(("perl-file-next" ,perl-file-next)))
+   (synopsis "Code-searching tool optimized for programmers with large trees
+of source code")
+   (description "ack is a tool for finding text inside files.  It is designed for
+hackers and programmers by being fast, ignoring VCS directories, letting a user
+easily specify file types, match highlighting, Perl-Compatible Regular
+Expressions, and being faster to type than grep.")
+   (home-page "https://beyondgrep.com/")
+   (license license:artistic2.0)))