simple-scan can't use hpaio

  • Done
  • quality assurance status badge
Details
3 participants
  • Andy Patterson
  • Danny Milosavljevic
  • Ludovic Courtès
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal

Debbugs page

Danny Milosavljevic wrote 8 years ago
(address . bug-guix@gnu.org)
20161203194113.6456663e@scratchpost.org
simple-scan can't use hpaio as scanner. That means that HP scanners don't work at all.

That's because:

(1) sane-backends installs a hard-coded dll.conf . In itself, that's not so bad. However, this file doesn't contain a line "hpaio".
To workaround this, I set environment variable SANE_CONFIG_DIR to point to a directory which contains a dll.conf which contains (only) a line "hpaio".
(2) sane-backends tries to load /gnu/store/f4kmkdf8s0kpwia9wgiw5a35xljh4a77-sane-backends-1.0.25/lib/sane/libsane-hpaio.so.1 - which won't work.
I checked the source code of sane-backends - and it searches many locations for loadable dynamic libraries, for example the ones specified in environment variables LD_LIBRARY_PATH, SHLIB_PATH LIBPATH (see backend/dll.c load()).
(3) dll.conf has no support for absolute paths. Whatever you put there it will just blindly put after a hard-coded directory prefix.

This is on GuixSD.

How to proceed? Add support for absolute paths and a service which merges multiple dll.conf into one file ?

Or just add hplip as a hard dependency of sane-backends and make it link libsane-hpaio (that's possible in sane)?

Also, should we also amend simple-scan to propagate-input hplip? Otherwise it will come up with a "Install Driver" dialog which won't work either.
Andy Patterson wrote 8 years ago
(address . 25101@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20161204040037.21758-1-ajpatter@uwaterloo.ca
Hi Danny,

I also noticed this problem a couple days ago, and I really needed to scan
something, so I've had these patches in my tree. It basically implements your
second suggestion. I think it's the right way to go about it.

I realise you might also have patches you're working on, but maybe this is
helpful anyway.

Suggestions welcome, especially concerning how I handled the recursive module
dependencies.

Thanks,

--
Andy
Andy Patterson wrote 8 years ago
[PATCH 1/2] gnu: Add hpaio-enabled sane-backends variant.
(address . 25101@debbugs.gnu.org)
20161204040037.21758-2-ajpatter@uwaterloo.ca
* gnu/packages/scanner.scm (sane-backends+hpaio): New variable.
---
gnu/packages/scanner.scm | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

Toggle diff (54 lines)
diff --git a/gnu/packages/scanner.scm b/gnu/packages/scanner.scm
index 76817b3..f918291 100644
--- a/gnu/packages/scanner.scm
+++ b/gnu/packages/scanner.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 John Darrington <jmd@gnu.org>
;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
+;;; Copyright © 2016 Andy Patterson <ajpatter@uwaterloo.ca>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -20,6 +21,7 @@
(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 libusb)
@@ -73,3 +75,31 @@ proving access to any raster image scanner hardware (flatbed scanner,
hand-held scanner, video- and still-cameras, frame-grabbers, etc.). The
package contains the library and drivers.")
(license licence:gpl2+))) ; plus linking exception
+
+(define-public sane-backends+hpaio
+ (package
+ (inherit sane-backends)
+ (name "sane-backends+hpaio")
+ (inputs
+ `(("hplip" ,(@ (gnu packages cups) hplip))
+ ,@(package-inputs sane-backends)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments sane-backends)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'add-backends
+ (lambda _
+ (substitute* "backend/dll.conf.in"
+ (("hp5590" all) (format #f "~a~%~a" all "hpaio")))
+ #t))
+ (add-after 'install 'install-hpaio
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (define hplip (string-append (assoc-ref inputs "hplip")
+ "/lib/sane"))
+ (define out (string-append (assoc-ref outputs "out")
+ "/lib/sane"))
+ (for-each
+ (lambda (file)
+ (symlink file (string-append out "/" (basename file))))
+ (find-files hplip))
+ #t))))))))
--
2.10.2
Andy Patterson wrote 8 years ago
[PATCH 2/2] gnu: simple-scan: Enable hpaio support.
(address . 25101@debbugs.gnu.org)
20161204040037.21758-3-ajpatter@uwaterloo.ca
* gnu/packages/gnome.scm (simple-scan)[inputs]: Use
'sane-backends+hpaio'.
---
gnu/packages/gnome.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 3aa0f56..531da43 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -3572,7 +3572,7 @@ USB transfers with your high-level application or system daemon.")
("cairo" ,cairo)
("gdk-pixbuf" ,gdk-pixbuf)
("gusb" ,gusb)
- ("libsane" ,sane-backends)))
+ ("libsane" ,sane-backends+hpaio)))
(native-inputs
`(("gettext" ,gettext-minimal)
("itstool" ,itstool)
--
2.10.2
Andy Patterson wrote 8 years ago
Re: bug#25101: simple-scan can't use hpaio
(address . 25101@debbugs.gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20161203231846.3ae41966@uwaterloo.ca
On Sat, 3 Dec 2016 23:00:35 -0500
Andy Patterson <ajpatter@uwaterloo.ca> wrote:

Toggle quote (19 lines)
> Hi Danny,
>
> I also noticed this problem a couple days ago, and I really needed to
> scan something, so I've had these patches in my tree. It basically
> implements your second suggestion. I think it's the right way to go
> about it.
>
> I realise you might also have patches you're working on, but maybe
> this is helpful anyway.
>
> Suggestions welcome, especially concerning how I handled the
> recursive module dependencies.
>
> Thanks,
>
> --
> Andy
>

Just adding Danny; didn't realise that a CC also needs to be added to
the compose window for "git send-email".
Ludovic Courtès wrote 8 years ago
Re: bug#25101: [PATCH 1/2] gnu: Add hpaio-enabled sane-backends variant.
(name . Andy Patterson)(address . ajpatter@uwaterloo.ca)(address . 25101@debbugs.gnu.org)
871sxm14rf.fsf@gnu.org
Andy Patterson <ajpatter@uwaterloo.ca> skribis:

Toggle quote (2 lines)
> * gnu/packages/scanner.scm (sane-backends+hpaio): New variable.

[...]

Toggle quote (2 lines)
> +(define-public sane-backends+hpaio

Could you add a comment and a synopsis explaining what’s this is?

Toggle quote (7 lines)
> + (package
> + (inherit sane-backends)
> + (name "sane-backends+hpaio")
> + (inputs
> + `(("hplip" ,(@ (gnu packages cups) hplip))
> + ,@(package-inputs sane-backends)))

The closure size of this is 290 MiB whereas it’s 87 MiB for
‘sane-backends’. I suppose that’s the reason to keep’em separated?

Otherwise LGTM, thanks!

Ludo’.
Andy Patterson wrote 8 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 25101@debbugs.gnu.org)
20161205173827.49a9001a@uwaterloo.ca
On Mon, 05 Dec 2016 21:48:36 +0100
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (5 lines)
> > +(define-public sane-backends+hpaio
>
> Could you add a comment and a synopsis explaining what’s this is?
>

Sure, is the following patch ok?

Toggle quote (11 lines)
> > + (package
> > + (inherit sane-backends)
> > + (name "sane-backends+hpaio")
> > + (inputs
> > + `(("hplip" ,(@ (gnu packages cups) hplip))
> > + ,@(package-inputs sane-backends)))
>
> The closure size of this is 290 MiB whereas it’s 87 MiB for
> ‘sane-backends’. I suppose that’s the reason to keep’em separated?
>

Yeah, and there's also the fact that hplip depends on sane-backends.
But this is the reason I didn't change sane-backends into a private
variable, and then make this the new sane-backends.

Toggle quote (4 lines)
> Otherwise LGTM, thanks!
>
> Ludo’.

Thanks for your review.

--
Andy

From 05474fbe68591b136c912db8aa1400b24800c541 Mon Sep 17 00:00:00 2001
From: Andy Patterson <ajpatter@uwaterloo.ca>
Date: Sat, 3 Dec 2016 22:29:44 -0500
Subject: [PATCH 1/2] gnu: Add hpaio-enabled sane-backends variant.

* gnu/packages/scanner.scm (sane-backends+hpaio): New variable.
---
gnu/packages/scanner.scm | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)

Toggle diff (59 lines)
diff --git a/gnu/packages/scanner.scm b/gnu/packages/scanner.scm
index 76817b3..f74c4e1 100644
--- a/gnu/packages/scanner.scm
+++ b/gnu/packages/scanner.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 John Darrington <jmd@gnu.org>
;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
+;;; Copyright © 2016 Andy Patterson <ajpatter@uwaterloo.ca>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -20,6 +21,7 @@
(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 libusb)
@@ -73,3 +75,36 @@ proving access to any raster image scanner hardware (flatbed scanner,
hand-held scanner, video- and still-cameras, frame-grabbers, etc.). The
package contains the library and drivers.")
(license licence:gpl2+))) ; plus linking exception
+
+;; This variant links in the hpaio backend, provided by hplip, which adds
+;; support for HP scanners whose backends are not maintained by
+;; 'sane-backends'
+(define-public sane-backends+hpaio
+ (package
+ (inherit sane-backends)
+ (name "sane-backends+hpaio")
+ (inputs
+ `(("hplip" ,(@ (gnu packages cups) hplip))
+ ,@(package-inputs sane-backends)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments sane-backends)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'add-backends
+ (lambda _
+ (substitute* "backend/dll.conf.in"
+ (("hp5590" all) (format #f "~a~%~a" all "hpaio")))
+ #t))
+ (add-after 'install 'install-hpaio
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (define hplip (string-append (assoc-ref inputs "hplip")
+ "/lib/sane"))
+ (define out (string-append (assoc-ref outputs "out")
+ "/lib/sane"))
+ (for-each
+ (lambda (file)
+ (symlink file (string-append out "/" (basename file))))
+ (find-files hplip))
+ #t))))))
+ (synopsis
+ "Raster image scanner library and drivers, with full HP scanner support")))
--
2.10.2
Ludovic Courtès wrote 8 years ago
(name . Andy Patterson)(address . ajpatter@uwaterloo.ca)(address . 25101@debbugs.gnu.org)
87a8c9xw0u.fsf@gnu.org
Andy Patterson <ajpatter@uwaterloo.ca> skribis:

Toggle quote (10 lines)
> On Mon, 05 Dec 2016 21:48:36 +0100
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> > +(define-public sane-backends+hpaio
>>
>> Could you add a comment and a synopsis explaining what’s this is?
>>
>
> Sure, is the following patch ok?

Yup!

Toggle quote (15 lines)
>> > + (package
>> > + (inherit sane-backends)
>> > + (name "sane-backends+hpaio")
>> > + (inputs
>> > + `(("hplip" ,(@ (gnu packages cups) hplip))
>> > + ,@(package-inputs sane-backends)))
>>
>> The closure size of this is 290 MiB whereas it’s 87 MiB for
>> ‘sane-backends’. I suppose that’s the reason to keep’em separated?
>>
>
> Yeah, and there's also the fact that hplip depends on sane-backends.
> But this is the reason I didn't change sane-backends into a private
> variable, and then make this the new sane-backends.

Oh right.

One last thing: should we renaming “sane-backends” to
“sane-backends-minimal”, and “sane-backends+hpaio” to “sane-backends”?

That way all scanners would work out of the box, at the expense of extra
disk usage, but that is roughly what patch 2/2 does anyway.

Thanks!

Ludo’.
Andy Patterson wrote 8 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 25101@debbugs.gnu.org)
20161212151108.5b51103f@uwaterloo.ca
Hi, and sorry for the late reply.

On Tue, 06 Dec 2016 10:10:57 +0100
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (34 lines)
> Andy Patterson <ajpatter@uwaterloo.ca> skribis:
>
> > On Mon, 05 Dec 2016 21:48:36 +0100
> > ludo@gnu.org (Ludovic Courtès) wrote:
> >
> >> > +(define-public sane-backends+hpaio
> >>
> >> Could you add a comment and a synopsis explaining what’s this is?
> >>
> >
> > Sure, is the following patch ok?
>
> Yup!
>
> >> > + (package
> >> > + (inherit sane-backends)
> >> > + (name "sane-backends+hpaio")
> >> > + (inputs
> >> > + `(("hplip" ,(@ (gnu packages cups) hplip))
> >> > + ,@(package-inputs sane-backends)))
> >>
> >> The closure size of this is 290 MiB whereas it’s 87 MiB for
> >> ‘sane-backends’. I suppose that’s the reason to keep’em separated?
> >>
> >
> > Yeah, and there's also the fact that hplip depends on sane-backends.
> > But this is the reason I didn't change sane-backends into a private
> > variable, and then make this the new sane-backends.
>
> Oh right.
>
> One last thing: should we renaming “sane-backends” to
> “sane-backends-minimal”, and “sane-backends+hpaio” to “sane-backends”?

The current "sane-backends" isn't really minimal, as it includes most
backends. I'm not sure how it's applied elsewhere in Guix though, so
I'll leave it up to you.

Toggle quote (4 lines)
>
> That way all scanners would work out of the box, at the expense of
> extra disk usage, but that is roughly what patch 2/2 does anyway.

One more patch is required in either case, as hplip would need to use
sane-backends-minimal. Let me know if you'd like me to make this change.

--
Andy
Ludovic Courtès wrote 8 years ago
(name . Andy Patterson)(address . ajpatter@uwaterloo.ca)(address . 25101@debbugs.gnu.org)
87zik0wz24.fsf@gnu.org
Andy Patterson <ajpatter@uwaterloo.ca> skribis:

Toggle quote (43 lines)
> Hi, and sorry for the late reply.
>
> On Tue, 06 Dec 2016 10:10:57 +0100
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> Andy Patterson <ajpatter@uwaterloo.ca> skribis:
>>
>> > On Mon, 05 Dec 2016 21:48:36 +0100
>> > ludo@gnu.org (Ludovic Courtès) wrote:
>> >
>> >> > +(define-public sane-backends+hpaio
>> >>
>> >> Could you add a comment and a synopsis explaining what’s this is?
>> >>
>> >
>> > Sure, is the following patch ok?
>>
>> Yup!
>>
>> >> > + (package
>> >> > + (inherit sane-backends)
>> >> > + (name "sane-backends+hpaio")
>> >> > + (inputs
>> >> > + `(("hplip" ,(@ (gnu packages cups) hplip))
>> >> > + ,@(package-inputs sane-backends)))
>> >>
>> >> The closure size of this is 290 MiB whereas it’s 87 MiB for
>> >> ‘sane-backends’. I suppose that’s the reason to keep’em separated?
>> >>
>> >
>> > Yeah, and there's also the fact that hplip depends on sane-backends.
>> > But this is the reason I didn't change sane-backends into a private
>> > variable, and then make this the new sane-backends.
>>
>> Oh right.
>>
>> One last thing: should we renaming “sane-backends” to
>> “sane-backends-minimal”, and “sane-backends+hpaio” to “sane-backends”?
>
> The current "sane-backends" isn't really minimal, as it includes most
> backends. I'm not sure how it's applied elsewhere in Guix though, so
> I'll leave it up to you.

Right. Well maybe while you’re at it you could make the new
‘sane-backend-minimal’ more minimal, it would make sense to me.

Toggle quote (6 lines)
>> That way all scanners would work out of the box, at the expense of
>> extra disk usage, but that is roughly what patch 2/2 does anyway.
>
> One more patch is required in either case, as hplip would need to use
> sane-backends-minimal. Let me know if you'd like me to make this change.

Yes please!

Thank you!

Ludo’.
Andy Patterson wrote 8 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 25101@debbugs.gnu.org)
20161214050325.6348-1-ajpatter@uwaterloo.ca
Hi,

Here's some patches implementing what you've suggested. I decided to use the
full "sane-backends" for the other dependents, since I guessed that they need
some backend support. If anyone knows that that's not required, it can be
changed.

Thanks,

--
Andy
Andy Patterson wrote 8 years ago
[PATCH 1/3] gnu: sane-backends: Disable backend generation.
(name . Ludovic Courtès)(address . ludo@gnu.org)
20161214050325.6348-2-ajpatter@uwaterloo.ca
* gnu/packages/scanner.scm (sane-backends)[arguments]: Add a phase to
disable the compilation of backends.
---
gnu/packages/scanner.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/gnu/packages/scanner.scm b/gnu/packages/scanner.scm
index 76817b389..01db5ee21 100644
--- a/gnu/packages/scanner.scm
+++ b/gnu/packages/scanner.scm
@@ -47,6 +47,10 @@
`(#:tests? #f
#: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)
--
2.11.0
Andy Patterson wrote 8 years ago
[PATCH 2/3] gnu: Add and use sane-backends-minimal.
(name . Ludovic Courtès)(address . ludo@gnu.org)
20161214050325.6348-3-ajpatter@uwaterloo.ca
* gnu/packages/scanner.scm (sane-backends): Rename to...
(sane-backends-minimal): this. Adjust name, source, synopsis and
description accordingly.
* gnu/packages/cups.scm (hplip): Use 'sane-backends-minimal' instead of
'sane-backends'.
* gnu/packages/gnome.scm (colord, simple-scan): Likewise.
* gnu/packages/libreoffice.scm (libreoffice): Likewise.
* gnu/packages/wine.scm (wine): Likewise.
---
gnu/packages/cups.scm | 2 +-
gnu/packages/gnome.scm | 4 ++--
gnu/packages/libreoffice.scm | 2 +-
gnu/packages/scanner.scm | 11 ++++++-----
gnu/packages/wine.scm | 2 +-
5 files changed, 11 insertions(+), 10 deletions(-)

Toggle diff (99 lines)
diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index 0a8a10ecb..baa77f7aa 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -416,7 +416,7 @@ device-specific programs to convert and print many types of files.")
(inputs `(("libjpeg" ,libjpeg)
("cups-minimal" ,cups-minimal)
("libusb" ,libusb)
- ("sane-backends" ,sane-backends)
+ ("sane-backends" ,sane-backends-minimal)
("dbus" ,dbus)
("python-wrapper" ,python-wrapper)
("python" ,python)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 1762381cf..7ffe0bc2d 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -2433,7 +2433,7 @@ keyboard shortcuts.")
("libusb" ,libusb)
("sqlite" ,sqlite)
("polkit" ,polkit)
- ("sane-backends" ,sane-backends)))
+ ("sane-backends" ,sane-backends-minimal)))
(home-page "http://www.freedesktop.org/software/colord/")
(synopsis "Color management service")
(description "Colord is a system service that makes it easy to manage,
@@ -3571,7 +3571,7 @@ USB transfers with your high-level application or system daemon.")
("cairo" ,cairo)
("gdk-pixbuf" ,gdk-pixbuf)
("gusb" ,gusb)
- ("libsane" ,sane-backends)))
+ ("libsane" ,sane-backends-minimal)))
(native-inputs
`(("gettext" ,gettext-minimal)
("itstool" ,itstool)
diff --git a/gnu/packages/libreoffice.scm b/gnu/packages/libreoffice.scm
index 279e8e2d2..307a54496 100644
--- a/gnu/packages/libreoffice.scm
+++ b/gnu/packages/libreoffice.scm
@@ -784,7 +784,7 @@ and to return information on pronunciations, meanings and synonyms.")
("postgresql" ,postgresql)
("python" ,python)
("redland" ,redland)
- ("sane-backends" ,sane-backends)
+ ("sane-backends" ,sane-backends-minimal)
("unixodbc" ,unixodbc)
("unzip" ,unzip)
("vigra" ,vigra)
diff --git a/gnu/packages/scanner.scm b/gnu/packages/scanner.scm
index 01db5ee21..e913858f5 100644
--- a/gnu/packages/scanner.scm
+++ b/gnu/packages/scanner.scm
@@ -26,15 +26,15 @@
#:use-module ((guix licenses)
#:prefix licence:))
-(define-public sane-backends
+(define-public sane-backends-minimal
(package
- (name "sane-backends")
+ (name "sane-backends-minimal")
(version "1.0.25")
(source (origin
(method url-fetch)
(uri (string-append
"https://alioth.debian.org/frs/download.php/file/4146/"
- name "-" version ".tar.gz"))
+ "sane-backends-" version ".tar.gz"))
(sha256
(base32
"0b3fvhrxl4l82bf3v0j47ypjv6a0k5lqbgknrq1agpmjca6vmmx4"))))
@@ -71,9 +71,10 @@
;; **** File generated for html-backends-split mode is different from reference
;; Makefile:501: recipe for target 'check.local' failed
(home-page "http://www.sane-project.org")
- (synopsis "Raster image scanner library and drivers")
+ (synopsis
+ "Raster image scanner library and drivers, without scanner support")
(description "SANE stands for \"Scanner Access Now Easy\" and is an API
proving access to any raster image scanner hardware (flatbed scanner,
hand-held scanner, video- and still-cameras, frame-grabbers, etc.). The
-package contains the library and drivers.")
+package contains the library, but no drivers.")
(license licence:gpl2+))) ; plus linking exception
diff --git a/gnu/packages/wine.scm b/gnu/packages/wine.scm
index 367f27af5..83b6297f0 100644
--- a/gnu/packages/wine.scm
+++ b/gnu/packages/wine.scm
@@ -83,7 +83,7 @@
("libmpg123" ,mpg123)
("libldap" ,openldap)
("libnetapi" ,samba)
- ("libsane" ,sane-backends)
+ ("libsane" ,sane-backends-minimal)
("libpng" ,libpng)
("libjpeg" ,libjpeg)
("libtiff" ,libtiff)
--
2.11.0
Andy Patterson wrote 8 years ago
[PATCH 3/3] gnu: Add and use sane-backends.
(name . Ludovic Courtès)(address . ludo@gnu.org)
20161214050325.6348-4-ajpatter@uwaterloo.ca
* gnu/packages/scanner.scm (sane-backends): New variable.
* gnu/packages/gnome.scm (colord, simple-scan): Use it instead of
'sane-backends-minimal'.
* gnu/packages/libreoffice.scm (libreoffice): Likewise.
* gnu/packages/wine.scm (wine): Likewise.
---
gnu/packages/gnome.scm | 4 ++--
gnu/packages/libreoffice.scm | 2 +-
gnu/packages/scanner.scm | 40 ++++++++++++++++++++++++++++++++++++++++
gnu/packages/wine.scm | 2 +-
4 files changed, 44 insertions(+), 4 deletions(-)

Toggle diff (112 lines)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 7ffe0bc2d..1762381cf 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -2433,7 +2433,7 @@ keyboard shortcuts.")
("libusb" ,libusb)
("sqlite" ,sqlite)
("polkit" ,polkit)
- ("sane-backends" ,sane-backends-minimal)))
+ ("sane-backends" ,sane-backends)))
(home-page "http://www.freedesktop.org/software/colord/")
(synopsis "Color management service")
(description "Colord is a system service that makes it easy to manage,
@@ -3571,7 +3571,7 @@ USB transfers with your high-level application or system daemon.")
("cairo" ,cairo)
("gdk-pixbuf" ,gdk-pixbuf)
("gusb" ,gusb)
- ("libsane" ,sane-backends-minimal)))
+ ("libsane" ,sane-backends)))
(native-inputs
`(("gettext" ,gettext-minimal)
("itstool" ,itstool)
diff --git a/gnu/packages/libreoffice.scm b/gnu/packages/libreoffice.scm
index 307a54496..279e8e2d2 100644
--- a/gnu/packages/libreoffice.scm
+++ b/gnu/packages/libreoffice.scm
@@ -784,7 +784,7 @@ and to return information on pronunciations, meanings and synonyms.")
("postgresql" ,postgresql)
("python" ,python)
("redland" ,redland)
- ("sane-backends" ,sane-backends-minimal)
+ ("sane-backends" ,sane-backends)
("unixodbc" ,unixodbc)
("unzip" ,unzip)
("vigra" ,vigra)
diff --git a/gnu/packages/scanner.scm b/gnu/packages/scanner.scm
index e913858f5..fdad1c445 100644
--- a/gnu/packages/scanner.scm
+++ b/gnu/packages/scanner.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 John Darrington <jmd@gnu.org>
;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
+;;; Copyright © 2016 Andy Patterson <ajpatter@uwaterloo.ca>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -20,6 +21,7 @@
(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 libusb)
@@ -78,3 +80,41 @@ proving access to any raster image scanner hardware (flatbed scanner,
hand-held scanner, video- and still-cameras, frame-grabbers, etc.). The
package contains the library, but no drivers.")
(license licence:gpl2+))) ; plus linking exception
+
+;; This variant links in the hpaio backend, provided by hplip, which adds
+;; support for HP scanners whose backends are not maintained by
+;; 'sane-backends'. It also builds all of those backends.
+(define-public sane-backends
+ (package
+ (inherit sane-backends-minimal)
+ (name "sane-backends")
+ (inputs
+ `(("hplip" ,(@ (gnu packages cups) hplip))
+ ,@(package-inputs sane-backends-minimal)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments sane-backends-minimal)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (delete 'disable-backends)
+ (add-after 'unpack 'add-backends
+ (lambda _
+ (substitute* "backend/dll.conf.in"
+ (("hp5590" all) (format #f "~a~%~a" all "hpaio")))
+ #t))
+ (add-after 'install 'install-hpaio
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (define hplip (string-append (assoc-ref inputs "hplip")
+ "/lib/sane"))
+ (define out (string-append (assoc-ref outputs "out")
+ "/lib/sane"))
+ (for-each
+ (lambda (file)
+ (symlink file (string-append out "/" (basename file))))
+ (find-files hplip))
+ #t))))))
+ (synopsis
+ "Raster image scanner library and drivers, with scanner support")
+ (description "SANE stands for \"Scanner Access Now Easy\" and is an API
+proving access to any raster image scanner hardware (flatbed scanner,
+hand-held scanner, video- and still-cameras, frame-grabbers, etc.). The
+package contains the library and drivers.")))
diff --git a/gnu/packages/wine.scm b/gnu/packages/wine.scm
index 83b6297f0..367f27af5 100644
--- a/gnu/packages/wine.scm
+++ b/gnu/packages/wine.scm
@@ -83,7 +83,7 @@
("libmpg123" ,mpg123)
("libldap" ,openldap)
("libnetapi" ,samba)
- ("libsane" ,sane-backends-minimal)
+ ("libsane" ,sane-backends)
("libpng" ,libpng)
("libjpeg" ,libjpeg)
("libtiff" ,libtiff)
--
2.11.0
Ludovic Courtès wrote 8 years ago
Re: bug#25101: [PATCH 1/2] gnu: Add hpaio-enabled sane-backends variant.
(name . Andy Patterson)(address . ajpatter@uwaterloo.ca)(address . 25101-done@debbugs.gnu.org)
87r356qk6e.fsf@gnu.org
Hello!

Andy Patterson <ajpatter@uwaterloo.ca> skribis:

Toggle quote (5 lines)
> Here's some patches implementing what you've suggested. I decided to use the
> full "sane-backends" for the other dependents, since I guessed that they need
> some backend support. If anyone knows that that's not required, it can be
> changed.

I think that’s fine.

Applied all 3 patches. I also fixed a reproducibility issue due to
timestamps in a subsequent commit.

Thanks!

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 25101@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 25101
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help