lsof.scm 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
  3. ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
  4. ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
  5. ;;; Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org>
  6. ;;;
  7. ;;; This file is part of GNU Guix.
  8. ;;;
  9. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  10. ;;; under the terms of the GNU General Public License as published by
  11. ;;; the Free Software Foundation; either version 3 of the License, or (at
  12. ;;; your option) any later version.
  13. ;;;
  14. ;;; GNU Guix is distributed in the hope that it will be useful, but
  15. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;;; GNU General Public License for more details.
  18. ;;;
  19. ;;; You should have received a copy of the GNU General Public License
  20. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  21. (define-module (gnu packages lsof)
  22. #:use-module ((guix licenses) #:prefix license:)
  23. #:use-module (guix packages)
  24. #:use-module (guix git-download)
  25. #:use-module (guix build-system gnu)
  26. #:use-module (guix utils)
  27. #:use-module (gnu packages)
  28. #:use-module (gnu packages groff)
  29. #:use-module (gnu packages perl))
  30. (define-public lsof
  31. (package
  32. (name "lsof")
  33. (version "4.94.0")
  34. (source
  35. (origin
  36. (method git-fetch)
  37. (uri (git-reference
  38. (url "https://github.com/lsof-org/lsof")
  39. (commit version)))
  40. (file-name (git-file-name name version))
  41. (sha256
  42. (base32 "0yxv2jg6rnzys49lyrz9yjb4knamah4xvlqj596y6ix3vm4k3chp"))
  43. (patches (search-patches "lsof-fatal-test-failures.patch"))))
  44. (build-system gnu-build-system)
  45. (native-inputs
  46. `(("groff" ,groff) ; for soelim
  47. ("perl" ,perl)))
  48. (arguments
  49. `(#:phases
  50. (modify-phases %standard-phases
  51. (replace 'configure
  52. (lambda _
  53. (setenv "LSOF_CC" ,(cc-for-target))
  54. (setenv "LSOF_MAKE" "make")
  55. ;; By default, the makefile captures the output of 'uname -a'.
  56. ;; Provide a fixed output instead to make builds reproducible.
  57. (setenv "LSOF_SYSINFO"
  58. (string-append "GNU/" (utsname:sysname (uname))
  59. " (GNU Guix)"))
  60. (invoke "./Configure" "linux")
  61. #t))
  62. (add-after 'configure 'patch-timestamps
  63. (lambda _
  64. (substitute* "Makefile"
  65. (("`date`") "`date --date=@1`"))
  66. #t))
  67. (add-after 'build 'build-man-page
  68. (lambda _
  69. (with-output-to-file "lsof.8"
  70. (lambda _ (invoke "soelim" "Lsof.8")))
  71. #t))
  72. (add-before 'check 'disable-failing-tests
  73. (lambda _
  74. (substitute* "tests/Makefile"
  75. ;; Fails with ‘ERROR!!! client gethostbyaddr() failure’.
  76. (("(STDTST=.*) LTsock" _ prefix) prefix)
  77. ;; Fails without access to a remote NFS server.
  78. (("(OPTTST=.*) LTnfs" _ prefix) prefix))
  79. #t))
  80. (replace 'check
  81. (lambda* (#:key tests? #:allow-other-keys)
  82. (when tests?
  83. (with-directory-excursion "tests"
  84. ;; Tests refuse to run on ‘unvalidated’ platforms.
  85. (make-file-writable "TestDB")
  86. (invoke "./Add2TestDB")
  87. ;; The ‘standard’ tests suggest running ‘optional’ ones as well.
  88. (invoke "make" "standard" "optional")))
  89. #t))
  90. (replace 'install
  91. (lambda* (#:key outputs #:allow-other-keys)
  92. (let ((out (assoc-ref outputs "out")))
  93. (install-file "lsof" (string-append out "/bin"))
  94. (install-file "lsof.8" (string-append out "/share/man/man8")))
  95. #t)))))
  96. (synopsis "Display information about open files")
  97. (description
  98. "Lsof stands for LiSt Open Files, and it does just that.
  99. It lists information about files that are open by the processes running
  100. on the system.")
  101. (license (license:fsf-free
  102. "file://00FAQ"
  103. "License inspired by zlib, see point 1.9 of 00FAQ in the distribution."))
  104. (home-page "https://people.freebsd.org/~abe/")))