diff mbox

gnu: Add darkhttpd.

Message ID 20160910065157.5289-1-arunisaac@systemreboot.net
State New
Headers show

Commit Message

Arun Sept. 10, 2016, 6:51 a.m. UTC
* gnu/packages/web.scm (darkhttpd): New variable.
---
 gnu/packages/web.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Alex Kost Sept. 10, 2016, 7:10 a.m. UTC | #1
Arun Isaac (2016-09-10 12:21 +0530) wrote:

> * gnu/packages/web.scm (darkhttpd): New variable.
> ---
>  gnu/packages/web.scm | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
>
> diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
> index 20c7d12..287c389 100644
> --- a/gnu/packages/web.scm
> +++ b/gnu/packages/web.scm
> @@ -14,6 +14,7 @@
>  ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
>  ;;; Copyright © 2016 Clément Lassieur <clement@lassieur.org>
>  ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
> +;;; Copyright © 2016 Arun Isaac <arunisaac@systemreboot.net>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -3633,3 +3634,35 @@ provides a unix command line interface to a variety of popular www search engine
>  and similar services.")
>      (home-page "https://surfraw.alioth.debian.org/")
>      (license l:public-domain)))
> +
> +(define-public darkhttpd
> +  (package
> +    (name "darkhttpd")
> +    (version "1.12")
> +    (source
> +     (origin
> +       (method git-fetch)

Why 'git-fetch'?  There is a release tarball:

https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2

> +       (uri (git-reference
> +             (url (string-append "https://unix4lyfe.org/git/darkhttpd"))
> +             (commit "master")))
> +       (sha256
> +        (base32
> +         "0wi8dfgj4ic0fsy4dszl69xgxdxlwxz4c30vsw2i2dpnczgjm04k"))
> +       (file-name (string-append name "-" version))))

I think (file-name (string-append name "-" version "-checkout")) is a
cleaner name for a git checkout directory (but using the tarball is
preferred).

> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:make-flags '("CC=gcc")
> +       #:tests? #f ; No test suite
> +       #:phases
> +       (modify-phases %standard-phases
> +         (delete 'configure)
> +         (replace 'install
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (install-file "darkhttpd"
> +                           (string-append (assoc-ref outputs "out") "/bin")))))))

If a phase succeed, it should return non-false value, while the value of
'install-file' is unspecified.  In such cases we add #t to the end of
the phase.  BTW I would shorten that last line by moving "/bin" to the
next one.

> +    (synopsis "Simple static web server")
> +    (description "darkhttpd is a simple static web server.  It is
> +standalone and does not need inetd or ucspi-tcp.  It does not need any
> +config files---you only have to specify the www root.")
> +    (home-page "https://unix4lyfe.org/darkhttpd/")
> +    (license l:isc)))
Arun Sept. 10, 2016, 12:30 p.m. UTC | #2
> Why 'git-fetch'?  There is a release tarball:
>
> https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2

Yes, there is a release tarball. But, there is some server side issue
with the url. When I try to download it with wget, I get a "The server
name sent was not recognized" warning. wget ignores this warning and
moves on. The guix downloader fails completely. Should the guix
downloader be patched to ignore this warning as well?

The guix downloader output is shown below.

$ guix download https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2

Starting download of /tmp/guix-file.9jzMRu
From https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2...
ERROR: Throw to key `gnutls-error' with args `(#<gnutls-error-enum A TLS warning alert has been received.> handshake)'.
failed to download "/tmp/guix-file.9jzMRu" from "https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2"
guix download: error: https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2: download failed

The wget downloader output is shown below.

$ wget https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2

--2016-09-09 23:58:53--  https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2
Resolving unix4lyfe.org (unix4lyfe.org)... 64.62.188.248, 2001:470:1:41::403e:bcf8
Connecting to unix4lyfe.org (unix4lyfe.org)|64.62.188.248|:443... connected.
GnuTLS: A TLS warning alert has been received.
GnuTLS: received alert [112]: The server name sent was not recognized
HTTP request sent, awaiting response... 200 OK
Length: 20184 (20K) [application/x-bzip2]
Saving to: 'darkhttpd-1.12.tar.bz2'

darkhttpd-1.12.tar.bz2            100%[===========================================================>]  19.71K  39.6KB/s    in 0.5s    

2016-09-09 23:58:56 (39.6 KB/s) - 'darkhttpd-1.12.tar.bz2' saved [20184/20184]

I have initiated a conversation about this problem with the darkhttpd
developer. But, he has no idea what the problem might be. I'll have to
do some research on the Internet. Any ideas?

If you insist on a tarball instead of the git repo, we can add this
package after this tarball download url problem is fixed.

> I think (file-name (string-append name "-" version "-checkout")) is a
> cleaner name for a git checkout directory (but using the tarball is
> preferred).
>
> If a phase succeed, it should return non-false value, while the value of
> 'install-file' is unspecified.  In such cases we add #t to the end of
> the phase.  BTW I would shorten that last line by moving "/bin" to the
> next one.

Sure, I'll make these changes as well.
Alex Kost Sept. 10, 2016, 5:44 p.m. UTC | #3
Arun Isaac (2016-09-10 18:00 +0530) wrote:

>> Why 'git-fetch'?  There is a release tarball:
>>
>> https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2
>
> Yes, there is a release tarball. But, there is some server side issue
> with the url. When I try to download it with wget, I get a "The server
> name sent was not recognized" warning. wget ignores this warning and
> moves on. The guix downloader fails completely. Should the guix
> downloader be patched to ignore this warning as well?

Oh, indeed (sorry, I didn't try to do "guix download").  Actually I
don't even know whether this problem can be fixed on the guix side
(since the error comes from gnutls).

[...]
> I have initiated a conversation about this problem with the darkhttpd
> developer. But, he has no idea what the problem might be. I'll have to
> do some research on the Internet. Any ideas?

Sorry, no ideas.  All this TLS stuff is a complete mistery for me, I
hope a more knowledgeable person will comment on this.

> If you insist on a tarball instead of the git repo, we can add this
> package after this tarball download url problem is fixed.

No, no, I don't insist; this problem shouldn't block packaging,
git-fetch will be OK, but I think there should be a comment explaining
why the tarball is not used.
Ludovic Courtès Sept. 11, 2016, 1:52 p.m. UTC | #4
Arun Isaac <arunisaac@systemreboot.net> skribis:

>> Why 'git-fetch'?  There is a release tarball:
>>
>> https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2
>
> Yes, there is a release tarball. But, there is some server side issue
> with the url. When I try to download it with wget, I get a "The server
> name sent was not recognized" warning. wget ignores this warning and
> moves on. The guix downloader fails completely. Should the guix
> downloader be patched to ignore this warning as well?
>
> The guix downloader output is shown below.
>
> $ guix download https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2
>
> Starting download of /tmp/guix-file.9jzMRu
> From https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2...
> ERROR: Throw to key `gnutls-error' with args `(#<gnutls-error-enum A TLS warning alert has been received.> handshake)'.
> failed to download "/tmp/guix-file.9jzMRu" from "https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2"
> guix download: error: https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2: download failed
>
> The wget downloader output is shown below.
>
> $ wget https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2
>
> --2016-09-09 23:58:53--  https://unix4lyfe.org/darkhttpd/darkhttpd-1.12.tar.bz2
> Resolving unix4lyfe.org (unix4lyfe.org)... 64.62.188.248, 2001:470:1:41::403e:bcf8
> Connecting to unix4lyfe.org (unix4lyfe.org)|64.62.188.248|:443... connected.
> GnuTLS: A TLS warning alert has been received.
> GnuTLS: received alert [112]: The server name sent was not recognized

This has to do with the TLS ‘SERVER NAME’ extension (info "(gnutls)
Server name indication").  Unfortunately

  gnutls-cli -p https unix4lyfe.org -VV

doesn’t seem to provide helpful info.

I don’t think we can easily ignore this alert in (guix build download),
and it’s really a server configuration issue in the first place.

Ludo’.
Arun Sept. 11, 2016, 3:14 p.m. UTC | #5
> No, no, I don't insist; this problem shouldn't block packaging,
> git-fetch will be OK, but I think there should be a comment explaining
> why the tarball is not used.

Sure, I'll send a new patch shortly with all suggested changes
incorporated.
diff mbox

Patch

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 20c7d12..287c389 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -14,6 +14,7 @@ 
 ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
 ;;; Copyright © 2016 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
+;;; Copyright © 2016 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3633,3 +3634,35 @@  provides a unix command line interface to a variety of popular www search engine
 and similar services.")
     (home-page "https://surfraw.alioth.debian.org/")
     (license l:public-domain)))
+
+(define-public darkhttpd
+  (package
+    (name "darkhttpd")
+    (version "1.12")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url (string-append "https://unix4lyfe.org/git/darkhttpd"))
+             (commit "master")))
+       (sha256
+        (base32
+         "0wi8dfgj4ic0fsy4dszl69xgxdxlwxz4c30vsw2i2dpnczgjm04k"))
+       (file-name (string-append name "-" version))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags '("CC=gcc")
+       #:tests? #f ; No test suite
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (install-file "darkhttpd"
+                           (string-append (assoc-ref outputs "out") "/bin")))))))
+    (synopsis "Simple static web server")
+    (description "darkhttpd is a simple static web server.  It is
+standalone and does not need inetd or ucspi-tcp.  It does not need any
+config files---you only have to specify the www root.")
+    (home-page "https://unix4lyfe.org/darkhttpd/")
+    (license l:isc)))