gnu: lsof: Factorise source URIs.

* gnu/packages/lsof.scm (%ftp-base): Remove variable.
(lsof)[source]: Construct mirror URI list programatically.
This commit is contained in:
Tobias Geerinckx-Rice 2018-02-18 20:27:24 +01:00
parent 5ae76e8f16
commit cb443e55dc
No known key found for this signature in database
GPG Key ID: 0DB0FF884F556D79
1 changed files with 24 additions and 37 deletions

View File

@ -25,48 +25,35 @@
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (gnu packages perl)) #:use-module (gnu packages perl))
(define %ftp-base
"ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/")
(define-public lsof (define-public lsof
(package (package
(name "lsof") (name "lsof")
(version "4.89") (version "4.89")
(source (origin (source
(origin
(method url-fetch) (method url-fetch)
(uri (list (string-append %ftp-base "lsof_" (uri
version ".tar.bz2") (apply append
(string-append %ftp-base "OLD/lsof_" (map
version ".tar.bz2") (lambda (mirror-uri)
(let ((tarball (string-append name "_" version ".tar.bz2")))
(list
(string-append mirror-uri "/" tarball)
;; Upon every new release, the previous one is moved here:
(string-append mirror-uri "/OLD/" tarball))))
(list
"ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/"
;; Add mirrors because the FTP server at purdue.edu ;; Add mirrors because the canonical FTP server at purdue.edu
;; bails out when it cannot do a reverse DNS lookup, as ;; bails out when it cannot do a reverse DNS lookup, as noted
;; noted at <http://people.freebsd.org/~abe/>. ;; at <http://people.freebsd.org/~abe/>.
(string-append "ftp://ftp.fu-berlin.de/pub/unix/tools/lsof/"
"ftp://ftp.fu-berlin.de/pub/unix/tools/lsof/lsof_" (string-append "http://www.mirrorservice.org/sites/"
version ".tar.bz2") "lsof.itap.purdue.edu/pub/tools/unix/lsof")
(string-append (string-append "ftp://ftp.mirrorservice.org/sites/"
"ftp://ftp.fu-berlin.de/pub/unix/tools/lsof/OLD/lsof_" "lsof.itap.purdue.edu/pub/tools/unix/lsof")))))
version ".tar.bz2")
(string-append
"http://www.mirrorservice.org/sites/"
"lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_"
version ".tar.bz2")
(string-append
"http://www.mirrorservice.org/sites/"
"lsof.itap.purdue.edu/pub/tools/unix/lsof/OLD/lsof_"
version ".tar.bz2")
(string-append
"ftp://ftp.mirrorservice.org/sites/"
"lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_"
version ".tar.bz2")
(string-append
"ftp://ftp.mirrorservice.org/sites/"
"lsof.itap.purdue.edu/pub/tools/unix/lsof/OLD/lsof_"
version ".tar.bz2")))
(sha256 (sha256
(base32 (base32 "061p18v0mhzq517791xkjs8a5dfynq1418a1mwxpji69zp2jzb41"))))
"061p18v0mhzq517791xkjs8a5dfynq1418a1mwxpji69zp2jzb41"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(inputs `(("perl" ,perl))) (inputs `(("perl" ,perl)))
(arguments (arguments