gnu: calibre: Remove unrar test.
[jackhill/guix/guix.git] / gnu / packages / scanner.scm
index 7bdbf35..d23da9e 100644 (file)
@@ -2,6 +2,8 @@
 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
 ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
 ;;; Copyright © 2016 Andy Patterson <ajpatter@uwaterloo.ca>
+;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages scanner)
-  #:use-module (guix packages)
-  #:use-module (guix download)
-  #:use-module (guix utils)
-  #:use-module (guix build-system gnu)
-  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages image)
   #:use-module (gnu packages libusb)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix download)
   #:use-module ((guix licenses)
-                #:prefix licence:))
+                #:prefix licence:)
+  #:use-module (guix packages)
+  #:use-module (guix utils))
 
 (define-public sane-backends-minimal
   (package
     (name "sane-backends-minimal")
-    (version "1.0.25")
+    (version "1.0.27")
     (source (origin
              (method url-fetch)
              (uri (string-append
-                   "https://alioth.debian.org/frs/download.php/file/4146/"
+                   "https://alioth.debian.org/frs/download.php/latestfile/176/"
                    "sane-backends-" version ".tar.gz"))
              (sha256
               (base32
-               "0b3fvhrxl4l82bf3v0j47ypjv6a0k5lqbgknrq1agpmjca6vmmx4"))
+               "1j9nbqspaj0rlgalafb5z6r606k0i22kz0rcpd744p176yzlfdr9"))
              (modules '((guix build utils)))
              (snippet
               ;; Generated HTML files and udev rules normally embed a
               ;; timestamp.  Work around that to build things reproducibly.
-              '(substitute* "tools/sane-desc.c"
-                 (("asctime \\(localtime \\(&current_time\\)\\)")
-                  "\"1970-01-01\"")))))
+              '(begin
+                 (substitute* "tools/sane-desc.c"
+                   (("asctime \\(localtime \\(&current_time\\)\\)")
+                    "\"1970-01-01\""))
+                 #t))))
     (build-system gnu-build-system)
     (native-inputs
      `(("pkg-config" ,pkg-config)))
     (inputs
-     `(("libusb-compat" ,libusb-compat)))
+     `(("libusb" ,libusb)))
     (arguments
-     `(#:tests? #f
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-before 'configure 'disable-backends
            (lambda _
              (setenv "BACKENDS" " ")
              #t))
-         (add-after
-          'install 'install-udev-rules
-          (lambda* (#:key outputs #:allow-other-keys)
-            (let ((out (assoc-ref outputs "out")))
-              (mkdir-p (string-append out "/lib/udev/rules.d"))
-              (copy-file "tools/udev/libsane.rules"
-                         (string-append out
-                                        "/lib/udev/rules.d/"
-                                        "60-libsane.rules"))))))))
-    ;; It would seem that tests are not maintained - fails with
-    ;; the following:
-    ;;
-    ;; < This page was last updated on Wed Jul 31 07:52:48 2013
-    ;; <  by sane-desc 3.5 from sane-backends 1.0.24git
-    ;; ---
-    ;; > This page was last updated on Sun Oct 19 15:41:39 2014
-    ;; >  by sane-desc 3.5 from sane-backends 1.0.24
-    ;; **** File generated for html-backends-split mode is different from reference
-    ;; Makefile:501: recipe for target 'check.local' failed
+         (add-after 'unpack 'disable-failing-tests
+           (lambda _
+             ;; Disable unmaintained tests that that fail with errors resembling:
+             ;;
+             ;; < # by sane-desc 3.5 from sane-backends 1.0.24git on Jul 31 2013
+             ;; ---
+             ;; > # by sane-desc 3.5 from sane-backends 1.0.27 on 1970-01-01#
+             ;; FAIL: sane-desc -m usermap -s ./data
+             (for-each
+              (lambda (pattern)
+                (substitute* "testsuite/tools/Makefile.in"
+                  (((string-append " " pattern " ")) " ")))
+              (list "usermap" "db" "udev" "udev\\+acl" "udev\\+hwdb" "hwdb"))
+
+             ;; Disable tests that try to connect to actual USB hardware & fail
+             ;; with the following error when no USB access is allowed at all:
+             ;;
+             ;; sanei_usb_test: sanei_usb_test.c:849: main: Assertion
+             ;; `test_init (1)' failed.
+             (substitute* "testsuite/sanei/Makefile.in"
+               (("sanei_usb_test\\$\\(EXEEXT\\) ") ""))
+             #t))
+         (add-after 'install 'install-udev-rules
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (mkdir-p (string-append out "/lib/udev/rules.d"))
+               (copy-file "tools/udev/libsane.rules"
+                          (string-append out
+                                         "/lib/udev/rules.d/"
+                                         "60-libsane.rules"))
+               #t))))))
     (home-page "http://www.sane-project.org")
     (synopsis
      "Raster image scanner library and drivers, without scanner support")
@@ -96,7 +112,8 @@ package contains the library, but no drivers.")
     (inherit sane-backends-minimal)
     (name "sane-backends")
     (inputs
-     `(("hplip" ,(@ (gnu packages cups) hplip))
+     `(("hplip" ,(@ (gnu packages cups) hplip-minimal))
+       ("libpng" ,libpng)               ; support ‘scanimage --format=png’
        ,@(package-inputs sane-backends-minimal)))
     (arguments
      (substitute-keyword-arguments (package-arguments sane-backends-minimal)