datamash.scm 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014, 2018 Eric Bavier <bavier@member.fsf.org>
  3. ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
  4. ;;;
  5. ;;; This file is part of GNU Guix.
  6. ;;;
  7. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  8. ;;; under the terms of the GNU General Public License as published by
  9. ;;; the Free Software Foundation; either version 3 of the License, or (at
  10. ;;; your option) any later version.
  11. ;;;
  12. ;;; GNU Guix is distributed in the hope that it will be useful, but
  13. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;;; GNU General Public License for more details.
  16. ;;;
  17. ;;; You should have received a copy of the GNU General Public License
  18. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  19. (define-module (gnu packages datamash)
  20. #:use-module (guix packages)
  21. #:use-module (guix licenses)
  22. #:use-module (guix download)
  23. #:use-module (guix git-download)
  24. #:use-module (guix build-system gnu)
  25. #:use-module (guix gexp)
  26. #:use-module (guix utils)
  27. #:use-module (gnu packages)
  28. #:use-module (gnu packages base)
  29. #:use-module (gnu packages gawk)
  30. #:use-module (gnu packages perl)
  31. #:use-module (gnu packages python)
  32. #:use-module (gnu packages python-xyz))
  33. (define-public datamash
  34. (package
  35. (name "datamash")
  36. (version "1.7")
  37. (source
  38. (origin
  39. (method url-fetch)
  40. (uri (string-append "mirror://gnu/datamash/datamash-"
  41. version ".tar.gz"))
  42. (sha256
  43. (base32
  44. "1cxdlhgz3wzjqlq8bgwad93fgqymk2abbldfzw1ffnhcp4mmjjjp"))))
  45. (native-inputs
  46. (list which ;for tests
  47. perl)) ;for help2man
  48. (build-system gnu-build-system)
  49. (home-page "https://www.gnu.org/software/datamash/")
  50. (synopsis "Scriptable statistics and data calculation")
  51. (description
  52. "Perform basic numeric, textual and statistical operations on plain text
  53. files. Designed to work within standard pipelines without additional code.")
  54. (license gpl3+)))
  55. (define-public vnlog
  56. (package
  57. (name "vnlog")
  58. (version "1.32")
  59. (home-page "https://github.com/dkogan/vnlog")
  60. (source (origin
  61. (method git-fetch)
  62. (uri (git-reference
  63. (url home-page)
  64. (commit (string-append "v" version))))
  65. (file-name (git-file-name name version))
  66. (sha256
  67. (base32
  68. "1g4insm6gkw3c82fq8q9swkdha3cncbz1nib15yg9b2s4yl123hm"))))
  69. (build-system gnu-build-system)
  70. (native-inputs
  71. (list python-numpy)) ;for tests
  72. (inputs
  73. (list mawk
  74. perl
  75. perl-ipc-run
  76. perl-list-moreutils
  77. perl-string-shellquote
  78. perl-text-diff
  79. perl-text-table
  80. python-wrapper))
  81. (arguments
  82. (list #:make-flags
  83. #~(list (string-append "CC=" #$(cc-for-target))
  84. (string-append "DESTDIR=" #$output)
  85. "USRLIB=lib"
  86. "MANDIR=share/man"
  87. (string-append "PY3_MODULE_PATH=lib/python"
  88. #$(version-major+minor
  89. (package-version
  90. (this-package-input "python-wrapper")))
  91. "/site-packages")
  92. ;; Do not install the Python 2 modules.
  93. "DIST_PY2_MODULES=")
  94. #:phases
  95. #~(modify-phases %standard-phases
  96. (add-after 'unpack 'adjust-Makefile
  97. (lambda _
  98. (substitute* "GNUmakefile"
  99. ;; Install Perl modules to the usual location.
  100. (("/usr/share/perl5")
  101. (string-append "/lib/perl5/site_perl/"
  102. #$(package-version
  103. (this-package-input "perl"))))
  104. ;; Do not add a '/usr' suffix to DESTDIR.
  105. (("\\$\\(DESTDIR\\)/usr")
  106. "$(DESTDIR)")
  107. ;; Do not strip RUNPATH from the installed C library.
  108. ((".*find.*chrpath.*")
  109. ""))))
  110. (add-after 'unpack 'use-absolute-mawk
  111. (lambda* (#:key inputs #:allow-other-keys)
  112. (let ((mawk (search-input-file inputs "bin/mawk")))
  113. (substitute* '("vnl-filter" "lib/Vnlog/Util.pm")
  114. (("'mawk'")
  115. (string-append "'" mawk "'"))))))
  116. (delete 'configure)
  117. (add-before 'check 'disable-python2-test
  118. (lambda _
  119. (delete-file "test/test_python2_parser.sh")
  120. (substitute* "GNUmakefile"
  121. ((".*test/test_python2_parser\\.sh\\.RUN.*")
  122. ""))))
  123. (add-after 'install 'wrap
  124. (lambda* (#:key inputs outputs #:allow-other-keys)
  125. (let* ((out (assoc-ref outputs "out"))
  126. (PERL5LIB (string-append
  127. out "/lib/perl5/site_perl/"
  128. #$(package-version
  129. (this-package-input "perl"))
  130. ":" (getenv "PERL5LIB"))))
  131. (for-each (lambda (script)
  132. (wrap-program script
  133. `("PERL5LIB" ":" prefix (,PERL5LIB))))
  134. (find-files (string-append out "/bin"))))))
  135. (add-after 'wrap 'check-wrapped-executables
  136. (lambda* (#:key outputs #:allow-other-keys)
  137. (let ((out (assoc-ref outputs "out")))
  138. ;; Assert that the installed Perl scripts can find
  139. ;; their dependencies even when PERL5LIB is unset.
  140. (unsetenv "PERL5LIB")
  141. (for-each (lambda (script)
  142. (invoke/quiet script "--help"))
  143. (find-files (string-append out "/bin")
  144. "^vnl-[[:lower:]]+$"))))))))
  145. (synopsis "Process labelled tabular ASCII data on the command line")
  146. (description
  147. "Vnlog (pronounced @dfn{vanillog}) is a toolkit for manipulating
  148. tabular ASCII data with labelled fields using regular command-line tools.")
  149. (license lgpl2.1+)))