Subject: Re: bug#33041: [PATCH] gnu: icedtea-6: Make javadoc reproducible.

From: Maxim Cournoyer <[email-masked]>
Date: Wed, 14 Jul 2021 09:34:40 -0400

Hi,

Kei Kebreau <[email-masked]> writes:

> Hi all,
>
> I came across this bug and had some time to attempt to make the
> suggested changes.  Please find the updated patch attached and let me
> know if it still works as intended.

[...]

> diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
> index e298fd9537..deaa9e1fcd 100644
> --- a/gnu/packages/java.scm
> +++ b/gnu/packages/java.scm
> @@ -892,7 +892,10 @@ machine.")))
>                                         (string-append part "-src"))
>                              part))
>                           '("jdk" "hotspot" "corba"
> -                           "langtools" "jaxp" "jaxws")))
> +                           "jaxp" "jaxws")))
> +             (with-directory-excursion "openjdk"
> +               (invoke "tar" "xvf" (assoc-ref inputs "langtools-src"))
> +               (rename-file "hg-checkout" "langtools"))
>               (substitute* "patches/freetypeversion.patch"
>                 (("REQUIRED_FREETYPE_VERSION = 2.2.1")
>                  "REQUIRED_FREETYPE_VERSION = 2.10.1"))
> @@ -1136,7 +1139,9 @@ machine.")))
>                   (changeset "jdk6-b41")))
>             (sha256
>              (base32
> -             "1x52wd67fynbbd9ild6fb4wvba3f5hhwk03qdjfazd0a1qr37z3d"))))
> +             "1x52wd67fynbbd9ild6fb4wvba3f5hhwk03qdjfazd0a1qr37z3d"))
> +           (patches
> +            (search-patches "icedtea-6-javadoc-reproducibility.patch"))))
>         ("jaxp-src"
>          ,(origin
>             (method hg-fetch)
> diff --git a/gnu/packages/patches/icedtea-6-javadoc-reproducibility.patch b/gnu/packages/patches/icedtea-6-javadoc-reproducibility.patch
> new file mode 100644
> index 0000000000..dd472a9c66
> --- /dev/null
> +++ b/gnu/packages/patches/icedtea-6-javadoc-reproducibility.patch
> @@ -0,0 +1,25 @@
> +# HG changeset patch
> +# User Gábor Boskovits <[email-masked]>
> +# Date 1539456874 -7200
> +#      Sat Oct 13 20:54:34 2018 +0200
> +# Node ID 6e5f716a659247888c104f66c58bf40fb959c8a4
> +# Parent  06656286f572cbf716397b9d983f8dee7d94f913
> +Make javadoc respect SOURCE_DATE_EPOCH.
> +
> +diff -r 06656286f572 src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
> +--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java	Mon Aug 22 10:53:55 2016 -0700
> ++++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java	Wed Dec 09 21:40:00 2020 -0500
> +@@ -396,6 +396,12 @@
> +      */
> +     public String today() {
> +         Calendar calendar = new GregorianCalendar(TimeZone.getDefault());
> +-        return calendar.getTime().toString();
> ++        Date date=calendar.getTime();
> ++        String epoch=System.getenv("SOURCE_DATE_EPOCH");
> ++        if(epoch != null) {
> ++            long unixtime=Long.parseLong(epoch);
> ++            date=new Date(unixtime*1000L);
> ++	}
> ++	return date.toString();
> +     }
> + }

I tried this patch but it didn't work for me:

--8<---------------cut here---------------start------------->8---
diff -r /gnu/store/394r3dq5q2kmxddwcbh4wwnxmlp0b2rs-icedtea-1.13.13-doc/share/doc/icedtea/api/org/omg/PortableServer/POAPackage/WrongPolicyHelper.html /gnu/store/394r3dq5q2kmxddwcbh4wwnxmlp0b2rs-icedtea-1.13.13-doc-check/share/doc/icedtea/api/org/omg/PortableServer/POAPackage/WrongPolicyHelper.html
116c116
<  Wednesday, July 14, 2021 12:30:23 AM GMT</div>
---
>  Wednesday, July 14, 2021 12:14:11 AM GMT</div>
diff -r /gnu/store/394r3dq5q2kmxddwcbh4wwnxmlp0b2rs-icedtea-1.13.13-doc/share/doc/icedtea/api/org/omg/PortableServer/POAPackage/WrongPolicy.html /gnu/store/394r3dq5q2kmxddwcbh4wwnxmlp0b2rs-icedtea-1.13.13-doc-check/share/doc/icedtea/api/org/omg/PortableServer/POAPackage/WrongPolicy.html
129c129
<  Wednesday, July 14, 2021 12:30:23 AM GMT</div>
---
>  Wednesday, July 14, 2021 12:14:11 AM GMT</div>
diff -r /gnu/store/394r3dq5q2kmxddwcbh4wwnxmlp0b2rs-icedtea-1.13.13-doc/share/doc/icedtea/api/org/omg/PortableServer/REQUEST_PROCESSING_POLICY_ID.html /gnu/store/394r3dq5q2kmxddwcbh4wwnxmlp0b2rs-icedtea-1.13.13-doc-check/share/doc/icedtea/api/org/omg/PortableServer/REQUEST_PROCESSING_POLICY_ID.html
102c102
<  Wednesday, July 14, 2021 12:30:23 AM GMT</div>
---
>  Wednesday, July 14, 2021 12:14:11 AM GMT</div>
diff -r /gnu/store/394r3dq5q2kmxddwcbh4wwnxmlp0b2rs-icedtea-1.13.13-doc/share/doc/icedtea/api/org/omg/PortableServer/SERVANT_RETENTION_POLICY_ID.html /gnu/store/394r3dq5q2kmxddwcbh4wwnxmlp0b2rs-icedtea-1.13.13-doc-check/share/doc/icedtea/api/org/omg/PortableServer/SERVANT_RETENTION_POLICY_ID.html
102c102
<  Wednesday, July 14, 2021 12:30:23 AM GMT</div>
---
>  Wednesday, July 14, 2021 12:14:11 AM GMT</div>
diff -r /gnu/store/394r3dq5q2kmxddwcbh4wwnxmlp0b2rs-icedtea-1.13.13-doc/share/doc/icedtea/api/org/omg/PortableServer/THREAD_POLICY_ID.html /gnu/store/394r3dq5q2kmxddwcbh4wwnxmlp0b2rs-icedtea-1.13.13-doc-check/share/doc/icedtea/api/org/omg/PortableServer/THREAD_POLICY_ID.html
102c102
<  Wednesday, July 14, 2021 12:30:23 AM GMT</div>
---
>  Wednesday, July 14, 2021 12:14:11 AM GMT</div>
--8<---------------cut here---------------end--------------->8---

Could you retest it to validate it's working as expected?

Thank you,

Maxim