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>
7 ;;; This file is part of GNU Guix.
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.
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.
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/>.
22 (define-module (gnu packages lsof)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix git-download)
26 #:use-module (guix build-system gnu)
27 #:use-module (guix utils)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages groff)
30 #:use-module (gnu packages perl))
40 (url "https://github.com/lsof-org/lsof")
42 (file-name (git-file-name name version))
44 (base32 "0yxv2jg6rnzys49lyrz9yjb4knamah4xvlqj596y6ix3vm4k3chp"))
45 (patches (search-patches "lsof-fatal-test-failures.patch"))))
46 (build-system gnu-build-system)
48 `(("groff" ,groff) ; for soelim
52 (modify-phases %standard-phases
55 (setenv "LSOF_CC" ,(cc-for-target))
56 (setenv "LSOF_MAKE" "make")
58 ;; By default, the makefile captures the output of 'uname -a'.
59 ;; Provide a fixed output instead to make builds reproducible.
60 (setenv "LSOF_SYSINFO"
61 (string-append "GNU/" (utsname:sysname (uname))
64 (invoke "./Configure" "linux")
66 (add-after 'configure 'patch-timestamps
68 (substitute* "Makefile"
69 (("`date`") "`date --date=@1`"))
71 (add-after 'build 'build-man-page
73 (with-output-to-file "lsof.8"
74 (lambda _ (invoke "soelim" "Lsof.8")))
76 (add-before 'check 'disable-failing-tests
78 (substitute* "tests/Makefile"
79 ;; Fails with ‘ERROR!!! client gethostbyaddr() failure’.
80 (("(STDTST=.*) LTsock" _ prefix) prefix)
81 ;; Fails without access to a remote NFS server.
82 (("(OPTTST=.*) LTnfs" _ prefix) prefix))
85 (lambda* (#:key tests? #:allow-other-keys)
87 (with-directory-excursion "tests"
88 ;; Tests refuse to run on ‘unvalidated’ platforms.
89 (make-file-writable "TestDB")
90 (invoke "./Add2TestDB")
92 ;; The ‘standard’ tests suggest running ‘optional’ ones as well.
93 (invoke "make" "standard" "optional")))
96 (lambda* (#:key outputs #:allow-other-keys)
97 (let ((out (assoc-ref outputs "out")))
98 (install-file "lsof" (string-append out "/bin"))
99 (install-file "lsof.8" (string-append out "/share/man/man8")))
101 (synopsis "Display information about open files")
103 "Lsof stands for LiSt Open Files, and it does just that.
104 It lists information about files that are open by the processes running
106 (license (license:fsf-free
108 "License inspired by zlib, see point 1.9 of 00FAQ in the distribution."))
109 (home-page "https://people.freebsd.org/~abe/")))