nongnu: hplip-plugin: Fix indentation, drop #t return value.

* nongnu/packages/printers.scm (hplip-plugin): Normalize indentation, remove
 #t return value

Signed-off-by: Jonathan Brielmaier <jonathan.brielmaier@web.de>
This commit is contained in:
Attila Lendvai 2023-05-12 14:40:06 +02:00 committed by Jonathan Brielmaier
parent 817552dc8b
commit 29e80edd0f
No known key found for this signature in database
GPG Key ID: ECFC83988B4E4B9F

View File

@ -14,149 +14,143 @@
(define-public hplip-plugin (define-public hplip-plugin
(package (package
(inherit hplip) (inherit hplip)
(name "hplip-plugin") (name "hplip-plugin")
(description "Hewlett-Packard printer drivers with nonfree plugin.") (description "Hewlett-Packard printer drivers with nonfree plugin.")
(source (origin (inherit (package-source hplip)) (source (origin
(snippet (inherit (package-source hplip))
(delete '(for-each (snippet
delete-file (delete '(for-each
(find-files "." (lambda delete-file
(file stat) (find-files "." (lambda (file stat)
(elf-file? file)))) (elf-file? file))))
(origin-snippet (package-source hplip)))))) (origin-snippet (package-source hplip))))))
(inputs (alist-delete "python-pyqt" (package-inputs hplip))) (inputs (alist-delete "python-pyqt" (package-inputs hplip)))
(native-inputs (native-inputs
(append (append
`(("hplip-plugin" `(("hplip-plugin"
,(origin ,(origin
(method url-fetch) (method url-fetch)
(uri (string-append "https://developers.hp.com/sites/default/files/hplip-" (uri (string-append "https://developers.hp.com/sites/default/files/hplip-"
(package-version hplip) "-plugin.run")) (package-version hplip) "-plugin.run"))
(sha256 (sha256
(base32 (base32
"100zyvmqlp71v8691s9wfzrllqq8aaqj9a4pki36gqs1bn4429h3"))))) "100zyvmqlp71v8691s9wfzrllqq8aaqj9a4pki36gqs1bn4429h3")))))
(package-native-inputs hplip))) (package-native-inputs hplip)))
(arguments (arguments
(substitute-keyword-arguments (substitute-keyword-arguments (package-arguments hplip)
(package-arguments hplip) ((#:configure-flags cf)
((#:configure-flags cf) `(delete "--enable-qt5" ,cf))
`(delete "--enable-qt5" ,cf)) ((#:phases ph)
((#:phases ph) `(modify-phases ,ph
`(modify-phases (replace 'fix-hard-coded-file-names
,ph (lambda* (#:key inputs outputs #:allow-other-keys)
(replace (let ((out (assoc-ref outputs "out"))
'fix-hard-coded-file-names ;; FIXME: use merged ppds (I think actually only
(lambda* (#:key inputs outputs #:allow-other-keys) ;; drvs need to be merged).
(let ((out (assoc-ref outputs "out")) (cupsdir (assoc-ref inputs "cups-minimal")))
;; FIXME: use merged ppds (I think actually only (substitute* "base/g.py"
;; drvs need to be merged). (("'/usr/share;[^']*'")
(cupsdir (assoc-ref inputs "cups-minimal"))) (string-append "'" cupsdir "/share'"))
(substitute* "base/g.py" (("'/etc/hp/hplip.conf'")
(("'/usr/share;[^']*'") (string-append "'" out
(string-append "'" cupsdir "/share'")) "/etc/hp/hplip.conf" "'"))
(("'/etc/hp/hplip.conf'") (("/var/lib/hp")
(string-append "'" out (string-append
"/etc/hp/hplip.conf" "'")) out
(("/var/lib/hp") "/var/lib/hp")))
(string-append
out
"/var/lib/hp")))
(substitute* "Makefile.in" (substitute* "Makefile.in"
(("[[:blank:]]check-plugin\\.py[[:blank:]]") " ") (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ")
;; FIXME Use beginning-of-word in regexp. ;; FIXME Use beginning-of-word in regexp.
(("[[:blank:]]plugin\\.py[[:blank:]]") " ") (("[[:blank:]]plugin\\.py[[:blank:]]") " ")
(("/usr/include/libusb-1.0") (("/usr/include/libusb-1.0")
(string-append (assoc-ref inputs "libusb") (string-append (assoc-ref inputs "libusb")
"/include/libusb-1.0")) "/include/libusb-1.0"))
(("hplip_statedir =.*$") (("hplip_statedir =.*$")
;; Don't bail out while trying to create ;; Don't bail out while trying to create
;; /var/lib/hplip. We can safely change its value ;; /var/lib/hplip. We can safely change its value
;; here because it's hard-coded in the code anyway. ;; here because it's hard-coded in the code anyway.
"hplip_statedir = $(prefix)/var/lib/hp\n") "hplip_statedir = $(prefix)/var/lib/hp\n")
(("hplip_confdir = /etc/hp") (("hplip_confdir = /etc/hp")
;; This is only used for installing the default config. ;; This is only used for installing the default config.
(string-append "hplip_confdir = " out (string-append "hplip_confdir = " out
"/etc/hp")) "/etc/hp"))
(("halpredir = /usr/share/hal/fdi/preprobe/10osvendor") (("halpredir = /usr/share/hal/fdi/preprobe/10osvendor")
;; We don't use hal. ;; We don't use hal.
(string-append "halpredir = " out (string-append "halpredir = " out
"/share/hal/fdi/preprobe/10osvendor")) "/share/hal/fdi/preprobe/10osvendor"))
(("rulesdir = /etc/udev/rules.d") (("rulesdir = /etc/udev/rules.d")
;; udev rules will be merged by base service. ;; udev rules will be merged by base service.
(string-append "rulesdir = " out (string-append "rulesdir = " out
"/lib/udev/rules.d")) "/lib/udev/rules.d"))
(("rulessystemdir = /usr/lib/systemd/system") (("rulessystemdir = /usr/lib/systemd/system")
;; We don't use systemd. ;; We don't use systemd.
(string-append "rulessystemdir = " out (string-append "rulessystemdir = " out
"/lib/systemd/system")) "/lib/systemd/system"))
(("/etc/sane.d") (("/etc/sane.d")
(string-append out "/etc/sane.d"))) (string-append out "/etc/sane.d")))
(substitute* "common/utils.h" (substitute* "common/utils.h"
(("/var/lib/hp") (("/var/lib/hp")
(string-append (string-append
out out
"/var/lib/hp"))) "/var/lib/hp"))))))
#t))) (add-after 'install-models-dat 'install-plugins
(add-after (lambda* (#:key outputs system inputs #:allow-other-keys)
'install-models-dat 'install-plugins (let* ((out (assoc-ref outputs "out"))
(lambda* (#:key outputs system inputs #:allow-other-keys) (state-dir (string-append out "/var/lib/hp"))
(let* ((out (assoc-ref outputs "out")) (hp-arch (assoc-ref
(state-dir (string-append out "/var/lib/hp")) '(("i686-linux" . "x86_32")
(hp-arch (assoc-ref ("x86_64-linux" . "x86_64")
'(("i686-linux" . "x86_32") ("armhf-linux" . "arm32")
("x86_64-linux" . "x86_64") ("aarch64-linux" . "aarch64"))
("armhf-linux" . "arm32") system)))
("aarch64-linux" . "aarch64")) (unless hp-arch
system))) (error (string-append
(unless hp-arch "HPLIP plugin not supported on "
(error (string-append system)))
"HPLIP plugin not supported on " (invoke "sh" (assoc-ref inputs "hplip-plugin")
system))) "--noexec" "--keep")
(invoke "sh" (assoc-ref inputs "hplip-plugin") (chdir "plugin_tmp")
"--noexec" "--keep") (install-file "plugin.spec"
(chdir "plugin_tmp") (string-append out "/share/hplip/"))
(install-file "plugin.spec"
(string-append out "/share/hplip/"))
(for-each (for-each
(lambda (file) (lambda (file)
(install-file (install-file
file file
(string-append out "/share/hplip/data/firmware"))) (string-append out "/share/hplip/data/firmware")))
(find-files "." "\\.fw.gz$")) (find-files "." "\\.fw.gz$"))
(install-file "license.txt" (install-file "license.txt"
(string-append out "/share/hplip/data/plugins")) (string-append out "/share/hplip/data/plugins"))
(mkdir-p (mkdir-p
(string-append out "/share/hplip/prnt/plugins")) (string-append out "/share/hplip/prnt/plugins"))
(for-each (for-each
(lambda (type plugins) (lambda (type plugins)
(for-each (for-each
(lambda (plugin) (lambda (plugin)
(let ((file (string-append plugin "-" hp-arch ".so")) (let ((file (string-append plugin "-" hp-arch ".so"))
(dir (string-append out "/share/hplip/" (dir (string-append out "/share/hplip/"
type "/plugins"))) type "/plugins")))
(install-file file dir) (install-file file dir)
(chmod (string-append dir "/" file) #o755) (chmod (string-append dir "/" file) #o755)
(symlink (string-append dir "/" file) (symlink (string-append dir "/" file)
(string-append dir "/" plugin ".so")))) (string-append dir "/" plugin ".so"))))
plugins)) plugins))
'("prnt" "scan") '("prnt" "scan")
'(("lj" "hbpl1") '(("lj" "hbpl1")
("bb_soap" "bb_marvell" "bb_soapht" "bb_escl"))) ("bb_soap" "bb_marvell" "bb_soapht" "bb_escl")))
(mkdir-p state-dir) (mkdir-p state-dir)
(call-with-output-file (call-with-output-file
(string-append state-dir "/hplip.state") (string-append state-dir "/hplip.state")
(lambda (port) (lambda (port)
(simple-format port "[plugin] (simple-format port "[plugin]
installed=1 installed=1
eula=1 eula=1
version=~A version=~A
" ,(package-version hplip)))) " ,(package-version hplip))))
(substitute* (string-append out "/etc/hp/hplip.conf") (substitute* (string-append out "/etc/hp/hplip.conf")
(("/usr") out)) (("/usr") out)))))))))))
#t)))))))))