* Using cups
@ 2016-03-12 18:12 Danny Milosavljevic
2016-03-13 22:10 ` Ludovic Courtès
0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2016-03-12 18:12 UTC (permalink / raw)
To: guix-devel
Usually, to setup cups, I use <http://localhost:631/>. However, it doesn't work on GuixSD.
Do I need to add a special service to the operating-system config for that to work? Is it not in %desktop-services?
What's the preferred way to set up printers?
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Using cups
2016-03-12 18:12 Using cups Danny Milosavljevic
@ 2016-03-13 22:10 ` Ludovic Courtès
2016-03-15 20:05 ` Danny Milosavljevic
0 siblings, 1 reply; 24+ messages in thread
From: Ludovic Courtès @ 2016-03-13 22:10 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: guix-devel
There’s currently no CUPS service for GuixSD—i.e., nothing you could
directly add to the ‘services’ field of your ‘operating-system’
configuration.
If you would like to contribute one such service, that’d be welcome!
The relevant documentation starts at:
http://www.gnu.org/software/guix/manual/html_node/Defining-Services.html
The CUPS daemon is needed for printers directly connected to your
machine via USB, for instance. Printers accessible over the network are
typically accessible automagically via the GTK+ printer dialog, thanks
to DNS-SD (Avahi).
Ludo’.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Using cups
2016-03-13 22:10 ` Ludovic Courtès
@ 2016-03-15 20:05 ` Danny Milosavljevic
2016-03-15 21:19 ` hplip package (work in progress) Danny Milosavljevic
0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2016-03-15 20:05 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Hi,
On Sun, 13 Mar 2016 23:10:02 +0100
ludo@gnu.org (Ludovic Courtès) wrote:
> There’s currently no CUPS service for GuixSD—i.e., nothing you could
> directly add to the ‘services’ field of your ‘operating-system’
> configuration.
>
> If you would like to contribute one such service, that’d be welcome!
> The relevant documentation starts at:
>
> http://www.gnu.org/software/guix/manual/html_node/Defining-Services.html
Thanks.
I'm trying to get cups to work at all right now...
Currently, I found it needs (mostly to write) the following directories and regular files:
----------
(goes into /etc/cups/cups-files.conf)
DataDir /gnu/store/1h53jmsx7gm7b2sfk0h0k6bgmp8fhv0i-cups-2.1.0/share/cups # read-only
DocumentRoot /gnu/store/1h53jmsx7gm7b2sfk0h0k6bgmp8fhv0i-cups-2.1.0/share/doc/cups # read-only
CacheDir /var/cache/cups
StateDir /var/run/cups
#FIXME FontPath /zzz
Printcap /etc/printcap # written
RequestRoot /var/spool/cups # written
ServerBin /gnu/store/1h53jmsx7gm7b2sfk0h0k6bgmp8fhv0i-cups-2.1.0/lib/cups # read-only
ServerRoot /etc/cups # ???
----------
It starts up with that.
What do we do with these file paths? Should I hard-code the /var paths? Should we ship the cups-files.conf as above in /gnu/store (there's one currently in /gnu/store, but it also specifies SystemGroup "lpadmin sys system root" and so cupsd startup fails - I tried removing it, then it starts up).
For the USB printer, there's /dev/usb/lp0 with group "lp". So when I specify "Group lp" in the cups-files.conf it finds it. There's no PPD for my HP printer so I guess I'll package hplip next. Hplip has weird binary blobs for some stuff. Should we scrape them out?
^ permalink raw reply [flat|nested] 24+ messages in thread
* hplip package (work in progress)
2016-03-15 20:05 ` Danny Milosavljevic
@ 2016-03-15 21:19 ` Danny Milosavljevic
2016-03-16 8:19 ` Andy Wingo
0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2016-03-15 21:19 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Hi,
I'm trying to create a package for hplip, and it manages to reach the install phase and then it fails trying to create /etc/cups . Should we put /etc/cups inside the hplip store directory or what should we do with it?
diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index ff3d152..9373381 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -26,6 +26,10 @@
#:use-module (gnu packages)
#:use-module (gnu packages avahi)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages libusb)
+ #:use-module (gnu packages autotools)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages scanner)
#:use-module (gnu packages image)
#:use-module (gnu packages fonts) ;font-dejavu
#:use-module (gnu packages fontutils)
@@ -297,3 +301,43 @@ device-specific programs to convert and print many types of files.")
("gnutls" ,gnutls)
("cups-filters" ,cups-filters)
("zlib" ,zlib)))))
+
+(define-public hplip
+ (package
+ (name "hplip")
+ (version "3.16.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://sourceforge/hplip/"
+ "/hplip-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1nflgrbyl0fz35djnkn7qsfr5g4sh8lixqna9jvs52wasjllbj7j"))))
+ (build-system gnu-build-system)
+ (home-page "http://hplipopensource.com/")
+ (synopsis "HP Printer Drivers")
+ (description "HP Printer Drivers and PPDs. You can use the PPDs with CUPS as well.")
+ (license (list license:gpl2 license:bsd-3)) ; FIXME and which MIT
+ ; FIXME remove Binary plugin-ins, hp-plugin
+ ; FIXME PPDs use .../lib/cups/filter/hpcups
+ (arguments `(#:configure-flags '("--disable-network-build")
+ #:phases (alist-cons-after
+ 'fix-libusb 'autoreconf
+ (lambda _
+ (setenv "AUTOMAKE" "automake --foreign")
+ (zero? (system* "autoreconf" "-fi")))
+ (alist-cons-after 'unpack 'fix-libusb
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "Makefile.am" (("/usr/include/libusb-1.0") (string-append (assoc-ref inputs "libusb") "/include/libusb-1.0"))))
+ %standard-phases))))
+;FIXME fix "cannot create directory ‘/etc/cups/’: Permission denied"
+ (inputs `(("libjpeg" ,libjpeg)
+ ("cups-minimal" ,cups-minimal)
+ ("libusb" ,libusb)
+ ("python" ,python) ; FIXME propagated-inputs ??
+ ("sane-backends" ,sane-backends)
+ ("dbus" ,dbus)))
+ (native-inputs `(("pkg-config" ,pkg-config)
+ ("automake" ,automake)
+ ("autoconf" ,autoconf)
+ ("libtool" ,libtool)))))
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: hplip package (work in progress)
2016-03-15 21:19 ` hplip package (work in progress) Danny Milosavljevic
@ 2016-03-16 8:19 ` Andy Wingo
2016-03-16 8:45 ` Andy Wingo
0 siblings, 1 reply; 24+ messages in thread
From: Andy Wingo @ 2016-03-16 8:19 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: guix-devel
On Tue 15 Mar 2016 22:19, Danny Milosavljevic <dannym@scratchpost.org> writes:
> Hi,
>
> I'm trying to create a package for hplip, and it manages to reach the install phase and then it fails trying to create /etc/cups . Should we put /etc/cups inside the hplip store directory or what should we do with it?
Generally, yes. If it later needs to be merged into a common /etc/cups
directory for some reason, then cups-service needs to create a union
directory based on the etc/cups packages in a set of packages. See
polkit-service for an example.
Andy
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: hplip package (work in progress)
2016-03-16 8:19 ` Andy Wingo
@ 2016-03-16 8:45 ` Andy Wingo
2016-03-20 0:19 ` Danny Milosavljevic
0 siblings, 1 reply; 24+ messages in thread
From: Andy Wingo @ 2016-03-16 8:45 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: guix-devel
I seem to have left off some words. Fixed below!
On Wed 16 Mar 2016 09:19, Andy Wingo <wingo@igalia.com> writes:
> On Tue 15 Mar 2016 22:19, Danny Milosavljevic <dannym@scratchpost.org> writes:
>
>> Hi,
>>
>> I'm trying to create a package for hplip, and it manages to reach the install phase and then it fails trying to create /etc/cups . Should we put /etc/cups inside the hplip store directory or what should we do with it?
>
> Generally, yes. If it later needs to be merged into a common /etc/cups
^, put it in the hplip store directory
> directory for some reason, then cups-service needs to create a union
> directory based on the etc/cups packages in a set of packages. See
^s/packages/directories/
> polkit-service for an example.
>
> Andy
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: hplip package (work in progress)
2016-03-16 8:45 ` Andy Wingo
@ 2016-03-20 0:19 ` Danny Milosavljevic
2016-03-21 22:07 ` [PATCH v2] Add hplip Danny Milosavljevic
0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2016-03-20 0:19 UTC (permalink / raw)
To: Andy Wingo; +Cc: guix-devel
Hi,
On Wed, 16 Mar 2016 09:45:12 +0100
Andy Wingo <wingo@igalia.com> wrote:
> > Generally, yes. If it later needs to be merged into a common /etc/cups
> ^, put it in the hplip store directory
> > directory for some reason, then cups-service needs to create a union
> > directory based on the etc/cups directories in a set of packages. See
> > polkit-service for an example.
It's trying to update mime.types of cups in order to add pstotiff (pstotiff.convs and pstotiff.types) to it.
hplip's "configure" checks whether there is /usr/share/cups/mime/mime.types . If there is, it prefers that.
Otherwise, it tries to use /etc/cups .
It can be overridden by configure-flag --with-mimedir=... or disabled by --disable-fax-build
However, I think in this case we have to merge the current system's mime.types together.
Checking for mime-types in guix, I found
- ruby mime types
- perl mime types
- cups mime types
- haskell mime types
I guess in this case we should use cups mime types.
cups.scm fiddles around with cups mime types for some tests and also for installation ('install-cups-filters-symlinks).
$out/share/cups/mime/cupsfilters.types and $out/share/cups/mime/cupsfilters.convs and $out/share/cups/drv/cupsfilters.drv and $out/share/ppd .
I think all of these need to do some merging. Cups already does symlink the mime config files from package "cups-filters" into its output dir - but it does not merge.
I also checked polkit-service and it seems to use something called "service extensions" in order to concatenate all the different actions.
It seems to use polkit-configuration-actions (which is always empty? - how does this get set?)
I'd like to ask for help on this, I have no idea how this part works in Guix.
Then, after all this, hplip has hardcoded inside Makefile.am :
# hpmud.rules
rulesdir = /etc/udev/rules.d
if UDEV_SYSFS_RULES
dist_rules_DATA = data/rules/56-hpmud_sysfs.rules
else
dist_rules_DATA = data/rules/56-hpmud.rules
endif
halpredir = /usr/share/hal/fdi/preprobe/10osvendor
dist_halpre_DATA = data/rules/20-hplip-devices.fdi
# hplip.conf
hplip_confdir = /etc/hp
hplip_conf_DATA = hplip.conf
# hplip.state
hplip_statedir = /var/lib/hp
dist_hplip_state_DATA =
Should we substitute those? (I'm already autogen'ing, so it doesn't matter to substitute some more things)
What about /etc/hp/hplip.conf ? Should it be autogenerated (or should we let hp-setup write it?) and we just put the distfile into the store as an example?
I don't think we use hal, so I'll just let it install a useless file, if it absolutely has to. Lirc seems to do the same.
It seems the udev files are already being merged by services/base , right?
I tried to find the generated udev.conf files, and there is for example (I digress):
50-udev-default.rules:KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse"
99-fuse.rules:KERNEL=="fuse", MODE="0666"
I think that's why fuse autoloading doesn't work anymore.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v2] Add hplip
2016-03-20 0:19 ` Danny Milosavljevic
@ 2016-03-21 22:07 ` Danny Milosavljevic
2016-03-22 8:28 ` Andy Wingo
0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2016-03-21 22:07 UTC (permalink / raw)
To: guix-devel
This is a patch that adds hplip. Note that hplip builds and installs but we don't do any of the merging of different packages' ppds etc yet [the majority of the merging will be in "services" and not in "packages", though].
diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index ff3d152..ca637c1 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -26,6 +26,10 @@
#:use-module (gnu packages)
#:use-module (gnu packages avahi)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages libusb)
+ #:use-module (gnu packages autotools)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages scanner)
#:use-module (gnu packages image)
#:use-module (gnu packages fonts) ;font-dejavu
#:use-module (gnu packages fontutils)
@@ -297,3 +301,59 @@ device-specific programs to convert and print many types of files.")
("gnutls" ,gnutls)
("cups-filters" ,cups-filters)
("zlib" ,zlib)))))
+
+(define-public hplip
+ (package
+ (name "hplip")
+ (version "3.16.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://sourceforge/hplip/"
+ "/hplip-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1nflgrbyl0fz35djnkn7qsfr5g4sh8lixqna9jvs52wasjllbj7j"))))
+ (build-system gnu-build-system)
+ (home-page "http://hplipopensource.com/")
+ (synopsis "HP Printer Drivers")
+ (description "HP Printer Drivers and PPDs. You can use the PPDs with CUPS as well.")
+ (license (list license:gpl2 license:bsd-3)) ; FIXME and which MIT
+ ; FIXME remove Binary plugin-ins, hp-plugin
+ ; FIXME PPDs use "hpcups" in cupsFilter. In which directory?
+ ; TODO install apparmor profile files
+ (arguments `(#:configure-flags `("--disable-network-build"
+ ,(string-append "--prefix=" (assoc-ref %outputs "out"))
+ ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc")
+ "--disable-fax-build" ; until mime.types merging works; FIXME re-enable
+ ,(string-append "--with-cupsfilterdir=" (assoc-ref %outputs "out") "/lib/cups/filter") ; TODO merge
+ ,(string-append "--with-cupsbackenddir=" (assoc-ref %outputs "out") "/lib/cups/backend") ; TODO merge
+ ,(string-append "--with-icondir=" (assoc-ref %outputs "out") "/share/applications") ; TODO merge
+ ,(string-append "--with-systraydir=" (assoc-ref %outputs "out") "/etc/xdg")) ; TODO merge
+ ; #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
+ #:phases (alist-cons-after
+ 'fix-libusb 'autoreconf
+ (lambda _
+ (setenv "AUTOMAKE" "automake --foreign")
+ (zero? (system* "autoreconf" "-fi")))
+ (alist-cons-after 'unpack 'fix-libusb
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (substitute* "Makefile.am" (("/usr/include/libusb-1.0") (string-append (assoc-ref inputs "libusb") "/include/libusb-1.0"))
+ (("hplip_statedir[ ]*=[ ]*/var/lib/hp") (string-append "hplip_statedir = " (assoc-ref outputs "out") "/var/lib/hp")) ; only for the installer.
+ (("hplip_confdir[ ]*=[ ]*/etc/hp") (string-append "hplip_confdir = " (assoc-ref outputs "out") "/etc/hp")) ; only for installing the default config
+ (("halpredir[ ]*=[ ]*/usr/share/hal/fdi/preprobe/10osvendor") (string-append "halpredir = " (assoc-ref outputs "out") "/share/hal/fdi/preprobe/10osvendor")) ; I don't think we use hal, so who cares?
+ (("rulesdir[ ]*=[ ]*/etc/udev/rules.d") (string-append "rulesdir = " (assoc-ref outputs "out") "/lib/udev/rules.d")) ; will be merged by base service
+ (("rulessystemdir=/usr/lib/systemd/system") (string-append "rulessystemdir = " (assoc-ref outputs "out") "/lib/systemd/system")) ; dummy
+ (("/etc/sane.d") (string-append (assoc-ref outputs "out") "/etc/sane.d"))))
+ %standard-phases))))
+ (inputs `(("libjpeg" ,libjpeg)
+ ("cups-minimal" ,cups-minimal)
+ ("libusb" ,libusb)
+ ("python" ,python) ; FIXME propagated-inputs ??
+ ("sane-backends" ,sane-backends)
+ ("dbus" ,dbus)))
+ (native-inputs `(("pkg-config" ,pkg-config)
+ ("automake" ,automake)
+ ("autoconf" ,autoconf)
+ ("libtool" ,libtool)
+ ("python" ,python) ; patch-shebang warning
+))))
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v2] Add hplip
2016-03-21 22:07 ` [PATCH v2] Add hplip Danny Milosavljevic
@ 2016-03-22 8:28 ` Andy Wingo
2016-03-22 10:30 ` [PATCH v3] " Danny Milosavljevic
0 siblings, 1 reply; 24+ messages in thread
From: Andy Wingo @ 2016-03-22 8:28 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: guix-devel
On Mon 21 Mar 2016 23:07, Danny Milosavljevic <dannym@scratchpost.org> writes:
> This is a patch that adds hplip. Note that hplip builds and installs but we don't do any of the merging of different packages' ppds etc yet [the majority of the merging will be in "services" and not in "packages", though].
Can you fix the "guix lint" errors please? Thanks :)
Andy
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v3] Add hplip
2016-03-22 8:28 ` Andy Wingo
@ 2016-03-22 10:30 ` Danny Milosavljevic
2016-03-22 10:56 ` Andy Wingo
0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2016-03-22 10:30 UTC (permalink / raw)
To: Andy Wingo; +Cc: guix-devel
Fixed some whitespace and added line breaks to make guix lint happy. Also added python-wrapper as input so that hp-setup works.
diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index ff3d152..266c741 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -26,6 +26,10 @@
#:use-module (gnu packages)
#:use-module (gnu packages avahi)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages libusb)
+ #:use-module (gnu packages autotools)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages scanner)
#:use-module (gnu packages image)
#:use-module (gnu packages fonts) ;font-dejavu
#:use-module (gnu packages fontutils)
@@ -297,3 +301,96 @@ device-specific programs to convert and print many types of files.")
("gnutls" ,gnutls)
("cups-filters" ,cups-filters)
("zlib" ,zlib)))))
+
+(define-public hplip
+ (package
+ (name "hplip")
+ (version "3.16.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://sourceforge/hplip/"
+ "/hplip-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1nflgrbyl0fz35djnkn7qsfr5g4sh8lixqna9jvs52wasjllbj7j"))))
+ (build-system gnu-build-system)
+ (home-page "http://hplipopensource.com/")
+ (synopsis "HP Printer Drivers")
+ (description "Hewlett-Packard Printer Drivers and PPDs.")
+ (license (list license:gpl2 license:bsd-3)) ; FIXME and which MIT
+ ; FIXME remove proprietary plug-in installer, hp-plugin (plugin.py)
+ ; FIXME PPDs use "hpcups" in cupsFilter. In which directory?
+ ; TODO install apparmor profile files
+ (arguments `(#:configure-flags `("--disable-network-build"
+ ,(string-append "--prefix="
+ (assoc-ref %outputs "out"))
+ ,(string-append "--sysconfdir="
+ (assoc-ref %outputs "out") "/etc")
+ ; until mime.types merging works; FIXME re-enable
+ "--disable-fax-build"
+ ,(string-append "--with-cupsfilterdir="
+ (assoc-ref %outputs "out")
+ "/lib/cups/filter") ; TODO merge
+ ,(string-append "--with-cupsbackenddir="
+ (assoc-ref %outputs "out")
+ "/lib/cups/backend") ; TODO merge
+ ,(string-append "--with-icondir="
+ (assoc-ref %outputs "out")
+ "/share/applications") ; TODO merge
+ ,(string-append "--with-systraydir="
+ (assoc-ref %outputs "out")
+ "/etc/xdg")) ; TODO merge
+ #:phases (alist-cons-after 'fix-libusb 'autoreconf
+ (lambda _
+ (setenv "AUTOMAKE" "automake --foreign")
+ (zero? (system* "autoreconf" "-fi")))
+ (alist-cons-after 'unpack 'fix-libusb
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (substitute* "Makefile.am"
+ (("/usr/include/libusb-1.0")
+ (string-append (assoc-ref inputs "libusb")
+ "/include/libusb-1.0"))
+ (("hplip_statedir[ ]*=[ ]*/var/lib/hp")
+ ; only for the installer.
+ (string-append "hplip_statedir = " out
+ "/var/lib/hp"))
+ (("hplip_confdir[ ]*=[ ]*/etc/hp")
+ ; only for installing the default config
+ (string-append "hplip_confdir = " out
+ "/etc/hp"))
+ (("halpredir[ ]*=[ ]*/usr/share/hal/fdi/preprobe/10osvendor")
+ ; I don't think we use hal
+ (string-append "halpredir = " out
+ "/share/hal/fdi/preprobe/10osvendor"))
+ (("rulesdir[ ]*=[ ]*/etc/udev/rules.d")
+ ; will be merged by base service
+ (string-append "rulesdir = " out
+ "/lib/udev/rules.d"))
+ (("rulessystemdir=/usr/lib/systemd/system")
+ ; dummy
+ (string-append "rulessystemdir = " out
+ "/lib/systemd/system"))
+ (("/etc/sane.d")
+ (string-append out
+ "/etc/sane.d")))))
+ %standard-phases))))
+ ; error: Unable to locate models.dat file
+ ; Python3 support is available starting from HPLIP-3.15.2
+ (inputs `(("libjpeg" ,libjpeg)
+ ("cups-minimal" ,cups-minimal)
+ ("libusb" ,libusb)
+ ("sane-backends" ,sane-backends)
+ ("dbus" ,dbus)
+ ; I don't think we need to propagate those.
+ ; wrapper: makes "python" available rather than "python3"
+ ("python-wrapper" ,python-wrapper)
+ ("python" ,python) ; patch-shebang still complains
+ ; TODO: make hp-setup find python-dbus
+ ("python-dbus" ,python-dbus)))
+ ;(propagated-inputs `(("python" ,python)
+ ; ("python-dbus" ,python-dbus)))
+ (native-inputs `(("pkg-config" ,pkg-config)
+ ("automake" ,automake)
+ ("autoconf" ,autoconf)
+ ("libtool" ,libtool)))))
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v3] Add hplip
2016-03-22 10:30 ` [PATCH v3] " Danny Milosavljevic
@ 2016-03-22 10:56 ` Andy Wingo
2016-03-22 19:12 ` [PATCH v4] " Danny Milosavljevic
0 siblings, 1 reply; 24+ messages in thread
From: Andy Wingo @ 2016-03-22 10:56 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: guix-devel
Hi,
Looking better, thank you! A couple of style nits and a tip.
On Tue 22 Mar 2016 11:30, Danny Milosavljevic <dannym@scratchpost.org> writes:
> + (description "Hewlett-Packard Printer Drivers and PPDs.")
> + (license (list license:gpl2 license:bsd-3)) ; FIXME and which MIT
> + ; FIXME remove proprietary plug-in installer, hp-plugin (plugin.py)
> + ; FIXME PPDs use "hpcups" in cupsFilter. In which directory?
> + ; TODO install apparmor profile files
Comments that align with the expression on the next line should start
with ";;". This kind of comment should be full sentences. Good to
leave in a note about AppArmor I guess, though it's not a current thing
in Guix. See other packages for examples of how to delete files.
> + (arguments `(#:configure-flags `("--disable-network-build"
> + ,(string-append "--prefix="
This sort of thing is more usually indented as:
(arguments
`(#:configure-flags
`("--disable-network-build"
(string-append "--prefix=" ...)
...)
#:phases
...))
> + #:phases (alist-cons-after 'fix-libusb 'autoreconf
Please use modify-phases instead of alist-cons-after.
> + ; I don't think we need to propagate those.
> + ; wrapper: makes "python" available rather than "python3"
No need to leave in these comments, IMO.
> + ("python-wrapper" ,python-wrapper)
> + ("python" ,python) ; patch-shebang still complains
> + ; TODO: make hp-setup find python-dbus
> + ("python-dbus" ,python-dbus)))
> + ;(propagated-inputs `(("python" ,python)
> + ; ("python-dbus" ,python-dbus)))
You can probably can remove this too.
Cheers,
Andy
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v4] Add hplip
2016-03-22 10:56 ` Andy Wingo
@ 2016-03-22 19:12 ` Danny Milosavljevic
2016-03-22 23:51 ` cups-service Danny Milosavljevic
2016-03-23 8:45 ` [PATCH v4] Add hplip Andy Wingo
0 siblings, 2 replies; 24+ messages in thread
From: Danny Milosavljevic @ 2016-03-22 19:12 UTC (permalink / raw)
To: Andy Wingo; +Cc: guix-devel
(No functional changes)
diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index ff3d152..93a7828 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -26,6 +26,10 @@
#:use-module (gnu packages)
#:use-module (gnu packages avahi)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages libusb)
+ #:use-module (gnu packages autotools)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages scanner)
#:use-module (gnu packages image)
#:use-module (gnu packages fonts) ;font-dejavu
#:use-module (gnu packages fontutils)
@@ -297,3 +301,96 @@ device-specific programs to convert and print many types of files.")
("gnutls" ,gnutls)
("cups-filters" ,cups-filters)
("zlib" ,zlib)))))
+
+(define-public hplip
+ (package
+ (name "hplip")
+ (version "3.16.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://sourceforge/hplip/"
+ "/hplip-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1nflgrbyl0fz35djnkn7qsfr5g4sh8lixqna9jvs52wasjllbj7j"))))
+ (build-system gnu-build-system)
+ (home-page "http://hplipopensource.com/")
+ (synopsis "HP Printer Drivers")
+ (description "Hewlett-Packard Printer Drivers and PPDs.")
+ (license (list license:gpl2 license:bsd-3)) ; FIXME and which MIT
+ ;; FIXME remove proprietary plug-in installer, hp-plugin (plugin.py)
+ ;; FIXME PPDs use "hpcups" in cupsFilter. In which directory?
+ ;; TODO install apparmor profile files
+ (arguments
+ `(#:configure-flags
+ `("--disable-network-build"
+ ,(string-append "--prefix=" (assoc-ref %outputs "out"))
+ ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc")
+ ;; Disable until mime.types merging works (FIXME)
+ "--disable-fax-build"
+ ,(string-append "--with-cupsfilterdir="
+ (assoc-ref %outputs "out")
+ "/lib/cups/filter") ; TODO merge
+ ,(string-append "--with-cupsbackenddir="
+ (assoc-ref %outputs "out")
+ "/lib/cups/backend") ; TODO merge
+ ,(string-append "--with-icondir="
+ (assoc-ref %outputs "out")
+ "/share/applications") ; TODO merge
+ ,(string-append "--with-systraydir="
+ (assoc-ref %outputs "out")
+ "/etc/xdg")) ; TODO merge
+ #:phases (modify-phases %standard-phases
+ (add-after 'unpack 'fix-libusb
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (substitute* "base/g.py"
+ (("'/etc/hp/hplip.conf'")
+ (string-append "'" out
+ "/etc/hp/hplip.conf" "'")))
+ (substitute* "Makefile.am"
+ (("/usr/include/libusb-1.0")
+ (string-append (assoc-ref inputs "libusb")
+ "/include/libusb-1.0"))
+ (("hplip_statedir[ ]*=[ ]*/var/lib/hp")
+ ;; only for the installer.
+ (string-append "hplip_statedir = " out
+ "/var/lib/hp"))
+ (("hplip_confdir[ ]*=[ ]*/etc/hp")
+ ;; only for installing the default config
+ (string-append "hplip_confdir = " out
+ "/etc/hp"))
+ (("halpredir[ ]*=[ ]*/usr/share/hal/fdi/preprobe/10osvendor")
+ ;; I don't think we use hal
+ (string-append "halpredir = " out
+ "/share/hal/fdi/preprobe/10osvendor"))
+ (("rulesdir[ ]*=[ ]*/etc/udev/rules.d")
+ ;; udev rules will be merged by base service
+ (string-append "rulesdir = " out
+ "/lib/udev/rules.d"))
+ (("rulessystemdir=/usr/lib/systemd/system")
+ ;; dummy
+ (string-append "rulessystemdir = " out
+ "/lib/systemd/system"))
+ (("/etc/sane.d")
+ (string-append out
+ "/etc/sane.d"))))))
+ (add-after 'fix-libusb 'autoreconf
+ (lambda _
+ (setenv "AUTOMAKE" "automake --foreign")
+ (zero? (system* "autoreconf" "-fi")))))))
+
+ ; Python3 support is available starting from HPLIP-3.15.2
+ (inputs `(("libjpeg" ,libjpeg)
+ ("cups-minimal" ,cups-minimal)
+ ("libusb" ,libusb)
+ ("sane-backends" ,sane-backends)
+ ("dbus" ,dbus)
+ ("python-wrapper" ,python-wrapper)
+ ("python" ,python)
+ ; TODO: make hp-setup find python-dbus
+ ("python-dbus" ,python-dbus)))
+ (native-inputs `(("pkg-config" ,pkg-config)
+ ("automake" ,automake)
+ ("autoconf" ,autoconf)
+ ("libtool" ,libtool)))))
^ permalink raw reply related [flat|nested] 24+ messages in thread
* cups-service
2016-03-22 19:12 ` [PATCH v4] " Danny Milosavljevic
@ 2016-03-22 23:51 ` Danny Milosavljevic
2016-03-23 0:40 ` cups-service Danny Milosavljevic
2016-03-23 8:45 ` [PATCH v4] Add hplip Andy Wingo
1 sibling, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2016-03-22 23:51 UTC (permalink / raw)
To: Andy Wingo; +Cc: guix-devel
I added a cups-service to actually enable printing eventually, see below.
What it should do (and doesn't do yet) is union together several directories of other packages.
The generated cups-files.conf should contain as "DataDir" (usually /usr/share) the data directory that cupsd should use, which should contain all those merged-together configs (as subdirs), and as "ServerBin" (usually /usr/lib/cups) the actual executables. It is possible to pass the location of cups-files.conf when starting up cupsd.
The subdirs in datadir are especially:
- drv/ for the driver infos. These contain ppd basenames, among lots of other things. These are a variable number of files, but flat hierarchy.
- mime/ for mime types. These are a constant number of files (flat dir hierarchy), to be concatenated each.
The PPDs are kinda difficult. A possibility is to put them into the directory specified as "ServerRoot" (usually /etc/cups) as subdir "ppd" but I think that's supposed to be for user customizations. Cups ppds are usually in /usr/share/ppd . Cupsfilters ppds are usually in /usr/share/ppd/cupsfilters . hplip ppds are usually in /usr/share/hplip (not yet sure how they get there in the first place, though). cups-driverd get_file actually hard-codes /usr/share/ppd sometimes but usually uses (string-append DataDir subdir name) - but my Debian installation has none of the latter.
The subdirs in serverbin are:
- backend/ (flat dir hierarchy). Overwhelmingly ELF; one Python (what version?) script.
- filter/ (flat dir hierarchy). Overwhelmingly ELF; a few Python (what version?) scripts, one shell script.
- driver/ for the actual drivers (flat dir hierarchy). Most of those (all but 1) are python3 scripts. One ELF.
How do I find out where the cupsd executable is / ensure that it's actually there?
Sources to be merged should be the packages:
- cups-filters
- cups
- hplip
- eventually foomatic
diff --git a/gnu/services/printing.scm b/gnu/services/printing.scm
new file mode 100644
index 0000000..4bc33a2
--- /dev/null
+++ b/gnu/services/printing.scm
@@ -0,0 +1,109 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services printing)
+ #:use-module (gnu services)
+ #:use-module (gnu services shepherd)
+ #:use-module (gnu packages cups)
+ #:use-module (guix gexp)
+ #:use-module (guix records)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-26)
+ #:use-module (ice-9 match)
+ #:export (cups-service))
+
+; TODO or just fetch the one from cups and modify it a bit.
+(define (default-cups-files-config data-dir)
+ ;; generate cups-files.conf [for cupsd -s ...], especially dynamically set DataDir.
+ (mixed-text-file "cups-files.conf"
+ "AccessLog syslog\n"
+ "ErrorLog syslog\n"
+ "PageLog syslog\n"
+ "FatalErrors all\n"
+ "SyncOnClose Yes\n"
+ "User nobody\n"
+ "Group lp\n"
+ ; FIXME SystemGroup lpadmin sys system root
+ ; FIXME ConfigFilePerm
+ ;; DataDir /var/lib/cupsd/data
+ (string-append "DataDir " data-dir "\n") ; /gnu/store/1h53jmsx7gm7b2sfk0h0k6bgmp8fhv0i-cups-2.1.0/share/cups
+ (string-append "DocumentRoot" /gnu/store/1h53jmsx7gm7b2sfk0h0k6bgmp8fhv0i-cups-2.1.0 "/share/doc/cups\n")
+ "CacheDir /var/cache/cups\n"
+ "StateDir /var/run/cups\n"
+ ; FIXME FontPath /zzz
+ "Printcap /etc/printcap\n"
+ "PrintcapFormat bsd\n"
+ "RequestRoot /var/spool/cups\n"
+ ;;/gnu/store/1h53jmsx7gm7b2sfk0h0k6bgmp8fhv0i-cups-2.1.0/lib/cups
+ "ServerBin /home/dannym/.guix-profile/lib/cups\n" ; FIXME
+ "ServerRoot /etc/cups\n" ; FIXME
+))
+
+(define-record-type* <cups>
+ cups make-cups
+ cups?
+ (printers cups-printers)
+ (provision cups-provision))
+
+; TODO cupsd -c /etc/cupsd.conf -s /etc/cups-files.conf -f
+; TODO what user should cupsd run as? (Debian: root)
+; TODO cups-browsed (Debian: also as root)
+; TODO list of printers; paper size, printer vendor and model, interface (if necessary).
+; TODO binding to network interface; running the config html page; auth there; auth in general?
+; TODO support scanners and hpaio thing as sane dll
+
+; FIXME extensions (list (service-extension ...
+; FIXME compose concatenate
+; FIXME extend (lambda (config actions)
+; merge: /var/lib/hp ? no.
+; merge: /etc/hp ? no.
+; merge: /usr/share/hal/fdi ? useless.
+; merge: /etc/udev/rules.d ? done.
+; merge: /lib/systemd/system ? useless.
+; TODO merge: /lib/cups/filter
+; TODO merge: /lib/cups/backend
+; TODO merge: mime.types
+; TODO merge: /share/applications
+; TODO merge: /usr/share/ppd/HP via DRV?
+; TODO merge: drv into DataDir
+
+(define cups-service-type
+ (shepherd-service-type
+ 'cups
+ (match-lambda
+ (($ <cups> printers provision)
+ (let ((loopback? (memq 'loopback provision)))
+ (shepherd-service
+ (requirement '(udev networking)) ; TODO check actual config and reduce
+ (documentation "Bring up printing services.")
+ (provision provision)
+ (start #~(make-forkexec-constructor
+ (list (string-append "/sbin/cupsd") ; FIXME #$cups
+ "-s" (default-cups-files-config "/tmp") ; FIXME pass merged datadir
+ ; FIXME "-c" cups config
+ "-f")))
+ (stop #~(make-kill-destructor))))))))
+
+(define* (cups-service #:key printers (provision '(printing)) )
+ "Return a printing service that starts cups."
+ (service cups-service-type
+ (cups (printers printers)
+ (provision provision))))
+
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: cups-service
2016-03-22 23:51 ` cups-service Danny Milosavljevic
@ 2016-03-23 0:40 ` Danny Milosavljevic
2016-03-23 9:07 ` cups-service v2 Danny Milosavljevic
0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2016-03-23 0:40 UTC (permalink / raw)
To: Andy Wingo; +Cc: guix-devel
>ppds are usually in /usr/share/hplip
Oops, I meant in /usr/share/ppd/hplip
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v4] Add hplip
2016-03-22 19:12 ` [PATCH v4] " Danny Milosavljevic
2016-03-22 23:51 ` cups-service Danny Milosavljevic
@ 2016-03-23 8:45 ` Andy Wingo
2016-03-23 9:39 ` [PATCH v5] " Danny Milosavljevic
1 sibling, 1 reply; 24+ messages in thread
From: Andy Wingo @ 2016-03-23 8:45 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: guix-devel
Hi!
Thank you for the quick reactions on the formatting. I know it can be
irritating, but in the future things will be much smoother :)
Just a couple additional fixes.
On Tue 22 Mar 2016 20:12, Danny Milosavljevic <dannym@scratchpost.org> writes:
> + (build-system gnu-build-system)
> + (home-page "http://hplipopensource.com/")
> + (synopsis "HP Printer Drivers")
> + (description "Hewlett-Packard Printer Drivers and PPDs.")
> + (license (list license:gpl2 license:bsd-3)) ; FIXME and which MIT
> + ;; FIXME remove proprietary plug-in installer, hp-plugin (plugin.py)
> + ;; FIXME PPDs use "hpcups" in cupsFilter. In which directory?
> + ;; TODO install apparmor profile files
Probably you will need to fix the plug-in installer issue before adding
to Guix. For the other ones, the style is to write complete sentences
in comments starting with ";;", including "." at the end.
> + (arguments
> + `(#:configure-flags
> + `("--disable-network-build"
> + ,(string-append "--prefix=" (assoc-ref %outputs "out"))
> + ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc")
> + ;; Disable until mime.types merging works (FIXME)
> + "--disable-fax-build"
> + ,(string-append "--with-cupsfilterdir="
> + (assoc-ref %outputs "out")
> + "/lib/cups/filter") ; TODO merge
> + ,(string-append "--with-cupsbackenddir="
> + (assoc-ref %outputs "out")
> + "/lib/cups/backend") ; TODO merge
> + ,(string-append "--with-icondir="
> + (assoc-ref %outputs "out")
> + "/share/applications") ; TODO merge
> + ,(string-append "--with-systraydir="
> + (assoc-ref %outputs "out")
> + "/etc/xdg")) ; TODO merge
With regards to "TODO merge", that is something to be done outside the
package -- either in the service, or when building a profile. Please
remove these comments and instead be at peace with installing things in
#$out :)
> + #:phases (modify-phases %standard-phases
> + (add-after 'unpack 'fix-libusb
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (let ((out (assoc-ref outputs "out")))
> + (substitute* "base/g.py"
> + (("'/etc/hp/hplip.conf'")
> + (string-append "'" out
> + "/etc/hp/hplip.conf" "'")))
Can you re-indent? It should look like this:
(substitute* filename
((pattern)
substitution))
FWIW, in emacs, the .dir-locals.el should add rules to make C-M-q do
this automatically.
> + ; Python3 support is available starting from HPLIP-3.15.2
";;" and a full stop please.
Thank you again for your patience!
Andy
^ permalink raw reply [flat|nested] 24+ messages in thread
* cups-service v2
2016-03-23 0:40 ` cups-service Danny Milosavljevic
@ 2016-03-23 9:07 ` Danny Milosavljevic
2016-04-29 15:09 ` Ludovic Courtès
0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2016-03-23 9:07 UTC (permalink / raw)
To: Andy Wingo; +Cc: guix-devel
I think I have most of the parts now. Not sure how to tie them together, though:
diff --git a/gnu/services/printing.scm b/gnu/services/printing.scm
new file mode 100644
index 0000000..d8f6924
--- /dev/null
+++ b/gnu/services/printing.scm
@@ -0,0 +1,147 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services printing)
+ #:use-module (gnu services)
+ #:use-module (gnu services shepherd)
+ #:use-module (gnu packages cups)
+ #:use-module (guix gexp)
+ #:use-module (guix records)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-26)
+ #:use-module (ice-9 match)
+ #:export (cups-service))
+
+(define (default-cups-files-config data-dir)
+ ;; generate cups-files.conf [for cupsd -s ...], especially dynamically set DataDir.
+ (mixed-text-file "cups-files.conf"
+ "AccessLog syslog\n"
+ "ErrorLog syslog\n"
+ "PageLog syslog\n"
+ "FatalErrors all\n"
+ "SyncOnClose Yes\n"
+ "User nobody\n"
+ "Group lp\n"
+ ; FIXME SystemGroup lpadmin sys system root
+ ; FIXME ConfigFilePerm
+ ;; DataDir /var/lib/cupsd/data
+ (string-append "DataDir " data-dir "\n") ; /gnu/store/1h53jmsx7gm7b2sfk0h0k6bgmp8fhv0i-cups-2.1.0/share/cups
+ (string-append "DocumentRoot " /gnu/store/1h53jmsx7gm7b2sfk0h0k6bgmp8fhv0i-cups-2.1.0 "/share/doc/cups\n")
+ "CacheDir /var/cache/cups\n"
+ "StateDir /var/run/cups\n"
+ ; FIXME FontPath /zzz
+ "Printcap /etc/printcap\n"
+ "PrintcapFormat bsd\n"
+ "RequestRoot /var/spool/cups\n"
+ ;;/gnu/store/1h53jmsx7gm7b2sfk0h0k6bgmp8fhv0i-cups-2.1.0/lib/cups
+ "ServerBin /home/dannym/.guix-profile/lib/cups\n" ; FIXME
+ "ServerRoot /etc/cups\n" ; FIXME
+))
+
+;; TODO same with /usr/lib/cups
+(define (data-directory packages)
+ "Return a directory containing
+ @file{banners}
+ @file{charsets}
+ @file{drv} (most important)
+ @file{fonts}
+ @file{ipptool}
+ @file{locale}
+ @file{mime}
+ @file{model} (empty)
+ @file{ppdc}
+ @file{ppd-updaters}
+ @file{profiles} (empty)
+ @file{templates}
+ @file{usb}
+ merged from the packages
+ "
+ (computed-file "usr-share-cups"
+ #~(begin
+ (use-modules (guix build union) (srfi srfi-26))
+ (union-build #$output
+ (map (cut string-append <> "/share/cups")
+ (list #$@packages))))
+ #:modules '((guix build union))))
+
+(define-record-type* <cups-configuration>
+ cups-configuration make-cups-configuration
+ cups-configuration?
+ (printers cups-configuration-printers)
+ (provision cups-configuration-provision)
+ (cups cups-configuration-cups (default cups))
+ (actions cups-configuration-actions (default '()))) ; package list
+
+; TODO cupsd -c /etc/cupsd.conf -F
+; TODO what user should cupsd run as? (Debian: root)
+; TODO cups-browsed (Debian: also as root)
+; TODO list of printers; paper size, printer vendor and model, interface (if necessary).
+; TODO binding to network interface; running the config html page; auth there; auth in general?
+; TODO support scanners and hpaio thing as sane dll
+
+;
+;
+;
+; merge: /var/lib/hp ? no
+; merge: /etc/hp ? no
+; merge: /usr/share/hal/fdi ? useless.
+; merge: /etc/udev/rules.d ? done.
+; merge: /lib/systemd/system ? useless.
+; merge: /lib/cups/filter
+; merge: /lib/cups/backend
+; merge: mime.types
+; merge: /share/applications
+; merge: /usr/share/ppd/HP via DRV into DataDir.
+; merge: drv into DataDir
+
+(define cups-shepherd-service
+ (match-lambda
+ (($ <cups-configuration> printers provision cups)
+ (let ((loopback? (memq 'loopback provision)))
+ (list
+ (shepherd-service
+ (requirement '(udev networking)) ; TODO check actual config and reduce
+ (documentation "Bring up printing services.")
+ (provision provision)
+ (start #~(make-forkexec-constructor
+ (list (string-append #$cups "/sbin/cupsd")
+ "-s" (default-cups-files-config "/tmp") ; FIXME merged datadir
+ ; FIXME "-c" cups config
+ "-f")))
+ (stop #~(make-kill-destructor))))))))
+
+(define cups-service-type
+ (service-type (name 'cups)
+ (extensions
+ (list (service-extension shepherd-root-service-type cups-shepherd-service)))
+ (compose concatenate)
+ (extend (lambda (config actions)
+ (cups-configuration
+ (inherit config)
+ (actions
+ (append (cups-configuration-actions config)
+ actions)))))))
+
+(define* (cups-service #:key printers (provision '(printing)) )
+ "Return a printing service that starts cups."
+ (service cups-service-type
+ (cups-configuration (printers printers)
+ (provision provision))))
+
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v5] Add hplip
2016-03-23 8:45 ` [PATCH v4] Add hplip Andy Wingo
@ 2016-03-23 9:39 ` Danny Milosavljevic
2016-03-23 11:36 ` [PATCH v6] " Danny Milosavljevic
0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2016-03-23 9:39 UTC (permalink / raw)
To: Andy Wingo; +Cc: guix-devel
Hi,
thanks for the review! Here's a new version; it also removes the installer of the proprietary plugin installer.
diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index ff3d152..bd85974 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -26,6 +26,10 @@
#:use-module (gnu packages)
#:use-module (gnu packages avahi)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages libusb)
+ #:use-module (gnu packages autotools)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages scanner)
#:use-module (gnu packages image)
#:use-module (gnu packages fonts) ;font-dejavu
#:use-module (gnu packages fontutils)
@@ -297,3 +301,107 @@ device-specific programs to convert and print many types of files.")
("gnutls" ,gnutls)
("cups-filters" ,cups-filters)
("zlib" ,zlib)))))
+
+(define-public hplip
+ (package
+ (name "hplip")
+ (version "3.16.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://sourceforge/hplip/"
+ "/hplip-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1nflgrbyl0fz35djnkn7qsfr5g4sh8lixqna9jvs52wasjllbj7j"))))
+ (build-system gnu-build-system)
+ (home-page "http://hplipopensource.com/")
+ (synopsis "HP Printer Drivers")
+ (description "Hewlett-Packard Printer Drivers and PPDs.")
+ ;; Note: X11 license is only used in install-sh.
+ (license (list license:gpl2 license:bsd-3 license:expat license:x11))
+ ;; TODO install apparmor profile files eventually.
+ (arguments
+ `(#:configure-flags
+ `("--disable-network-build"
+ ,(string-append "--prefix=" (assoc-ref %outputs "out"))
+ ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc")
+ ;; Disable until mime.types merging works (FIXME)
+ "--disable-fax-build"
+ "--enable-hpcups-install"
+ "--enable-new-hpcups"
+ "--enable-cups_ppd_install"
+ "--enable-cups_drv_install"
+ ; TODO add foomatic drv install eventually
+ ; TODO --enable-policykit eventually
+ ,(string-append "--with-cupsfilterdir="
+ (assoc-ref %outputs "out")
+ "/lib/cups/filter")
+ ,(string-append "--with-cupsbackenddir="
+ (assoc-ref %outputs "out")
+ "/lib/cups/backend")
+ ,(string-append "--with-icondir="
+ (assoc-ref %outputs "out")
+ "/share/applications")
+ ,(string-append "--with-systraydir="
+ (assoc-ref %outputs "out")
+ "/etc/xdg"))
+ #:phases (modify-phases %standard-phases
+ (add-after 'unpack 'fix-libusb
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ ;; FIXME use merged ppds (I think actually only drvs need to be merged).
+ (cupsdir (assoc-ref inputs "cups-minimal")))
+ (substitute* "base/g.py"
+ (("'/usr/share;[^']*'")
+ (string-append "'" cupsdir "/share'"))
+ (("'/etc/hp/hplip.conf'")
+ (string-append "'" out
+ "/etc/hp/hplip.conf" "'")))
+ (substitute* "Makefile.am"
+ (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ")
+ ;; FIXME beginning-of-word
+ (("[[:blank:]]plugin\\.py[[:blank:]]") " ")
+ (("/usr/include/libusb-1.0")
+ (string-append (assoc-ref inputs "libusb")
+ "/include/libusb-1.0"))
+ (("hplip_statedir[ ]*=[ ]*/var/lib/hp")
+ ;; only for the installer.
+ (string-append "hplip_statedir = " out
+ "/var/lib/hp"))
+ (("hplip_confdir[ ]*=[ ]*/etc/hp")
+ ;; only for installing the default config
+ (string-append "hplip_confdir = " out
+ "/etc/hp"))
+ (("halpredir[ ]*=[ ]*/usr/share/hal/fdi/preprobe/10osvendor")
+ ;; I don't think we use hal
+ (string-append "halpredir = " out
+ "/share/hal/fdi/preprobe/10osvendor"))
+ (("rulesdir[ ]*=[ ]*/etc/udev/rules.d")
+ ;; udev rules will be merged by base service
+ (string-append "rulesdir = " out
+ "/lib/udev/rules.d"))
+ (("rulessystemdir=/usr/lib/systemd/system")
+ ;; dummy
+ (string-append "rulessystemdir = " out
+ "/lib/systemd/system"))
+ (("/etc/sane.d")
+ (string-append out
+ "/etc/sane.d"))))))
+ (add-after 'fix-libusb 'autoreconf
+ (lambda _
+ (setenv "AUTOMAKE" "automake --foreign")
+ (zero? (system* "autoreconf" "-fi")))))))
+ ;; Python3 support is available starting from HPLIP-3.15.2 .
+ (inputs `(("libjpeg" ,libjpeg)
+ ("cups-minimal" ,cups-minimal)
+ ("libusb" ,libusb)
+ ("sane-backends" ,sane-backends)
+ ("dbus" ,dbus)
+ ("python-wrapper" ,python-wrapper)
+ ("python" ,python)
+ ;; TODO: Make hp-setup find python-dbus.
+ ("python-dbus" ,python-dbus)))
+ (native-inputs `(("pkg-config" ,pkg-config)
+ ("automake" ,automake)
+ ("autoconf" ,autoconf)
+ ("libtool" ,libtool)))))
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v6] Add hplip
2016-03-23 9:39 ` [PATCH v5] " Danny Milosavljevic
@ 2016-03-23 11:36 ` Danny Milosavljevic
2016-03-23 20:46 ` Efraim Flashner
0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2016-03-23 11:36 UTC (permalink / raw)
To: Andy Wingo; +Cc: guix-devel
Fiddle with some of the comments:
diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index ff3d152..ce90a28 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -26,6 +26,10 @@
#:use-module (gnu packages)
#:use-module (gnu packages avahi)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages libusb)
+ #:use-module (gnu packages autotools)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages scanner)
#:use-module (gnu packages image)
#:use-module (gnu packages fonts) ;font-dejavu
#:use-module (gnu packages fontutils)
@@ -297,3 +301,107 @@ device-specific programs to convert and print many types of files.")
("gnutls" ,gnutls)
("cups-filters" ,cups-filters)
("zlib" ,zlib)))))
+
+(define-public hplip
+ (package
+ (name "hplip")
+ (version "3.16.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://sourceforge/hplip/"
+ "/hplip-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1nflgrbyl0fz35djnkn7qsfr5g4sh8lixqna9jvs52wasjllbj7j"))))
+ (build-system gnu-build-system)
+ (home-page "http://hplipopensource.com/")
+ (synopsis "HP Printer Drivers")
+ (description "Hewlett-Packard Printer Drivers and PPDs.")
+ ;; Note: X11 license is only used in install-sh.
+ (license (list license:gpl2 license:bsd-3 license:expat license:x11))
+ ;; TODO install apparmor profile files eventually.
+ (arguments
+ `(#:configure-flags
+ `("--disable-network-build"
+ ,(string-append "--prefix=" (assoc-ref %outputs "out"))
+ ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc")
+ ;; Disable until mime.types merging works (FIXME).
+ "--disable-fax-build"
+ "--enable-hpcups-install"
+ "--enable-new-hpcups"
+ "--enable-cups_ppd_install"
+ "--enable-cups_drv_install"
+ ;; TODO add foomatic drv install eventually.
+ ;; TODO --enable-policykit eventually.
+ ,(string-append "--with-cupsfilterdir="
+ (assoc-ref %outputs "out")
+ "/lib/cups/filter")
+ ,(string-append "--with-cupsbackenddir="
+ (assoc-ref %outputs "out")
+ "/lib/cups/backend")
+ ,(string-append "--with-icondir="
+ (assoc-ref %outputs "out")
+ "/share/applications")
+ ,(string-append "--with-systraydir="
+ (assoc-ref %outputs "out")
+ "/etc/xdg"))
+ #:phases (modify-phases %standard-phases
+ (add-after 'unpack 'fix-libusb
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ ;; FIXME use merged ppds (I think actually only drvs need to be merged).
+ (cupsdir (assoc-ref inputs "cups-minimal")))
+ (substitute* "base/g.py"
+ (("'/usr/share;[^']*'")
+ (string-append "'" cupsdir "/share'"))
+ (("'/etc/hp/hplip.conf'")
+ (string-append "'" out
+ "/etc/hp/hplip.conf" "'")))
+ (substitute* "Makefile.am"
+ (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ")
+ ;; FIXME Use beginning-of-word in regexp.
+ (("[[:blank:]]plugin\\.py[[:blank:]]") " ")
+ (("/usr/include/libusb-1.0")
+ (string-append (assoc-ref inputs "libusb")
+ "/include/libusb-1.0"))
+ (("hplip_statedir[ ]*=[ ]*/var/lib/hp")
+ ;; This is only user in the installer.
+ (string-append "hplip_statedir = " out
+ "/var/lib/hp"))
+ (("hplip_confdir[ ]*=[ ]*/etc/hp")
+ ;; This is only used for installing the default config.
+ (string-append "hplip_confdir = " out
+ "/etc/hp"))
+ (("halpredir[ ]*=[ ]*/usr/share/hal/fdi/preprobe/10osvendor")
+ ;; Note: We don't use hal.
+ (string-append "halpredir = " out
+ "/share/hal/fdi/preprobe/10osvendor"))
+ (("rulesdir[ ]*=[ ]*/etc/udev/rules.d")
+ ;; udev rules will be merged by base service.
+ (string-append "rulesdir = " out
+ "/lib/udev/rules.d"))
+ (("rulessystemdir=/usr/lib/systemd/system")
+ ;; We don't use systemd.
+ (string-append "rulessystemdir = " out
+ "/lib/systemd/system"))
+ (("/etc/sane.d")
+ (string-append out
+ "/etc/sane.d"))))))
+ (add-after 'fix-libusb 'autoreconf
+ (lambda _
+ (setenv "AUTOMAKE" "automake --foreign")
+ (zero? (system* "autoreconf" "-fi")))))))
+ ;; Python3 support is available starting from HPLIP-3.15.2 .
+ (inputs `(("libjpeg" ,libjpeg)
+ ("cups-minimal" ,cups-minimal)
+ ("libusb" ,libusb)
+ ("sane-backends" ,sane-backends)
+ ("dbus" ,dbus)
+ ("python-wrapper" ,python-wrapper)
+ ("python" ,python)
+ ;; TODO: Make hp-setup find python-dbus.
+ ("python-dbus" ,python-dbus)))
+ (native-inputs `(("pkg-config" ,pkg-config)
+ ("automake" ,automake)
+ ("autoconf" ,autoconf)
+ ("libtool" ,libtool)))))
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v6] Add hplip
2016-03-23 11:36 ` [PATCH v6] " Danny Milosavljevic
@ 2016-03-23 20:46 ` Efraim Flashner
2016-03-23 23:56 ` [PATCH v7] " Danny Milosavljevic
0 siblings, 1 reply; 24+ messages in thread
From: Efraim Flashner @ 2016-03-23 20:46 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 7619 bytes --]
On Wed, Mar 23, 2016 at 12:36:30PM +0100, Danny Milosavljevic wrote:
> Fiddle with some of the comments:
>
> diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
> index ff3d152..ce90a28 100644
> --- a/gnu/packages/cups.scm
> +++ b/gnu/packages/cups.scm
> @@ -26,6 +26,10 @@
> #:use-module (gnu packages)
> #:use-module (gnu packages avahi)
> #:use-module (gnu packages compression)
> + #:use-module (gnu packages libusb)
> + #:use-module (gnu packages autotools)
> + #:use-module (gnu packages python)
> + #:use-module (gnu packages scanner)
> #:use-module (gnu packages image)
> #:use-module (gnu packages fonts) ;font-dejavu
> #:use-module (gnu packages fontutils)
> @@ -297,3 +301,107 @@ device-specific programs to convert and print many types of files.")
> ("gnutls" ,gnutls)
> ("cups-filters" ,cups-filters)
> ("zlib" ,zlib)))))
> +
> +(define-public hplip
> + (package
> + (name "hplip")
> + (version "3.16.2")
> + (source (origin
> + (method url-fetch)
> + (uri (string-append "mirror://sourceforge/hplip/"
> + "/hplip-" version ".tar.gz"))
> + (sha256
> + (base32
> + "1nflgrbyl0fz35djnkn7qsfr5g4sh8lixqna9jvs52wasjllbj7j"))))
> + (build-system gnu-build-system)
> + (home-page "http://hplipopensource.com/")
> + (synopsis "HP Printer Drivers")
> + (description "Hewlett-Packard Printer Drivers and PPDs.")
> + ;; Note: X11 license is only used in install-sh.
> + (license (list license:gpl2 license:bsd-3 license:expat license:x11))
> + ;; TODO install apparmor profile files eventually.
> + (arguments
> + `(#:configure-flags
> + `("--disable-network-build"
> + ,(string-append "--prefix=" (assoc-ref %outputs "out"))
> + ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc")
> + ;; Disable until mime.types merging works (FIXME).
> + "--disable-fax-build"
> + "--enable-hpcups-install"
> + "--enable-new-hpcups"
> + "--enable-cups_ppd_install"
> + "--enable-cups_drv_install"
> + ;; TODO add foomatic drv install eventually.
> + ;; TODO --enable-policykit eventually.
> + ,(string-append "--with-cupsfilterdir="
> + (assoc-ref %outputs "out")
> + "/lib/cups/filter")
> + ,(string-append "--with-cupsbackenddir="
> + (assoc-ref %outputs "out")
> + "/lib/cups/backend")
> + ,(string-append "--with-icondir="
> + (assoc-ref %outputs "out")
> + "/share/applications")
> + ,(string-append "--with-systraydir="
> + (assoc-ref %outputs "out")
> + "/etc/xdg"))
> + #:phases (modify-phases %standard-phases
> + (add-after 'unpack 'fix-libusb
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (let ((out (assoc-ref outputs "out"))
> + ;; FIXME use merged ppds (I think actually only drvs need to be merged).
> + (cupsdir (assoc-ref inputs "cups-minimal")))
> + (substitute* "base/g.py"
pull the other parts of substitute* back so that they're under the 'u'
in substitute
> + (("'/usr/share;[^']*'")
> + (string-append "'" cupsdir "/share'"))
> + (("'/etc/hp/hplip.conf'")
> + (string-append "'" out
> + "/etc/hp/hplip.conf" "'")))
> + (substitute* "Makefile.am"
> + (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ")
> + ;; FIXME Use beginning-of-word in regexp.
> + (("[[:blank:]]plugin\\.py[[:blank:]]") " ")
> + (("/usr/include/libusb-1.0")
> + (string-append (assoc-ref inputs "libusb")
> + "/include/libusb-1.0"))
> + (("hplip_statedir[ ]*=[ ]*/var/lib/hp")
> + ;; This is only user in the installer.
> + (string-append "hplip_statedir = " out
> + "/var/lib/hp"))
> + (("hplip_confdir[ ]*=[ ]*/etc/hp")
> + ;; This is only used for installing the default config.
> + (string-append "hplip_confdir = " out
> + "/etc/hp"))
> + (("halpredir[ ]*=[ ]*/usr/share/hal/fdi/preprobe/10osvendor")
> + ;; Note: We don't use hal.
> + (string-append "halpredir = " out
> + "/share/hal/fdi/preprobe/10osvendor"))
> + (("rulesdir[ ]*=[ ]*/etc/udev/rules.d")
> + ;; udev rules will be merged by base service.
> + (string-append "rulesdir = " out
> + "/lib/udev/rules.d"))
> + (("rulessystemdir=/usr/lib/systemd/system")
> + ;; We don't use systemd.
> + (string-append "rulessystemdir = " out
> + "/lib/systemd/system"))
> + (("/etc/sane.d")
> + (string-append out
> + "/etc/sane.d"))))))
> + (add-after 'fix-libusb 'autoreconf
> + (lambda _
> + (setenv "AUTOMAKE" "automake --foreign")
> + (zero? (system* "autoreconf" "-fi")))))))
> + ;; Python3 support is available starting from HPLIP-3.15.2 .
> + (inputs `(("libjpeg" ,libjpeg)
> + ("cups-minimal" ,cups-minimal)
> + ("libusb" ,libusb)
> + ("sane-backends" ,sane-backends)
> + ("dbus" ,dbus)
> + ("python-wrapper" ,python-wrapper)
> + ("python" ,python)
python-wrapper wraps python, so that python3 is presented to the system
as python and as python3. Does the package really need both?
> + ;; TODO: Make hp-setup find python-dbus.
> + ("python-dbus" ,python-dbus)))
> + (native-inputs `(("pkg-config" ,pkg-config)
> + ("automake" ,automake)
> + ("autoconf" ,autoconf)
> + ("libtool" ,libtool)))))
>
This was one of the packages that I was looking at packaging and it
looks a lot more complicated than I would've thought. Great work so far
on the package!
--
Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v7] Add hplip
2016-03-23 20:46 ` Efraim Flashner
@ 2016-03-23 23:56 ` Danny Milosavljevic
2016-04-04 21:45 ` Ludovic Courtès
0 siblings, 1 reply; 24+ messages in thread
From: Danny Milosavljevic @ 2016-03-23 23:56 UTC (permalink / raw)
To: Efraim Flashner; +Cc: guix-devel
> python-wrapper wraps python, so that python3 is presented to the system
> as python and as python3. Does the package really need both?
Yes. Many of the hplip scripts use #!/usr/bin/env python and some use #!/usr/bin/env python3 . There's a script "hplip-install" which is kinda like patch-shebang, though.
Just tried: If I don't have python-wrapper as input, lots and lots of the binaries have #!/usr/bin/env python . Otherwise they have #!/gnu/store/n88c56xy9ymb8rvf9cz0qwwgmbiz0vw7-python-wrapper-3.4.3/bin/python directly.
diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index ff3d152..73dbccc 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -26,6 +26,10 @@
#:use-module (gnu packages)
#:use-module (gnu packages avahi)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages libusb)
+ #:use-module (gnu packages autotools)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages scanner)
#:use-module (gnu packages image)
#:use-module (gnu packages fonts) ;font-dejavu
#:use-module (gnu packages fontutils)
@@ -297,3 +301,107 @@ device-specific programs to convert and print many types of files.")
("gnutls" ,gnutls)
("cups-filters" ,cups-filters)
("zlib" ,zlib)))))
+
+(define-public hplip
+ (package
+ (name "hplip")
+ (version "3.16.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://sourceforge/hplip/"
+ "/hplip-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1nflgrbyl0fz35djnkn7qsfr5g4sh8lixqna9jvs52wasjllbj7j"))))
+ (build-system gnu-build-system)
+ (home-page "http://hplipopensource.com/")
+ (synopsis "HP Printer Drivers")
+ (description "Hewlett-Packard Printer Drivers and PPDs.")
+ ;; Note: X11 license is only used in install-sh.
+ (license (list license:gpl2 license:bsd-3 license:expat license:x11))
+ ;; TODO install apparmor profile files eventually.
+ (arguments
+ `(#:configure-flags
+ `("--disable-network-build"
+ ,(string-append "--prefix=" (assoc-ref %outputs "out"))
+ ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc")
+ ;; Disable until mime.types merging works (FIXME).
+ "--disable-fax-build"
+ "--enable-hpcups-install"
+ "--enable-new-hpcups"
+ "--enable-cups_ppd_install"
+ "--enable-cups_drv_install"
+ ;; TODO add foomatic drv install eventually.
+ ;; TODO --enable-policykit eventually.
+ ,(string-append "--with-cupsfilterdir="
+ (assoc-ref %outputs "out")
+ "/lib/cups/filter")
+ ,(string-append "--with-cupsbackenddir="
+ (assoc-ref %outputs "out")
+ "/lib/cups/backend")
+ ,(string-append "--with-icondir="
+ (assoc-ref %outputs "out")
+ "/share/applications")
+ ,(string-append "--with-systraydir="
+ (assoc-ref %outputs "out")
+ "/etc/xdg"))
+ #:phases (modify-phases %standard-phases
+ (add-after 'unpack 'fix-libusb
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ ;; FIXME use merged ppds (I think actually only drvs need to be merged).
+ (cupsdir (assoc-ref inputs "cups-minimal")))
+ (substitute* "base/g.py"
+ (("'/usr/share;[^']*'")
+ (string-append "'" cupsdir "/share'"))
+ (("'/etc/hp/hplip.conf'")
+ (string-append "'" out
+ "/etc/hp/hplip.conf" "'")))
+ (substitute* "Makefile.am"
+ (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ")
+ ;; FIXME Use beginning-of-word in regexp.
+ (("[[:blank:]]plugin\\.py[[:blank:]]") " ")
+ (("/usr/include/libusb-1.0")
+ (string-append (assoc-ref inputs "libusb")
+ "/include/libusb-1.0"))
+ (("hplip_statedir[ ]*=[ ]*/var/lib/hp")
+ ;; This is only user in the installer.
+ (string-append "hplip_statedir = " out
+ "/var/lib/hp"))
+ (("hplip_confdir[ ]*=[ ]*/etc/hp")
+ ;; This is only used for installing the default config.
+ (string-append "hplip_confdir = " out
+ "/etc/hp"))
+ (("halpredir[ ]*=[ ]*/usr/share/hal/fdi/preprobe/10osvendor")
+ ;; Note: We don't use hal.
+ (string-append "halpredir = " out
+ "/share/hal/fdi/preprobe/10osvendor"))
+ (("rulesdir[ ]*=[ ]*/etc/udev/rules.d")
+ ;; udev rules will be merged by base service.
+ (string-append "rulesdir = " out
+ "/lib/udev/rules.d"))
+ (("rulessystemdir=/usr/lib/systemd/system")
+ ;; We don't use systemd.
+ (string-append "rulessystemdir = " out
+ "/lib/systemd/system"))
+ (("/etc/sane.d")
+ (string-append out
+ "/etc/sane.d"))))))
+ (add-after 'fix-libusb 'autoreconf
+ (lambda _
+ (setenv "AUTOMAKE" "automake --foreign")
+ (zero? (system* "autoreconf" "-fi")))))))
+ ;; Python3 support is available starting from HPLIP-3.15.2 .
+ (inputs `(("libjpeg" ,libjpeg)
+ ("cups-minimal" ,cups-minimal)
+ ("libusb" ,libusb)
+ ("sane-backends" ,sane-backends)
+ ("dbus" ,dbus)
+ ("python-wrapper" ,python-wrapper)
+ ("python" ,python)
+ ;; TODO: Make hp-setup find python-dbus.
+ ("python-dbus" ,python-dbus)))
+ (native-inputs `(("pkg-config" ,pkg-config)
+ ("automake" ,automake)
+ ("autoconf" ,autoconf)
+ ("libtool" ,libtool)))))
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v7] Add hplip
2016-03-23 23:56 ` [PATCH v7] " Danny Milosavljevic
@ 2016-04-04 21:45 ` Ludovic Courtès
2016-04-10 20:57 ` Danny Milosavljevic
2016-04-29 15:07 ` Ludovic Courtès
0 siblings, 2 replies; 24+ messages in thread
From: Ludovic Courtès @ 2016-04-04 21:45 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 1284 bytes --]
Hi,
Here’s an improved version of the patch you posted, which removes the
dependency on Autoconf/Automake and keeps using /var as the
localstatedir.
However, programs now need help to find their Python modules:
--8<---------------cut here---------------start------------->8---
$ /gnu/store/4s58vq7zn5l10143736imvq4nzjzyc7m-hplip-3.16.2/bin/hp-scan --version
Traceback (most recent call last):
File "/gnu/store/4s58vq7zn5l10143736imvq4nzjzyc7m-hplip-3.16.2/bin/hp-scan", line 40, in <module>
import scanext
ImportError: No module named 'scanext'
$ /gnu/store/4s58vq7zn5l10143736imvq4nzjzyc7m-hplip-3.16.2/bin/hp-probe
Traceback (most recent call last):
File "/gnu/store/4s58vq7zn5l10143736imvq4nzjzyc7m-hplip-3.16.2/bin/hp-probe", line 38, in <module>
from base import device, utils, tui, module
File "/gnu/store/4s58vq7zn5l10143736imvq4nzjzyc7m-hplip-3.16.2/share/hplip/base/device.py", line 42, in <module>
from . import status
File "/gnu/store/4s58vq7zn5l10143736imvq4nzjzyc7m-hplip-3.16.2/share/hplip/base/status.py", line 33, in <module>
import cupsext
ImportError: No module named 'cupsext'
--8<---------------cut here---------------end--------------->8---
Could someone add a phase to do this?
TIA. :-)
Ludo’.
[-- Attachment #2: Type: text/x-patch, Size: 6602 bytes --]
diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index ff3d152..82541ad 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -1,7 +1,8 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -26,6 +27,10 @@
#:use-module (gnu packages)
#:use-module (gnu packages avahi)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages libusb)
+ #:use-module (gnu packages autotools)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages scanner)
#:use-module (gnu packages image)
#:use-module (gnu packages fonts) ;font-dejavu
#:use-module (gnu packages fontutils)
@@ -297,3 +302,105 @@ device-specific programs to convert and print many types of files.")
("gnutls" ,gnutls)
("cups-filters" ,cups-filters)
("zlib" ,zlib)))))
+
+(define-public hplip
+ (package
+ (name "hplip")
+ (version "3.16.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://sourceforge/hplip/"
+ "/hplip-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1nflgrbyl0fz35djnkn7qsfr5g4sh8lixqna9jvs52wasjllbj7j"))))
+ (build-system gnu-build-system)
+ (home-page "http://hplipopensource.com/")
+ (synopsis "HP Printer Drivers")
+ (description "Hewlett-Packard Printer Drivers and PPDs.")
+ ;; Note: X11 license is only used in install-sh.
+ (license (list license:gpl2 license:bsd-3 license:expat license:x11))
+ ;; TODO install apparmor profile files eventually.
+ (arguments
+ `(#:configure-flags
+ `("--disable-network-build"
+ ,(string-append "--prefix=" (assoc-ref %outputs "out"))
+ ,(string-append "--sysconfdir=" (assoc-ref %outputs "out") "/etc")
+ ;; Disable until mime.types merging works (FIXME).
+ "--disable-fax-build"
+ "--enable-hpcups-install"
+ "--enable-new-hpcups"
+ "--enable-cups_ppd_install"
+ "--enable-cups_drv_install"
+ ;; TODO add foomatic drv install eventually.
+ ;; TODO --enable-policykit eventually.
+ ,(string-append "--with-cupsfilterdir="
+ (assoc-ref %outputs "out")
+ "/lib/cups/filter")
+ ,(string-append "--with-cupsbackenddir="
+ (assoc-ref %outputs "out")
+ "/lib/cups/backend")
+ ,(string-append "--with-icondir="
+ (assoc-ref %outputs "out")
+ "/share/applications")
+ ,(string-append "--with-systraydir="
+ (assoc-ref %outputs "out")
+ "/etc/xdg"))
+ #:phases (modify-phases %standard-phases
+ ;; FIXME: Add phase to wrap bin/* so that the Python libs
+ ;; are found.
+ (add-after 'unpack 'fix-hard-coded-file-names
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ ;; FIXME: use merged ppds (I think actually only
+ ;; drvs need to be merged).
+ (cupsdir (assoc-ref inputs "cups-minimal")))
+ (substitute* "base/g.py"
+ (("'/usr/share;[^']*'")
+ (string-append "'" cupsdir "/share'"))
+ (("'/etc/hp/hplip.conf'")
+ (string-append "'" out
+ "/etc/hp/hplip.conf" "'")))
+
+ (substitute* "Makefile.in"
+ (("[[:blank:]]check-plugin\\.py[[:blank:]]") " ")
+ ;; FIXME Use beginning-of-word in regexp.
+ (("[[:blank:]]plugin\\.py[[:blank:]]") " ")
+ (("/usr/include/libusb-1.0")
+ (string-append (assoc-ref inputs "libusb")
+ "/include/libusb-1.0"))
+ (("^\tinstall-dist_hplip_stateDATA")
+ ;; Remove dependencies on
+ ;; 'install-dist_hplip_stateDATA' so we don't bail
+ ;; out while trying to create /var/lib/hplip.
+ "\t")
+ (("hplip_confdir = /etc/hp")
+ ;; This is only used for installing the default config.
+ (string-append "hplip_confdir = " out
+ "/etc/hp"))
+ (("halpredir = /usr/share/hal/fdi/preprobe/10osvendor")
+ ;; Note: We don't use hal.
+ (string-append "halpredir = " out
+ "/share/hal/fdi/preprobe/10osvendor"))
+ (("rulesdir = /etc/udev/rules.d")
+ ;; udev rules will be merged by base service.
+ (string-append "rulesdir = " out
+ "/lib/udev/rules.d"))
+ (("rulessystemdir = /usr/lib/systemd/system")
+ ;; We don't use systemd.
+ (string-append "rulessystemdir = " out
+ "/lib/systemd/system"))
+ (("/etc/sane.d")
+ (string-append out
+ "/etc/sane.d")))))))))
+ ;; Python3 support is available starting from HPLIP-3.15.2 .
+ (inputs `(("libjpeg" ,libjpeg)
+ ("cups-minimal" ,cups-minimal)
+ ("libusb" ,libusb)
+ ("sane-backends" ,sane-backends)
+ ("dbus" ,dbus)
+ ("python-wrapper" ,python-wrapper)
+ ("python" ,python)
+ ;; TODO: Make hp-setup find python-dbus.
+ ("python-dbus" ,python-dbus)))
+ (native-inputs `(("pkg-config" ,pkg-config)))))
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v7] Add hplip
2016-04-04 21:45 ` Ludovic Courtès
@ 2016-04-10 20:57 ` Danny Milosavljevic
2016-04-29 15:07 ` Ludovic Courtès
1 sibling, 0 replies; 24+ messages in thread
From: Danny Milosavljevic @ 2016-04-10 20:57 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Hi,
On Mon, 04 Apr 2016 23:45:07 +0200
ludo@gnu.org (Ludovic Courtès) wrote:
> Here’s an improved version of the patch you posted, which removes the
> dependency on Autoconf/Automake and keeps using /var as the
> localstatedir.
I've tested your patched patch and can confirm that the package "hplip" still builds and installs fine.
> However, programs now need help to find their Python modules:
> Could someone add a phase to do this?
Hmm, I don't know how to do that. Is there a custom python module loader? I've posted here about it on 05 Apr 2016 (subject is "Re: Python and propagation").
If there's already another official way of doing it in guix, I don't know it. I can patch hpscan to make it manually fiddle with sys.path if that's ok...
gtklick seems to do it via site pth files.
couger seems to manually modify sys.path and add stuff at the end (why at the end?)
Where are all the other python adjustments at?
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v7] Add hplip
2016-04-04 21:45 ` Ludovic Courtès
2016-04-10 20:57 ` Danny Milosavljevic
@ 2016-04-29 15:07 ` Ludovic Courtès
1 sibling, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2016-04-29 15:07 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: guix-devel
ludo@gnu.org (Ludovic Courtès) skribis:
> Here’s an improved version of the patch you posted, which removes the
> dependency on Autoconf/Automake and keeps using /var as the
> localstatedir.
>
> However, programs now need help to find their Python modules:
>
> $ /gnu/store/4s58vq7zn5l10143736imvq4nzjzyc7m-hplip-3.16.2/bin/hp-scan --version
> Traceback (most recent call last):
> File "/gnu/store/4s58vq7zn5l10143736imvq4nzjzyc7m-hplip-3.16.2/bin/hp-scan", line 40, in <module>
> import scanext
> ImportError: No module named 'scanext'
> $ /gnu/store/4s58vq7zn5l10143736imvq4nzjzyc7m-hplip-3.16.2/bin/hp-probe
> Traceback (most recent call last):
> File "/gnu/store/4s58vq7zn5l10143736imvq4nzjzyc7m-hplip-3.16.2/bin/hp-probe", line 38, in <module>
> from base import device, utils, tui, module
> File "/gnu/store/4s58vq7zn5l10143736imvq4nzjzyc7m-hplip-3.16.2/share/hplip/base/device.py", line 42, in <module>
> from . import status
> File "/gnu/store/4s58vq7zn5l10143736imvq4nzjzyc7m-hplip-3.16.2/share/hplip/base/status.py", line 33, in <module>
> import cupsext
> ImportError: No module named 'cupsext'
>
> Could someone add a phase to do this?
I finally fixed it and will push shortly.
Ludo’.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: cups-service v2
2016-03-23 9:07 ` cups-service v2 Danny Milosavljevic
@ 2016-04-29 15:09 ` Ludovic Courtès
0 siblings, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2016-04-29 15:09 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: guix-devel
Danny Milosavljevic <dannym@scratchpost.org> skribis:
> I think I have most of the parts now. Not sure how to tie them together, though:
[...]
> +(define-module (gnu services printing)
Overall the patch looks good, but did you have a chance to test it?
(Sorry for the delay…)
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2016-04-29 15:10 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-12 18:12 Using cups Danny Milosavljevic
2016-03-13 22:10 ` Ludovic Courtès
2016-03-15 20:05 ` Danny Milosavljevic
2016-03-15 21:19 ` hplip package (work in progress) Danny Milosavljevic
2016-03-16 8:19 ` Andy Wingo
2016-03-16 8:45 ` Andy Wingo
2016-03-20 0:19 ` Danny Milosavljevic
2016-03-21 22:07 ` [PATCH v2] Add hplip Danny Milosavljevic
2016-03-22 8:28 ` Andy Wingo
2016-03-22 10:30 ` [PATCH v3] " Danny Milosavljevic
2016-03-22 10:56 ` Andy Wingo
2016-03-22 19:12 ` [PATCH v4] " Danny Milosavljevic
2016-03-22 23:51 ` cups-service Danny Milosavljevic
2016-03-23 0:40 ` cups-service Danny Milosavljevic
2016-03-23 9:07 ` cups-service v2 Danny Milosavljevic
2016-04-29 15:09 ` Ludovic Courtès
2016-03-23 8:45 ` [PATCH v4] Add hplip Andy Wingo
2016-03-23 9:39 ` [PATCH v5] " Danny Milosavljevic
2016-03-23 11:36 ` [PATCH v6] " Danny Milosavljevic
2016-03-23 20:46 ` Efraim Flashner
2016-03-23 23:56 ` [PATCH v7] " Danny Milosavljevic
2016-04-04 21:45 ` Ludovic Courtès
2016-04-10 20:57 ` Danny Milosavljevic
2016-04-29 15:07 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).