Subject: bug#26803: [PATCH 33/36] gnu: Add java-commons-httpclient.

From: Roel Janssen <[email-masked]>
Date: Thu, 11 May 2017 10:35:34 +0200

Ricardo Wurmus writes:

> * gnu/packages/java.scm (java-commons-httpclient): New variable.
> ---
>  gnu/packages/java.scm | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>
> diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
> index 4bc03e5ca..1639570f9 100644
> --- a/gnu/packages/java.scm
> +++ b/gnu/packages/java.scm
> @@ -2164,6 +2164,61 @@ standards and recommendations.")
>         ("java-junit" ,java-junit)
>         ("java-hamcrest-core" ,java-hamcrest-core)))))
>  
> +(define-public java-commons-httpclient
> +  (package
> +    (name "java-commons-httpclient")
> +    (version "3.1")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append "mirror://apache/"
> +                                  "httpcomponents/commons-httpclient/source/"
> +                                  "commons-httpclient-" version "-src.tar.gz"))
> +              (sha256
> +               (base32
> +                "1wlpn3cfy3d4inxy6g7wxcsa8p7sshn6aldk9y4ia3lb879rd97r"))))
> +    (build-system ant-build-system)
> +    (arguments
> +     `(#:make-flags
> +       (let ((junit   (assoc-ref %build-inputs "java-junit"))
> +             (codec   (assoc-ref %build-inputs "java-commons-codec"))
> +             (logging (assoc-ref %build-inputs "java-commons-logging-minimal")))
> +         (list (string-append "-Djunit.jar=" junit "/share/java/junit.jar")
> +               (string-append "-Dcommons-codec.jar=" codec
> +                              "/share/java/commons-codec.jar")
> +               (string-append "-Dcommons-logging.jar=" logging
> +                              "/share/java/commons-logging-minimal.jar")))
> +       #:build-target "dist"
> +       #:test-target "test"
> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'fix-utf8-problems
> +           (lambda _
> +             ;; These files contain invalid characters.
> +             (with-fluids ((%default-port-encoding "ISO-8859-1"))
> +               (substitute* '("src/examples/ClientApp.java"
> +                              "src/examples/TrivialApp.java"
> +                              "src/test/org/apache/commons/httpclient/TestHttps.java"
> +                              "src/test/org/apache/commons/httpclient/TestURIUtil2.java"
> +                              "src/java/org/apache/commons/httpclient/\
> +HttpContentTooLargeException.java")
> +                 (("Ortwin Gl.") "Ortwin Glue"))
> +               (substitute* "src/test/org/apache/commons/httpclient/TestURIUtil2.java"
> +                 (("\xe4") "")
> +                 (("%C3%A4") "")))
> +             #t))
> +         (replace 'install (install-jars "dist")))))
> +    (inputs
> +     `(("java-commons-logging-minimal" ,java-commons-logging-minimal)
> +       ("java-commons-codec" ,java-commons-codec)
> +       ("java-junit" ,java-junit)))
> +    (home-page "http://hc.apache.org/httpclient-3.x/")
> +    (synopsis "Deprecated HTTP client library for Java")

Now that sound wonderful.. ;)

> +    (description "The Commons HttpClient project is now end of life, and is
> +no longer being developed.  It has been replaced by the Apache HttpComponents
> +project in its HttpClient and HttpCore modules, which offer better performance
> +and more flexibility.")
> +    (license license:asl2.0)))
> +
>  (define-public java-commons-cli
>    (package
>      (name "java-commons-cli")

I guess we need it for some dependency.  Is it possible to use the
java-httpcomponents-httpclient for these?

If we really need this package, then the recipe looks good to me, but I
think it'be better to not need an already deprecated version of
something that does networking stuff.

Kind regards,
Roel Janssen