gnu: cups: Inherit & modify cups-minimal arguments.

* gnu/packages/cups.scm (cups)[arguments]: Use
substitute-keyword-arguments on cups-minimal's arguments to do away
with the redundant 'patch-makedefs and 'make-manpages-writable phases.
This commit is contained in:
Tobias Geerinckx-Rice 2021-06-22 16:56:19 +02:00
parent 7931883bcc
commit 8d9a2dee1f
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -319,139 +319,124 @@ (define-public cups
(package/inherit cups-minimal (package/inherit cups-minimal
(name "cups") (name "cups")
(arguments (arguments
`(;; Three tests fail: (substitute-keyword-arguments (package-arguments cups-minimal)
;; * two tests in ipp-1.1.test related to "RFC 2911 section 3.2.6: ((#:tests? _ #t)
;; Get-Jobs Operation" ;; Three tests fail:
;; * test of number of error/warning messages, probably related to a ;; * two tests in ipp-1.1.test related to "RFC 2911 section 3.2.6:
;; missing font. ;; Get-Jobs Operation"
#:tests? #f ;; * test of number of error/warning messages, probably related to a
#:configure-flags ;; missing font.
'("--disable-launchd" #f)
"--disable-systemd") ((#:configure-flags _ '())
#:phases `(list "--disable-launchd"
(modify-phases %standard-phases "--disable-systemd"))
(add-before 'configure 'patch-makedefs ((#:phases phases '%standard-phases)
(lambda _ `(modify-phases ,phases
(substitute* "Makedefs.in" (add-before 'check 'patch-tests
(("INITDIR.*=.*@INITDIR@") "INITDIR = @prefix@/@INITDIR@") (lambda _
(("/bin/sh") (which "sh"))) (let ((filters (assoc-ref %build-inputs "cups-filters"))
#t)) (catpath (string-append
(add-before 'check 'patch-tests (assoc-ref %build-inputs "coreutils") "/bin/"))
(lambda _ (testdir (string-append (getcwd) "/tmp/")))
(let ((filters (assoc-ref %build-inputs "cups-filters")) (mkdir testdir)
(catpath (string-append (substitute* "test/run-stp-tests.sh"
(assoc-ref %build-inputs "coreutils") "/bin/")) ((" *BASE=/tmp/") (string-append "BASE=" testdir))
(testdir (string-append (getcwd) "/tmp/")))
(mkdir testdir)
(substitute* "test/run-stp-tests.sh"
((" *BASE=/tmp/") (string-append "BASE=" testdir))
;; allow installation of filters from output dir and from ;; Allow installation of filters from the output directory
;; cups-filters ;; and from cups-filters.
(("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter") (("for dir in /usr/libexec/cups/filter /usr/lib/cups/filter")
(string-append (string-append
"for dir in " "for dir in "
(assoc-ref %outputs "out") "/lib/cups/filter " (assoc-ref %outputs "out") "/lib/cups/filter "
filters "/lib/cups/filter")) filters "/lib/cups/filter"))
;; check for charsets in cups-filters output ;; Check for charsets in the default cups-filters output.
(("/usr/share/cups/charsets") (("/usr/share/cups/charsets")
(string-append filters "/share/cups/charsets")) (string-append filters "/share/cups/charsets"))
;; install additional required filters ;; Install additional required filters.
(("instfilter texttopdf texttopdf pdf") (("instfilter texttopdf texttopdf pdf")
(string-append (string-append
"instfilter texttopdf texttopdf pdf;" "instfilter texttopdf texttopdf pdf;"
"instfilter imagetoraster imagetoraster raster;" "instfilter imagetoraster imagetoraster raster;"
"instfilter gstoraster gstoraster raster;" "instfilter gstoraster gstoraster raster;"
"instfilter urftopdf urftopdf pdf;" "instfilter urftopdf urftopdf pdf;"
"instfilter rastertopdf rastertopdf pdf;" "instfilter rastertopdf rastertopdf pdf;"
"instfilter pstopdf pstopdf pdf")) "instfilter pstopdf pstopdf pdf"))
;; specify location of lpstat binary ;; Specify the location of the lpstat binary.
(("description=\"`lpstat -l") (("description=\"`lpstat -l")
"description=\"`../systemv/lpstat -l") "description=\"`../systemv/lpstat -l")
;; patch shebangs of embedded scripts ;; Patch the shebangs of embedded scripts.
(("#!/bin/sh") (string-append "#!" (which "sh"))) (("#!/bin/sh") (string-append "#!" (which "sh")))
;; also link mime definitions from cups-filters ;; Also link MIME definitions from cups-filters
;; to enable the additional filters for the test suite ;; to enable the additional filters for the test suite.
(("ln -s \\$root/conf/mime\\.types") (("ln -s \\$root/conf/mime\\.types")
(string-append (string-append
"ln -s " filters "ln -s " filters
"/share/cups/mime/cupsfilters.types $BASE/share/mime; " "/share/cups/mime/cupsfilters.types $BASE/share/mime; "
"ln -s $root/conf/mime.types")) "ln -s $root/conf/mime.types"))
(("ln -s \\$root/conf/mime\\.convs") (("ln -s \\$root/conf/mime\\.convs")
(string-append (string-append
"ln -s " filters "ln -s " filters
"/share/cups/mime/cupsfilters.convs $BASE/share/mime; " "/share/cups/mime/cupsfilters.convs $BASE/share/mime; "
"ln -s $root/conf/mime.convs"))) "ln -s $root/conf/mime.convs")))
;; fix search path for "cat" ;; Fix the search path for the "cat" command.
(substitute* "cups/testfile.c" (substitute* "cups/testfile.c"
(("cupsFileFind\\(\"cat\", \"/bin\"") (("cupsFileFind\\(\"cat\", \"/bin\"")
(string-append "cupsFileFind(\"cat\", \"" catpath "\"")) (string-append "cupsFileFind(\"cat\", \"" catpath "\""))
(("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"") (("cupsFileFind\\(\"cat\", \"/bin:/usr/bin\"")
(string-append "cupsFileFind(\"cat\", \"" catpath "\""))) (string-append "cupsFileFind(\"cat\", \"" catpath "\""))))))
#t))) (add-after 'install 'install-cups-filters-symlinks
;; Make the compressed manpages writable so that the (lambda* (#:key inputs outputs #:allow-other-keys)
;; reset-gzip-timestamps phase does not error out. (let ((out (assoc-ref outputs "out"))
(add-before 'reset-gzip-timestamps 'make-manpages-writable (cups-filters (assoc-ref inputs "cups-filters")))
(lambda* (#:key outputs #:allow-other-keys) ;; Charsets.
(let* ((out (assoc-ref outputs "out")) (symlink
(man (string-append out "/share/man"))) (string-append cups-filters "/share/cups/charsets")
(for-each (lambda (file) (chmod file #o644)) (string-append out "/share/charsets"))
(find-files man "\\.gz"))
#t)))
(add-after 'install 'install-cups-filters-symlinks
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(cups-filters (assoc-ref inputs "cups-filters")))
;; charsets
(symlink
(string-append cups-filters "/share/cups/charsets")
(string-append out "/share/charsets"))
;; mime types, driver file, ppds ;; MIME types, driver files, and PPDs.
(for-each (for-each
(lambda (f) (lambda (f)
(symlink (string-append cups-filters f) (symlink (string-append cups-filters f)
(string-append out f))) (string-append out f)))
'("/share/cups/mime/cupsfilters.types" '("/share/cups/mime/cupsfilters.types"
"/share/cups/mime/cupsfilters.convs" "/share/cups/mime/cupsfilters.convs"
"/share/cups/drv/cupsfilters.drv" "/share/cups/drv/cupsfilters.drv"
"/share/ppd")) "/share/ppd"))
;; filters ;; Filters.
(for-each (for-each
(lambda (f) (lambda (f)
(symlink f (symlink f
(string-append out "/lib/cups/filter" (basename f)))) (string-append out "/lib/cups/filter"
(find-files (string-append cups-filters "/lib/cups/filter"))) (basename f))))
(find-files (string-append cups-filters "/lib/cups/filter")))
;; backends ;; Backends.
(for-each (for-each
(lambda (f) (lambda (f)
(symlink (string-append cups-filters f) (symlink (string-append cups-filters f)
(string-append out "/lib/cups/backend/" (string-append out "/lib/cups/backend/"
(basename f)))) (basename f))))
'("/lib/cups/backend/parallel" '("/lib/cups/backend/parallel"
"/lib/cups/backend/serial")) "/lib/cups/backend/serial"))
;; banners ;; Banners.
(let ((banners "/share/cups/banners")) (let ((banners "/share/cups/banners"))
(delete-file-recursively (string-append out banners)) (delete-file-recursively (string-append out banners))
(symlink (string-append cups-filters banners) (symlink (string-append cups-filters banners)
(string-append out banners))) (string-append out banners)))
;; assorted data ;; Assorted data.
(let ((data "/share/cups/data")) (let ((data "/share/cups/data"))
(delete-file-recursively (string-append out data)) (delete-file-recursively (string-append out data))
(symlink (string-append cups-filters data) (symlink (string-append cups-filters data)
(string-append out data))) (string-append out data))))))))))
#t))))))
(inputs (inputs
`(("avahi" ,avahi) `(("avahi" ,avahi)
("gnutls" ,gnutls) ("gnutls" ,gnutls)