unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Add junit.
@ 2016-04-22 14:16 Ricardo Wurmus
  2016-04-22 14:59 ` Eric Bavier
  2016-04-29 15:16 ` HTTP server invalid date header Ludovic Courtès
  0 siblings, 2 replies; 8+ messages in thread
From: Ricardo Wurmus @ 2016-04-22 14:16 UTC (permalink / raw)
  To: guix-devel@gnu.org

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

Hi Guix,

here’s a first batch of patches for Java libraries.  Many Java packages
depend on JUnit, so that’s where I started.  “hamcrest-core” is just a
small part of the whole hamcrest library, but it’s enough to build
JUnit.

I tested JUnit previously with the log4j-api package, but I cannot
submit this right now due to a bug(?) in Guile’s HTTP client, which
makes it impossible for me to download the sources of its dependencies,
such as this one:

    http://central.maven.org/maven2/org/osgi/org.osgi.core/6.0.0/org.osgi.core-6.0.0-sources.jar
    ERROR: Bad Date header: Wed, 30 Jul 2014  3:47:42 GMT

Once that’s fixed I’ll try to get more Java stuff packaged.

~~ Ricardo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-java-qdox-1.12.patch --]
[-- Type: text/x-patch, Size: 2638 bytes --]

From 78c6375f283f0bd1e58ea3036078aa589521d496 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Fri, 22 Apr 2016 16:07:38 +0200
Subject: [PATCH 1/4] gnu: Add java-qdox-1.12.

* gnu/packages/java.scm (java-qdox-1.12): New variable.
---
 gnu/packages/java.scm | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 02131f1..4005751 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -23,6 +23,7 @@
   #:use-module (guix download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system ant)
   #:use-module (gnu packages)
   #:use-module (gnu packages attr)
   #:use-module (gnu packages autotools)
@@ -829,3 +830,44 @@ build process and its dependencies, whereas Make uses Makefile format.")
                    "jdk-drop" "langtools-drop" "hotspot-drop")))))))
 
 (define-public icedtea icedtea-7)
+;; java-hamcrest-core uses qdox version 1.12.  We package this version instead
+;; of the latest release.
+(define-public java-qdox-1.12
+  (package
+    (name "java-qdox")
+    (version "1.12.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://central.maven.org/maven2/"
+                                  "com/thoughtworks/qdox/qdox/" version
+                                  "/qdox-" version "-sources.jar"))
+              (sha256
+               (base32
+                "0hlfbqq2avf5s26wxkksqmkdyk6zp9ggqn37c468m96mjv0n9xfl"))))
+    (build-system ant-build-system)
+    (arguments
+     `(;; Tests require junit
+       #:tests? #f
+       #:jar-name "qdox.jar"
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'unpack
+           (lambda* (#:key source #:allow-other-keys)
+             (mkdir "src")
+             (with-directory-excursion "src"
+               (zero? (system* "jar" "-xf" source)))))
+         ;; At this point we don't have junit, so we must remove the API
+         ;; tests.
+         (add-after 'unpack 'delete-tests
+           (lambda _
+             (delete-file-recursively "src/com/thoughtworks/qdox/junit")
+             #t)))))
+    (home-page "http://qdox.codehaus.org/")
+    (synopsis "Parse definitions from Java source files")
+    (description
+     "QDox is a high speed, small footprint parser for extracting
+class/interface/method definitions from source files complete with JavaDoc
+@code{@tags}.  It is designed to be used by active code generators or
+documentation tools.")
+    (license license:asl2.0)))
+
-- 
2.7.3


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-Add-java-jarjar.patch --]
[-- Type: text/x-patch, Size: 2129 bytes --]

From e7cc2c93ad870fed42c6ad0a73ee22e2213a7db1 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Fri, 22 Apr 2016 16:08:14 +0200
Subject: [PATCH 2/4] gnu: Add java-jarjar.

* gnu/packages/java.scm (java-jarjar): New variable.
---
 gnu/packages/java.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 4005751..6013626 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -871,3 +871,39 @@ class/interface/method definitions from source files complete with JavaDoc
 documentation tools.")
     (license license:asl2.0)))
 
+(define-public java-jarjar
+  (package
+    (name "java-jarjar")
+    (version "1.4")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://storage.googleapis.com/google-code-archive-downloads/v2/"
+                    "code.google.com/jarjar/jarjar-src-" version ".zip"))
+              (sha256
+               (base32
+                "1v8irhni9cndcw1l1wxqgry013s2kpj0qqn57lj2ji28xjq8ndjl"))))
+    (build-system ant-build-system)
+    (arguments
+     `(;; Tests require junit, which ultimately depends on this package.
+       #:tests? #f
+       #:build-target "jar"
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((target (string-append (assoc-ref outputs "out")
+                                          "/share/java")))
+               (install-file (string-append "dist/jarjar-" ,version ".jar")
+                             target))
+             #t)))))
+    (native-inputs
+     `(("unzip" ,unzip)))
+    (home-page "https://code.google.com/archive/p/jarjar/")
+    (synopsis "Repackage Java libraries")
+    (description
+     "Jar Jar Links is a utility that makes it easy to repackage Java
+libraries and embed them into your own distribution.  Jar Jar Links includes
+an Ant task that extends the built-in @code{jar} task.")
+    (license license:asl2.0)))
+
-- 
2.7.3


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-Add-java-hamcrest-core.patch --]
[-- Type: text/x-patch, Size: 4334 bytes --]

From bca8447276390a1e38061e50be1c83ddc9545350 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Fri, 22 Apr 2016 16:08:41 +0200
Subject: [PATCH 3/4] gnu: Add java-hamcrest-core.

* gnu/packages/java.scm (java-hamcrest-core): New variable.
---
 gnu/packages/java.scm | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 6013626..b73f239 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -907,3 +907,84 @@ libraries and embed them into your own distribution.  Jar Jar Links includes
 an Ant task that extends the built-in @code{jar} task.")
     (license license:asl2.0)))
 
+(define-public java-hamcrest-core
+  (package
+    (name "java-hamcrest-core")
+    (version "1.3")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://hamcrest.googlecode.com/files/"
+                                  "hamcrest-" version ".tgz"))
+              (sha256
+               (base32
+                "1hi0jv0zrgsf4l25aizxrgvxpsrmdklsmvw0jzwz7zv9s108whn6"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Delete bundled jar archives.
+                  (for-each delete-file (find-files "." "\\.jar$"))
+                  #t))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:tests? #f ; Tests require junit
+       #:make-flags (list (string-append "-Dversion=" ,version))
+       #:build-target "core"
+       #:phases
+       (modify-phases %standard-phases
+         ;; Disable unit tests, because they require junit, which requires
+         ;; hamcrest-core.  We also give a fixed value to the "Built-Date"
+         ;; attribute from the manifest for reproducibility.
+         (add-before 'configure 'patch-build.xml
+           (lambda _
+             (substitute* "build.xml"
+               (("unit-test, ") "")
+               (("\\$\\{build.timestamp\\}") "guix"))
+             #t))
+         ;; Java's "getMethods()" returns methods in an unpredictable order.
+         ;; To make the output of the generated code deterministic we must
+         ;; sort the array of methods.
+         (add-after 'unpack 'make-method-order-deterministic
+           (lambda _
+             (substitute* "hamcrest-generator/src/main/java/org/hamcrest/generator/ReflectiveFactoryReader.java"
+               (("import java\\.util\\.Iterator;" line)
+                (string-append line "\n"
+                               "import java.util.Arrays; import java.util.Comparator;"))
+               (("allMethods = cls\\.getMethods\\(\\);" line)
+                (string-append "_" line
+                               "
+private Method[] getSortedMethods() {
+  Arrays.sort(_allMethods, new Comparator<Method>() {
+    @Override
+    public int compare(Method a, Method b) {
+      return a.toString().compareTo(b.toString());
+    }
+  });
+  return _allMethods;
+}
+
+private Method[] allMethods = getSortedMethods();")))))
+         (add-before 'build 'do-not-use-bundled-qdox
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "build.xml"
+               (("lib/generator/qdox-1.12.jar")
+                (string-append (assoc-ref inputs "java-qdox-1.12")
+                               "/share/java/qdox.jar")))
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (install-file (string-append "build/hamcrest-core-"
+                                          ,version ".jar")
+                           (string-append (assoc-ref outputs "out")
+                                          "/share/java")))))))
+    (native-inputs
+     `(("java-qdox-1.12" ,java-qdox-1.12)
+       ("java-jarjar" ,java-jarjar)))
+    (home-page "http://hamcrest.org/")
+    (synopsis "Library of matchers for building test expressions")
+    (description
+     "This package provides a library of matcher objects (also known as
+constraints or predicates) allowing @code{match} rules to be defined
+declaratively, to be used in other frameworks.  Typical scenarios include
+testing frameworks, mocking libraries and UI validation rules.")
+    (license license:bsd-2)))
+
-- 
2.7.3


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-gnu-Add-java-junit.patch --]
[-- Type: text/x-patch, Size: 1936 bytes --]

From 119b0fd10aa47385c0fa9de99c901a204cb12d93 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Fri, 22 Apr 2016 16:09:17 +0200
Subject: [PATCH 4/4] gnu: Add java-junit.

* gnu/packages/java.scm (java-junit): New variable.
---
 gnu/packages/java.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index b73f239..62d1d3f 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -988,3 +988,35 @@ declaratively, to be used in other frameworks.  Typical scenarios include
 testing frameworks, mocking libraries and UI validation rules.")
     (license license:bsd-2)))
 
+(define-public java-junit
+  (package
+    (name "java-junit")
+    (version "4.12")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/junit-team/junit/"
+                                  "archive/r" version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "090dn5v1vs0b3acyaqc0gjf6p8lmd2h24wfzsbq7sly6b214anws"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Delete bundled jar archives.
+                  (delete-file-recursively "lib")
+                  #t))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:tests? #f ; no tests
+       #:jar-name "junit.jar"))
+    (inputs
+     `(("java-hamcrest-core" ,java-hamcrest-core)))
+    (home-page "http://junit.org/")
+    (synopsis "Test framework for Java")
+    (description
+     "JUnit is a simple framework to write repeatable tests for Java projects.
+JUnit provides assertions for testing expected results, test fixtures for
+sharing common test data, and test runners for running tests.")
+    (license license:epl1.0)))
+
-- 
2.7.3


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

* Re: [PATCH] Add junit.
  2016-04-22 14:16 [PATCH] Add junit Ricardo Wurmus
@ 2016-04-22 14:59 ` Eric Bavier
  2016-04-22 21:03   ` Ricardo Wurmus
  2016-04-29 15:16 ` HTTP server invalid date header Ludovic Courtès
  1 sibling, 1 reply; 8+ messages in thread
From: Eric Bavier @ 2016-04-22 14:59 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel, Guix-devel

On 2016-04-22 09:16, Ricardo Wurmus wrote:
> Hi Guix,
> 
> here’s a first batch of patches for Java libraries.  Many Java packages
> depend on JUnit, so that’s where I started.  “hamcrest-core” is just a
> small part of the whole hamcrest library, but it’s enough to build
> JUnit.
[...]
> +         (add-before 'configure 'patch-build.xml
> +           (lambda _
> +             (substitute* "build.xml"
> +               (("unit-test, ") "")
> +               (("\\$\\{build.timestamp\\}") "guix"))

Is using "guix" here as a timestamp safe?  Will nothing read the 
manifest and expect an actualy timestamp?  (I've become unfamiliar with 
most of java-land lately).

> +         ;; Java's "getMethods()" returns methods in an unpredictable 
> order.
> +         ;; To make the output of the generated code deterministic we 
> must
> +         ;; sort the array of methods.
> +         (add-after 'unpack 'make-method-order-deterministic

Should we patch our java package instead?  Perhaps that can be saved as 
a future exercise.

> +              (snippet
> +               '(begin
> +                  ;; Delete bundled jar archives.
> +                  (delete-file-recursively "lib")
> +                  #t))))

Is this very common in java packages?

Otherwise LGTM.

-- 
`~Eric

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

* Re: [PATCH] Add junit.
  2016-04-22 14:59 ` Eric Bavier
@ 2016-04-22 21:03   ` Ricardo Wurmus
  0 siblings, 0 replies; 8+ messages in thread
From: Ricardo Wurmus @ 2016-04-22 21:03 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel


Eric Bavier <ericbavier@openmailbox.org> writes:

> On 2016-04-22 09:16, Ricardo Wurmus wrote:
>> Hi Guix,
>> 
>> here’s a first batch of patches for Java libraries.  Many Java packages
>> depend on JUnit, so that’s where I started.  “hamcrest-core” is just a
>> small part of the whole hamcrest library, but it’s enough to build
>> JUnit.
> [...]
>> +         (add-before 'configure 'patch-build.xml
>> +           (lambda _
>> +             (substitute* "build.xml"
>> +               (("unit-test, ") "")
>> +               (("\\$\\{build.timestamp\\}") "guix"))
>
> Is using "guix" here as a timestamp safe?  Will nothing read the 
> manifest and expect an actualy timestamp?  (I've become unfamiliar with 
> most of java-land lately).

hamcrest-core is the only package I’ve encountered so far that adds a
timestamp to the manifest.  Anything can be put inside manifests, so I
don’t think it matters much.  We could replace the timestamp with the
commit date of the package expression, just so that we have an actual
date (and one that isn’t 30+ years in the past).

>> +         ;; Java's "getMethods()" returns methods in an unpredictable 
>> order.
>> +         ;; To make the output of the generated code deterministic we 
>> must
>> +         ;; sort the array of methods.
>> +         (add-after 'unpack 'make-method-order-deterministic
>
> Should we patch our java package instead?  Perhaps that can be saved as 
> a future exercise.

The official documentation states that the order of methods returned is
undefined.  I wouldn’t like to force sorting on all users of the
reflection API.  In this case it’s important as the method names are
written to a file in whatever order they are returned.  In general the
order is of no importance.

>> +              (snippet
>> +               '(begin
>> +                  ;; Delete bundled jar archives.
>> +                  (delete-file-recursively "lib")
>> +                  #t))))
>
> Is this very common in java packages?

I’d say it’s somewhat more common than in packages written in other
languages, but I wouldn’t yet feel comfortable doing this by default for
all Java packages.

> Otherwise LGTM.

Thanks for the review!

~~ Ricardo

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

* HTTP server invalid date header
  2016-04-22 14:16 [PATCH] Add junit Ricardo Wurmus
  2016-04-22 14:59 ` Eric Bavier
@ 2016-04-29 15:16 ` Ludovic Courtès
  2016-04-29 20:15   ` Ricardo Wurmus
  1 sibling, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2016-04-29 15:16 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel@gnu.org

Hi!

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> I tested JUnit previously with the log4j-api package, but I cannot
> submit this right now due to a bug(?) in Guile’s HTTP client, which
> makes it impossible for me to download the sources of its dependencies,
> such as this one:
>
>     http://central.maven.org/maven2/org/osgi/org.osgi.core/6.0.0/org.osgi.core-6.0.0-sources.jar
>     ERROR: Bad Date header: Wed, 30 Jul 2014  3:47:42 GMT

ISTR you were working on a workaround for this issue.  What’s the
status?

Once this is done, and since you did not get feedback, I would suggest
committing these packages.

Thanks,
Ludo’.

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

* Re: HTTP server invalid date header
  2016-04-29 15:16 ` HTTP server invalid date header Ludovic Courtès
@ 2016-04-29 20:15   ` Ricardo Wurmus
  2016-05-01 13:07     ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Ricardo Wurmus @ 2016-04-29 20:15 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel@gnu.org

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


Ludovic Courtès <ludo@gnu.org> writes:

> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:
>
>> I tested JUnit previously with the log4j-api package, but I cannot
>> submit this right now due to a bug(?) in Guile’s HTTP client, which
>> makes it impossible for me to download the sources of its dependencies,
>> such as this one:
>>
>>     http://central.maven.org/maven2/org/osgi/org.osgi.core/6.0.0/org.osgi.core-6.0.0-sources.jar
>>     ERROR: Bad Date header: Wed, 30 Jul 2014  3:47:42 GMT
>
> ISTR you were working on a workaround for this issue.  What’s the
> status?

I got it fixed (after wasting a lot of time wondering why it would not
work as I had patched the wrong file), but the fix isn’t really pretty.
It’s attached.

> Once this is done, and since you did not get feedback, I would suggest
> committing these packages.

Okay!

~~ Ricardo



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-build-Accept-dates-with-space-padded-hour-field.patch --]
[-- Type: text/x-patch, Size: 4895 bytes --]

From c98ca436bafe8077edaf3125b529ea32fbd48611 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Fri, 29 Apr 2016 22:12:24 +0200
Subject: [PATCH] build: Accept dates with space-padded hour field.

* guix/build/download.scm: Replace "parse-rfc-822-date" from the (web
  http) module.
---
 guix/build/download.scm | 73 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/guix/build/download.scm b/guix/build/download.scm
index fec4cec..3b2901b 100644
--- a/guix/build/download.scm
+++ b/guix/build/download.scm
@@ -426,6 +426,79 @@ port if PORT is a TLS session record port."
 (module-define! (resolve-module '(web client))
                 'shutdown (const #f))
 
+
+;; XXX: Guile's date validation procedure rejects dates in which the hour is
+;; not padded with a zero but with whitespace.
+(begin
+  (define-syntax string-match?
+    (lambda (x)
+      (syntax-case x ()
+        ((_ str pat) (string? (syntax->datum #'pat))
+         (let ((p (syntax->datum #'pat)))
+           #`(let ((s str))
+               (and
+                (= (string-length s) #,(string-length p))
+                #,@(let lp ((i 0) (tests '()))
+                     (if (< i (string-length p))
+                         (let ((c (string-ref p i)))
+                           (lp (1+ i)
+                               (case c
+                                 ((#\.)  ; Whatever.
+                                  tests)
+                                 ((#\d)  ; Digit.
+                                  (cons #`(char-numeric? (string-ref s #,i))
+                                        tests))
+                                 ((#\a)  ; Alphabetic.
+                                  (cons #`(char-alphabetic? (string-ref s #,i))
+                                        tests))
+                                 (else   ; Literal.
+                                  (cons #`(eqv? (string-ref s #,i) #,c)
+                                        tests)))))
+                         tests)))))))))
+
+  (define (parse-rfc-822-date str space zone-offset)
+    (let ((parse-non-negative-integer (@@ (web http) parse-non-negative-integer))
+          (parse-month (@@ (web http) parse-month))
+          (bad-header (@@ (web http) bad-header)))
+      ;; We could verify the day of the week but we don't.
+      (cond ((string-match? (substring str 0 space) "aaa, dd aaa dddd dd:dd:dd")
+             (let ((date (parse-non-negative-integer str 5 7))
+                   (month (parse-month str 8 11))
+                   (year (parse-non-negative-integer str 12 16))
+                   (hour (parse-non-negative-integer str 17 19))
+                   (minute (parse-non-negative-integer str 20 22))
+                   (second (parse-non-negative-integer str 23 25)))
+               (make-date 0 second minute hour date month year zone-offset)))
+            ((string-match? (substring str 0 space) "aaa, d aaa dddd dd:dd:dd")
+             (let ((date (parse-non-negative-integer str 5 6))
+                   (month (parse-month str 7 10))
+                   (year (parse-non-negative-integer str 11 15))
+                   (hour (parse-non-negative-integer str 16 18))
+                   (minute (parse-non-negative-integer str 19 21))
+                   (second (parse-non-negative-integer str 22 24)))
+               (make-date 0 second minute hour date month year zone-offset)))
+            ((string-match? (substring str 0 space) "aaa, dd aaa dddd  d:dd:dd")
+             (let ((date (parse-non-negative-integer str 5 7))
+                   (month (parse-month str 8 11))
+                   (year (parse-non-negative-integer str 12 16))
+                   (hour (parse-non-negative-integer str 18 19))
+                   (minute (parse-non-negative-integer str 20 22))
+                   (second (parse-non-negative-integer str 23 25)))
+               (make-date 0 second minute hour date month year zone-offset)))
+            ((string-match? (substring str 0 space) "aaa, d aaa dddd  d:dd:dd")
+             (let ((date (parse-non-negative-integer str 5 6))
+                   (month (parse-month str 7 10))
+                   (year (parse-non-negative-integer str 11 15))
+                   (hour (parse-non-negative-integer str 17 18))
+                   (minute (parse-non-negative-integer str 19 21))
+                   (second (parse-non-negative-integer str 22 24)))
+               (make-date 0 second minute hour date month year zone-offset)))
+            (else
+             (bad-header 'date str)        ; prevent tail call
+             #f))))
+  (module-set! (resolve-module '(web http))
+               'parse-rfc-822-date parse-rfc-822-date))
+
 ;; XXX: Work around <http://bugs.gnu.org/19840>, present in Guile
 ;; up to 2.0.11.
 (unless (or (> (string->number (major-version)) 2)
-- 
2.7.3


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

* Re: HTTP server invalid date header
  2016-04-29 20:15   ` Ricardo Wurmus
@ 2016-05-01 13:07     ` Ludovic Courtès
  2016-05-02 15:27       ` Ricardo Wurmus
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2016-05-01 13:07 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel@gnu.org

Ricardo Wurmus <rekado@elephly.net> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:
>>
>>> I tested JUnit previously with the log4j-api package, but I cannot
>>> submit this right now due to a bug(?) in Guile’s HTTP client, which
>>> makes it impossible for me to download the sources of its dependencies,
>>> such as this one:
>>>
>>>     http://central.maven.org/maven2/org/osgi/org.osgi.core/6.0.0/org.osgi.core-6.0.0-sources.jar
>>>     ERROR: Bad Date header: Wed, 30 Jul 2014  3:47:42 GMT
>>
>> ISTR you were working on a workaround for this issue.  What’s the
>> status?
>
> I got it fixed (after wasting a lot of time wondering why it would not
> work as I had patched the wrong file), but the fix isn’t really pretty.

[...]

> From c98ca436bafe8077edaf3125b529ea32fbd48611 Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <rekado@elephly.net>
> Date: Fri, 29 Apr 2016 22:12:24 +0200
> Subject: [PATCH] build: Accept dates with space-padded hour field.
>
> * guix/build/download.scm: Replace "parse-rfc-822-date" from the (web
>   http) module.

I don’t think it’s worse than the original.  ;-)

To help maintenance, could you make sure there’s a Guile bug number for
this one?  And then you can submit this change to Guile itself, and
after that backport it to Guix (with a reference to the Guile bug and
commit.)

Would that work for you?

Sorry for the extra burden!

Thanks,
Ludo’.

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

* Re: HTTP server invalid date header
  2016-05-01 13:07     ` Ludovic Courtès
@ 2016-05-02 15:27       ` Ricardo Wurmus
  2016-05-08 20:10         ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Ricardo Wurmus @ 2016-05-02 15:27 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel@gnu.org


Ludovic Courtès <ludo@gnu.org> writes:

> Ricardo Wurmus <rekado@elephly.net> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:
>>>
>>>> I tested JUnit previously with the log4j-api package, but I cannot
>>>> submit this right now due to a bug(?) in Guile’s HTTP client, which
>>>> makes it impossible for me to download the sources of its dependencies,
>>>> such as this one:
>>>>
>>>>     http://central.maven.org/maven2/org/osgi/org.osgi.core/6.0.0/org.osgi.core-6.0.0-sources.jar
>>>>     ERROR: Bad Date header: Wed, 30 Jul 2014  3:47:42 GMT
>>>
>>> ISTR you were working on a workaround for this issue.  What’s the
>>> status?
>>
>> I got it fixed (after wasting a lot of time wondering why it would not
>> work as I had patched the wrong file), but the fix isn’t really pretty.
>
> [...]
>
>> From c98ca436bafe8077edaf3125b529ea32fbd48611 Mon Sep 17 00:00:00 2001
>> From: Ricardo Wurmus <rekado@elephly.net>
>> Date: Fri, 29 Apr 2016 22:12:24 +0200
>> Subject: [PATCH] build: Accept dates with space-padded hour field.
>>
>> * guix/build/download.scm: Replace "parse-rfc-822-date" from the (web
>>   http) module.
>
> I don’t think it’s worse than the original.  ;-)
>
> To help maintenance, could you make sure there’s a Guile bug number for
> this one?  And then you can submit this change to Guile itself, and
> after that backport it to Guix (with a reference to the Guile bug and
> commit.)
>
> Would that work for you?

Sure, no problem.  The bug I submitted to bug-guile received number
23421.  I already submitted my patch to guile-devel, but it seems to be
stuck in the queue for now.  Once it has been committed I’ll backport
the change to Guix.

~~ Ricardo

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

* Re: HTTP server invalid date header
  2016-05-02 15:27       ` Ricardo Wurmus
@ 2016-05-08 20:10         ` Ludovic Courtès
  0 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2016-05-08 20:10 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel@gnu.org

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Ricardo Wurmus <rekado@elephly.net> skribis:
>>
>>> Ludovic Courtès <ludo@gnu.org> writes:
>>>
>>>> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:
>>>>
>>>>> I tested JUnit previously with the log4j-api package, but I cannot
>>>>> submit this right now due to a bug(?) in Guile’s HTTP client, which
>>>>> makes it impossible for me to download the sources of its dependencies,
>>>>> such as this one:
>>>>>
>>>>>     http://central.maven.org/maven2/org/osgi/org.osgi.core/6.0.0/org.osgi.core-6.0.0-sources.jar
>>>>>     ERROR: Bad Date header: Wed, 30 Jul 2014  3:47:42 GMT
>>>>
>>>> ISTR you were working on a workaround for this issue.  What’s the
>>>> status?
>>>
>>> I got it fixed (after wasting a lot of time wondering why it would not
>>> work as I had patched the wrong file), but the fix isn’t really pretty.
>>
>> [...]
>>
>>> From c98ca436bafe8077edaf3125b529ea32fbd48611 Mon Sep 17 00:00:00 2001
>>> From: Ricardo Wurmus <rekado@elephly.net>
>>> Date: Fri, 29 Apr 2016 22:12:24 +0200
>>> Subject: [PATCH] build: Accept dates with space-padded hour field.
>>>
>>> * guix/build/download.scm: Replace "parse-rfc-822-date" from the (web
>>>   http) module.
>>
>> I don’t think it’s worse than the original.  ;-)
>>
>> To help maintenance, could you make sure there’s a Guile bug number for
>> this one?  And then you can submit this change to Guile itself, and
>> after that backport it to Guix (with a reference to the Guile bug and
>> commit.)
>>
>> Would that work for you?
>
> Sure, no problem.  The bug I submitted to bug-guile received number
> 23421.  I already submitted my patch to guile-devel, but it seems to be
> stuck in the queue for now.  Once it has been committed I’ll backport
> the change to Guix.

Fixed in Guile commit 16050431f29d56f80c4a8253506fc851b8441840 (not a
great fix due to limitations in the ‘string-match?’ macro there.)

The backport will probably require a copy of both ‘string-match?’ and
‘parse-rfc-822-date’.

Thanks,
Ludo’.

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

end of thread, other threads:[~2016-05-08 20:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-22 14:16 [PATCH] Add junit Ricardo Wurmus
2016-04-22 14:59 ` Eric Bavier
2016-04-22 21:03   ` Ricardo Wurmus
2016-04-29 15:16 ` HTTP server invalid date header Ludovic Courtès
2016-04-29 20:15   ` Ricardo Wurmus
2016-05-01 13:07     ` Ludovic Courtès
2016-05-02 15:27       ` Ricardo Wurmus
2016-05-08 20:10         ` 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).