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 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2018 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 download)
26 #:use-module (guix build-system gnu)
27 #:use-module (gnu packages perl))
40 (let ((tarball (string-append name "_" version ".tar.bz2")))
42 (string-append mirror-uri "/" tarball)
43 ;; Upon every new release, the previous one is moved here:
44 (string-append mirror-uri "/OLD/" tarball))))
46 "ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/"
48 ;; Add mirrors because the canonical FTP server at purdue.edu
49 ;; bails out when it cannot do a reverse DNS lookup, as noted
50 ;; at <http://people.freebsd.org/~abe/>.
51 "ftp://ftp.fu-berlin.de/pub/unix/tools/lsof/"
52 (string-append "http://www.mirrorservice.org/sites/"
53 "lsof.itap.purdue.edu/pub/tools/unix/lsof")
54 (string-append "ftp://ftp.mirrorservice.org/sites/"
55 "lsof.itap.purdue.edu/pub/tools/unix/lsof")))))
57 (base32 "18sh4hbl9jw2szkf0gvgan8g13f3g4c6s2q9h3zq5gsza9m99nn9"))))
58 (build-system gnu-build-system)
59 (native-inputs `(("perl" ,perl)))
62 (modify-phases %standard-phases
64 (lambda* (#:key source #:allow-other-keys)
65 (let ((unpack (assoc-ref %standard-phases 'unpack)))
66 (unpack #:source source)
67 (unpack #:source (car (find-files "." "\\.tar$"))))))
70 (setenv "LSOF_CC" "gcc")
71 (setenv "LSOF_MAKE" "make")
72 (invoke "./Configure" "linux")
74 (add-after 'configure 'patch-timestamps
76 (substitute* "Makefile"
77 (("`date`") "`date --date=@1`"))
79 (add-before 'check 'disable-failing-tests
81 ;; In libc 2.28, the 'major' and 'minor' macros are provided by
82 ;; <sys/sysmacros.h> only so include it.
83 (substitute* "tests/LTlib.c"
85 "#include <sys/sysmacros.h>\n\n#ifndef lint"))
87 (substitute* "tests/Makefile"
88 ;; Fails with ‘ERROR!!! client gethostbyaddr() failure’.
89 (("(STDTST=.*) LTsock" _ prefix) prefix)
90 ;; Fails without access to a remote NFS server.
91 (("(OPTTST=.*) LTnfs" _ prefix) prefix))
95 (with-directory-excursion "tests"
96 ;; Tests refuse to run on ‘unvalidated’ platforms.
97 (make-file-writable "TestDB")
98 (invoke "./Add2TestDB")
100 ;; The ‘standard’ tests suggest running ‘optional’ ones as well.
101 (invoke "make" "standard" "optional")
104 (lambda* (#:key outputs #:allow-other-keys)
105 (let ((out (assoc-ref outputs "out")))
106 (install-file "lsof" (string-append out "/bin"))
107 (install-file "lsof.8" (string-append out "/share/man/man8")))
109 (synopsis "Display information about open files")
111 "Lsof stands for LiSt Open Files, and it does just that.
112 It lists information about files that are open by the processes running
114 (license (license:fsf-free
116 "License inspired by zlib, see point 1.9 of 00FAQ in the distribution."))
117 (home-page "http://people.freebsd.org/~abe/")))