gnu: sudo: Use gexps and remove input labels.

* gnu/packages/admin.scm (sudo)[arguments]: Use gexps; use
‘search-input-file’ rather than ‘assoc-ref’.
[inputs]: Remove labels.

Change-Id: I0ea13751c5e34d1ad14035e8c2b8e7e4a7d5f8e1
This commit is contained in:
Ludovic Courtès 2024-09-16 10:12:29 +02:00
parent 79726a0507
commit 432a6ece6b
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -2059,77 +2059,78 @@ (define-public sudo
(build-system gnu-build-system) (build-system gnu-build-system)
(outputs (list "out")) (outputs (list "out"))
(arguments (arguments
`(#:configure-flags (list #:configure-flags
(list (string-append "--docdir=" (assoc-ref %outputs "out") #~(list (string-append "--docdir=" #$output
"/share/doc/" ,name "-" ,version) "/share/doc/" #$name "-" #$version)
"--with-logpath=/var/log/sudo.log" "--with-logpath=/var/log/sudo.log"
"--with-rundir=/var/run/sudo" ; must be cleaned up at boot time "--with-rundir=/var/run/sudo" ; must be cleaned up at boot time
"--with-vardir=/var/db/sudo" "--with-vardir=/var/db/sudo"
"--with-iologdir=/var/log/sudo-io" "--with-iologdir=/var/log/sudo-io"
;; 'visudo.c' expects _PATH_MV to be defined, but glibc doesn't ;; 'visudo.c' expects _PATH_MV to be defined, but glibc doesn't
;; provide it. ;; provide it.
(string-append "CPPFLAGS=-D_PATH_MV=\\\"" (string-append "CPPFLAGS=-D_PATH_MV=\\\""
(assoc-ref %build-inputs "coreutils") (search-input-file %build-inputs "/bin/mv")
"/bin/mv\\\"") "\\\"")
;; When cross-compiling, assume we have a working 'snprintf' and ;; When cross-compiling, assume we have a working 'snprintf' and
;; 'vsnprintf' (which we do, when using glibc). The default ;; 'vsnprintf' (which we do, when using glibc). The default
;; choice fails with undefined references to 'sudo_snprintf' & ;; choice fails with undefined references to 'sudo_snprintf' &
;; co. when linking. ;; co. when linking.
,@(if (%current-target-system) #$@(if (%current-target-system)
'("ac_cv_have_working_snprintf=yes" '("ac_cv_have_working_snprintf=yes"
"ac_cv_have_working_vsnprintf=yes") "ac_cv_have_working_vsnprintf=yes")
'())) '()))
;; Avoid non-determinism; see <http://bugs.gnu.org/21918>. ;; Avoid non-determinism; see <http://bugs.gnu.org/21918>.
#:parallel-build? #f #:parallel-build? #f
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-before 'configure 'pre-configure (add-before 'configure 'pre-configure
(lambda _ (lambda _
(substitute* "src/sudo_usage.h.in" (substitute* "src/sudo_usage.h.in"
;; Do not capture 'configure' arguments since we would ;; Do not capture 'configure' arguments since we would
;; unduly retain references, and also because the ;; unduly retain references, and also because the
;; CPPFLAGS above would close the string literal ;; CPPFLAGS above would close the string literal
;; prematurely. ;; prematurely.
(("@CONFIGURE_ARGS@") "\"\"")) (("@CONFIGURE_ARGS@")
(substitute* (find-files "." "Makefile\\.in") "\"\""))
;; Allow installation as non-root. (substitute* (find-files "." "Makefile\\.in")
(("-o [[:graph:]]+ -g [[:graph:]]+") ;; Allow installation as non-root.
"") (("-o [[:graph:]]+ -g [[:graph:]]+")
;; Don't try to create /etc/sudoers. "")
(("^install: (.*)install-sudoers(.*)" _ before after) ;; Don't try to create /etc/sudoers.
(string-append "install: " before after "\n")) (("^install: (.*)install-sudoers(.*)" _ before
;; Don't try to create /run/sudo. after)
(("\\$\\(DESTDIR\\)\\$\\(rundir\\)") (string-append "install: " before after "\n"))
"$(TMPDIR)/dummy") ;; Don't try to create /run/sudo.
;; Install example sudo{,_logsrvd}.conf to the right place. (("\\$\\(DESTDIR\\)\\$\\(rundir\\)")
(("\\$\\(DESTDIR\\)\\$\\(sysconfdir\\)") "$(TMPDIR)/dummy")
"$(DESTDIR)/$(docdir)/examples") ;; Install example sudo{,_logsrvd}.conf to the right place.
;; Don't try to create /var/db/sudo. (("\\$\\(DESTDIR\\)\\$\\(sysconfdir\\)")
(("\\$\\(DESTDIR\\)\\$\\(vardir\\)") "$(DESTDIR)/$(docdir)/examples")
"$(TMPDIR)/dummy")) ;; Don't try to create /var/db/sudo.
(("\\$\\(DESTDIR\\)\\$\\(vardir\\)")
"$(TMPDIR)/dummy"))
;; Checking existing [/etc/]sudoers file for syntax errors is ;; Checking existing [/etc/]sudoers file for syntax errors is
;; not the task of the build system, and fails. ;; not the task of the build system, and fails.
(substitute* "plugins/sudoers/Makefile.in" (substitute* "plugins/sudoers/Makefile.in"
(("^pre-install:" match) (("^pre-install:" match)
(string-append match "\ndisabled-" match)))))) (string-append match "\ndisabled-" match))))))
;; XXX: The 'testsudoers' test series expects user 'root' to exist, but ;; XXX: The 'testsudoers' test series expects user 'root' to exist, but
;; the chroot's /etc/passwd doesn't have it. Turn off the tests. ;; the chroot's /etc/passwd doesn't have it. Turn off the tests.
#:tests? #f)) #:tests? #f))
(native-inputs (native-inputs
(list groff)) (list groff))
(inputs (inputs
`(("coreutils" ,coreutils) (append (list coreutils zlib)
,@(if (target-hurd?) (if (target-hurd?)
'() '()
`(("linux-pam" ,linux-pam))) (list linux-pam))))
("zlib" ,zlib)))
(home-page "https://www.sudo.ws/") (home-page "https://www.sudo.ws/")
(synopsis "Run commands as root") (synopsis "Run commands as root")
(description (description