unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add tinyproxy.
@ 2014-06-12 11:06 John Darrington
  2014-06-12 11:59 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: John Darrington @ 2014-06-12 11:06 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/packages/web.scm (tinyproxy): New variable.
* gnu/packages/docbook.scm: Remove #select (tar)
---
 gnu/packages/docbook.scm |    3 +--
 gnu/packages/web.scm     |   62 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index f6d2009..29fa409 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -19,8 +19,7 @@
 (define-module (gnu packages docbook)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
-  #:use-module ((gnu packages base)
-                #:select (tar))
+  #:use-module (gnu packages base)
   #:use-module (guix licenses)
   #:use-module (guix packages)
   #:use-module (guix download)
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 4eb3906..8fd3b75 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -27,10 +27,14 @@
   #:use-module (guix build-system perl)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages apr)
+  #:use-module (gnu packages asciidoc)
+  #:use-module (gnu packages docbook)
   #:use-module (gnu packages autotools)
   #:use-module ((gnu packages compression) #:select (zlib))
   #:use-module (gnu packages openssl)
   #:use-module (gnu packages pcre)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages xml)
   #:use-module (gnu packages perl))
 
 (define-public httpd
@@ -469,3 +473,61 @@ and functions that allow you to write WWW clients. The library also
 contain modules that are of more general use and even classes that
 help you implement simple HTTP servers.")
     (home-page "http://search.cpan.org/~gaas/libwww-perl/")))
+
+(define-public tinyproxy
+  (package
+    (name "tinyproxy")
+    (version "1.8.3")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://www.samba.org/~obnox/" name "/download/" name "-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "0vl9igw7vm924rs6d6bkib7zfclxnlf9s8rmml1sfwj7xda9nmdy"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags
+       (list
+             ;; For the log file, etc.
+             "--localstatedir=/var")
+       #:phases
+        (alist-replace
+         'build
+         (lambda* (#:key inputs #:allow-other-keys #:rest args)
+           ;; This stuff is needed, because without it, xmlint etc tries
+           ;; to download docbookx.dtd and docbook.xsl from the net
+           (let ((build (assoc-ref %standard-phases 'build))
+                 (docbook-xml (assoc-ref inputs "docbook-xml"))
+                 (docbook-xsl (assoc-ref inputs "docbook-xsl"))
+                 (our-catalog "/tmp/docbook-xml.xml"))
+             (setenv "XML_CATALOG_FILES" our-catalog)
+             (if (with-output-to-file our-catalog (lambda ()
+                         (display (string-append
+                          "<?xml version=\"1.0\"?>
+<!DOCTYPE catalog PUBLIC \"-//OASIS//DTD XML Catalogs V1.0//EN\"
+\"file:///usr/share/xml/schema/xml-core/catalog.dtd\">
+<catalog xmlns=\"urn:oasis:names:tc:entity:xmlns:xml:catalog\">
+<system systemId=\"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\"
+uri=\"file://" docbook-xml  "/xml/dtd/docbook/docbookx.dtd\"/>
+<system systemId=\"http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl\"
+uri=\"file://" docbook-xsl  "/xml/xsl/docbook-xsl-1.72.0/manpages/docbook.xsl\"/>
+</catalog>\n"))))
+                 (apply build args) #f)))
+         %standard-phases)))
+    ;; All of the below are used to generate the documentation
+    ;; (Should they be propagated inputs of asciidoc ??)
+    (native-inputs `(("asciidoc" ,asciidoc)
+                     ("libxml2" ,libxml2) 
+                     ("docbook-xml" ,docbook-xml)
+                     ("docbook-xsl" ,docbook-xsl)
+                     ("libxslt" ,libxslt) 
+                     ("python" ,python-2)))
+    (home-page "https://banu.com/tinyproxy/")
+    (synopsis "Light-weight HTTP/HTTPS proxy daemon")
+    (description "Tinyproxy is a light-weight HTTP/HTTPS proxy
+daemon. Designed from the ground up to be fast and yet small, it is an ideal
+solution for use cases such as embedded deployments where a full featured HTTP
+proxy is required, but the system resources for a larger proxy are
+unavailable.") 
+    (license l:gpl2+)))
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: Add tinyproxy.
  2014-06-12 11:06 [PATCH] gnu: Add tinyproxy John Darrington
@ 2014-06-12 11:59 ` Ludovic Courtès
  2014-06-12 12:19   ` John Darrington
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2014-06-12 11:59 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

Hello!

John Darrington <jmd@gnu.org> skribis:

> * gnu/packages/web.scm (tinyproxy): New variable.
> * gnu/packages/docbook.scm: Remove #select (tar)

Should be “#:select”.

OK to push, modulo the tiny things below:

> +        (alist-replace
> +         'build
> +         (lambda* (#:key inputs #:allow-other-keys #:rest args)
> +           ;; This stuff is needed, because without it, xmlint etc tries
> +           ;; to download docbookx.dtd and docbook.xsl from the net
> +           (let ((build (assoc-ref %standard-phases 'build))
> +                 (docbook-xml (assoc-ref inputs "docbook-xml"))
> +                 (docbook-xsl (assoc-ref inputs "docbook-xsl"))
> +                 (our-catalog "/tmp/docbook-xml.xml"))
> +             (setenv "XML_CATALOG_FILES" our-catalog)
> +             (if (with-output-to-file our-catalog (lambda ()
> +                         (display (string-append
> +                          "<?xml version=\"1.0\"?>
> +<!DOCTYPE catalog PUBLIC \"-//OASIS//DTD XML Catalogs V1.0//EN\"
> +\"file:///usr/share/xml/schema/xml-core/catalog.dtd\">
> +<catalog xmlns=\"urn:oasis:names:tc:entity:xmlns:xml:catalog\">
> +<system systemId=\"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\"
> +uri=\"file://" docbook-xml  "/xml/dtd/docbook/docbookx.dtd\"/>
> +<system systemId=\"http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl\"
> +uri=\"file://" docbook-xsl  "/xml/xsl/docbook-xsl-1.72.0/manpages/docbook.xsl\"/>
> +</catalog>\n"))))
> +                 (apply build args) #f)))
> +         %standard-phases)))

Thanks for digging into it.  This will be useful for a number of things,
such as building the Git man pages, so perhaps eventually we’ll
factorize that.

Note that ‘with-output-to-file’ returns *unspecified*, so the else arm
of the ‘if’ is never taken.  Also, write “(lambda ()” on the next line.
Lastly, prefer adding a phase before ‘build’ rather than replacing
‘build’ just to call it afterwards.

So, like this:

  (alist-cons-before
   'build 'pre-build
    (lambda ...
      ...
      (with-output-to-file our-catalog
        (lambda ()
          ...))
      #t)
    %standard-phases)

> +    ;; All of the below are used to generate the documentation
> +    ;; (Should they be propagated inputs of asciidoc ??)

Not sure.  Asciidoc can be used without an XML tool chain, no?

> +    (native-inputs `(("asciidoc" ,asciidoc)
> +                     ("libxml2" ,libxml2) 
> +                     ("docbook-xml" ,docbook-xml)
> +                     ("docbook-xsl" ,docbook-xsl)
> +                     ("libxslt" ,libxslt) 
> +                     ("python" ,python-2)))

Why Python?  Is it build-time only?

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: Add tinyproxy.
  2014-06-12 11:59 ` Ludovic Courtès
@ 2014-06-12 12:19   ` John Darrington
  2014-06-12 13:30     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: John Darrington @ 2014-06-12 12:19 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 808 bytes --]

On Thu, Jun 12, 2014 at 01:59:02PM +0200, Ludovic Court??s wrote:
     Hello!
     
     
     Lastly, prefer adding a phase before ???build??? rather than replacing
     ???build??? just to call it afterwards.
     
     So, like this:
     
       (alist-cons-before
        'build 'pre-build
         (lambda ...
           ...
           (with-output-to-file our-catalog
             (lambda ()
               ...))
           #t)
         %standard-phases)

I'm not sure if this will work.  I need to set an environment variable, and presumably 'build and 'pre-build
run in separate environments?

J'

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: Add tinyproxy.
  2014-06-12 12:19   ` John Darrington
@ 2014-06-12 13:30     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2014-06-12 13:30 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

John Darrington <john@darrington.wattle.id.au> skribis:

> On Thu, Jun 12, 2014 at 01:59:02PM +0200, Ludovic Court??s wrote:
>      Hello!
>      
>      
>      Lastly, prefer adding a phase before ???build??? rather than replacing
>      ???build??? just to call it afterwards.
>      
>      So, like this:
>      
>        (alist-cons-before
>         'build 'pre-build
>          (lambda ...
>            ...
>            (with-output-to-file our-catalog
>              (lambda ()
>                ...))
>            #t)
>          %standard-phases)
>
> I'm not sure if this will work.  I need to set an environment variable, and presumably 'build and 'pre-build
> run in separate environments?

No, they run in the same environments, so it essentially has the same
semantics as the original version.

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-12 13:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-12 11:06 [PATCH] gnu: Add tinyproxy John Darrington
2014-06-12 11:59 ` Ludovic Courtès
2014-06-12 12:19   ` John Darrington
2014-06-12 13:30     ` 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).