gnu: nmap: Update to 7.96.

* gnu/packages/admin.scm (nmap): Update to 7.96.
[inputs]: Remove lua, pcre, and python-2; add lua-5.4, pcre2, perl, and
python-wrapper.
[native-inputs]: Add python-pypa-build, python-setuptools, and python-wheel.
[arguments]: Use GEXPs.  Remove "patch-Makefile" phase.  Add
"patch-Makefile.in" phase.  Update "install" phase.

Change-Id: I31da6982da6ced4489e6f330d5e7eeabe1e648cc
This commit is contained in:
Artyom V. Poptsov 2025-05-10 23:22:48 +03:00
parent 770c9078fa
commit 2d2a921e99
No known key found for this signature in database
GPG key ID: 935EBE0736DC857E

View file

@ -3744,14 +3744,14 @@ rules is done with the @code{auditctl} utility.")
(define-public nmap (define-public nmap
(package (package
(name "nmap") (name "nmap")
(version "7.93") (version "7.96")
(source (origin (source (origin
(method url-fetch) (method url-fetch)
(uri (string-append "https://nmap.org/dist/nmap-" version (uri (string-append "https://nmap.org/dist/nmap-" version
".tar.bz2")) ".tar.bz2"))
(sha256 (sha256
(base32 (base32
"0lb6s4nmmicfnc221mzgx2w51dcd4b2dhx22pabcqnp2jd3zxg2m")) "12lcvyzfl1hblbklcss44dr92fr86w0z1y1a90yilv5n5x7pmblq"))
(modules '((guix build utils))) (modules '((guix build utils)))
(snippet (snippet
'(begin '(begin
@ -3766,55 +3766,69 @@ rules is done with the @code{auditctl} utility.")
(build-system gnu-build-system) (build-system gnu-build-system)
(outputs '("out" "ndiff")) ; TODO Add zenmap output (outputs '("out" "ndiff")) ; TODO Add zenmap output
(arguments (arguments
`(#:configure-flags '("--without-zenmap") (list
#:phases #:configure-flags #~(list "--without-zenmap")
(modify-phases %standard-phases #:phases
(add-after 'configure 'patch-Makefile #~(modify-phases %standard-phases
(lambda _ (add-after 'unpack 'patch-Makefile.in
(substitute* "Makefile" (lambda _
;; Do not attempt to build lua. (substitute* "Makefile.in"
(("build-dnet build-lua") "build-dnet")))) (("\\$\\(PYTHON\\) -m build \\$\\(NDIFFDIR\\)/")
(replace 'install "$(PYTHON) -m build --wheel --no-isolation $(NDIFFDIR)/")
(lambda* (#:key outputs #:allow-other-keys) (("\\$\\(PYTHON\\) -m pip install \\$\\(NDIFFDIR\\).*")
(define (make out . args) (string-append "pip"
(apply invoke "make" " --no-cache-dir"
(string-append "prefix=" out) " --no-input"
args)) " install"
(define (python-path dir) " --no-build-isolation"
(string-append dir "/lib/python" " --no-deps"
,(version-major+minor " --prefix"
(package-version python)) " $(prefix)"
"/site-packages")) " $(NDIFFDIR)/\n")))))
(let ((out (assoc-ref outputs "out")) (replace 'install
(ndiff (assoc-ref outputs "ndiff"))) (lambda* (#:key inputs outputs #:allow-other-keys)
(for-each mkdir-p (list out ndiff)) (define (make out . args)
(make out (apply invoke "make"
"install-nmap" (string-append "PYTHON="
"install-nse" (search-input-file inputs "/bin/python"))
"install-ncat" (string-append "CC=" #$(cc-for-target))
"install-nping") (string-append "prefix=" out)
(make ndiff "install-ndiff") args))
(wrap-program (string-append ndiff "/bin/ndiff") (define (python-path dir)
`("GUIX_PYTHONPATH" prefix (string-append dir "/lib/python"
(,(python-path ndiff))))))) #$(version-major+minor
;; These are the tests that do not require network access. (package-version python))
(replace 'check "/site-packages"))
(lambda* (#:key tests? #:allow-other-keys) (let ((ndiff (assoc-ref outputs "ndiff")))
(when tests? (for-each mkdir-p (list #$output ndiff))
(invoke "make" (make #$output
"check-nse" "install-nmap"
"check-ndiff" "install-nse"
"check-dns"))))) "install-ncat"
;; Nmap can't cope with out-of-source building. "install-nping")
#:out-of-source? #f)) (make ndiff "install-ndiff")
(wrap-program (string-append ndiff "/bin/ndiff")
`("GUIX_PYTHONPATH" prefix
(,(python-path ndiff)))))))
;; These are the tests that do not require network access.
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(invoke "make"
"check-nse"
"check-ndiff")))))
;; Nmap can't cope with out-of-source building.
#:out-of-source? #f))
(native-inputs (list python-pypa-build python-setuptools python-wheel))
(inputs (inputs
(list bash-minimal ;for wrap-program (list bash-minimal ;for wrap-program
libpcap libpcap
lua lua-5.4
openssl-3.0 openssl-3.0
pcre pcre2
zlib ; for NSE compression zlib ; for NSE compression
python-2)) ; for ndiff perl
python-wrapper)) ; for ndiff
(home-page "https://nmap.org/") (home-page "https://nmap.org/")
(synopsis "Network discovery and security auditing tool") (synopsis "Network discovery and security auditing tool")
(description (description