GNU bug report logs - #54021
[PATCH] Add rhino javascript package

Previous Next

Package: guix-patches;

Reported by: Frank Pursel <frank.pursel <at> gmail.com>

Date: Wed, 16 Feb 2022 02:00:02 UTC

Severity: normal

Tags: patch

Done: Julien Lepiller <julien <at> lepiller.eu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54021 in the body.
You can then email your comments to 54021 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Wed, 16 Feb 2022 02:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Frank Pursel <frank.pursel <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 16 Feb 2022 02:00:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Frank Pursel <frank.pursel <at> gmail.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] Add rhino javascript package
Date: Tue, 15 Feb 2022 17:58:53 -0800
Hi,

Rhino javascript has been around a long time.  It has also been built
upon by many others.  I needed to build this version for another package
and wanted to send it on as it might be useful.

Regards,
Frank


From c386b47786fc318cdfa0b1157a22590ebc279460 Mon Sep 17 00:00:00 2001
Message-Id: <c386b47786fc318cdfa0b1157a22590ebc279460.1644976508.git.frank.pursel <at> gmail.com>
From: Frank Pursel <frank.pursel <at> gmail.com>
Date: Tue, 15 Feb 2022 14:07:28 -0800
Subject: [PATCH] Adding rhino javascript guix package.

       * guix/gnu/package/javascript.scm (rhino): Added package.
---
 gnu/packages/javascript.scm | 65 +++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index c453ac432a..e9db0d2ce6 100644
--- a/gnu/packages/javascript.scm
+++ b/gnu/packages/javascript.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2018 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
 ;;; Copyright © 2021 Pierre Neidhardt <mail <at> ambrevar.xyz>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2022 Frank Pursel <frank.pursel <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,7 @@ (define-module (gnu packages javascript)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages uglifyjs)
   #:use-module (gnu packages web)
+  #:use-module (gnu packages java)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -38,6 +40,7 @@ (define-module (gnu packages javascript)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system trivial)
   #:use-module (guix build-system minify)
+  #:use-module (guix build-system ant)
   #:use-module (guix utils))
 
 (define-public cjson
@@ -788,3 +791,65 @@ (define-public duktape
 your build, and use the Duktape API to call ECMAScript functions from C code
 and vice versa.")
     (license license:expat)))
+
+(define-public rhino
+  (let* ((rel-ver "1.7.7.2") (rel-git-tag "Rhino1_7_7_2_Release")
+         (git-commitv "935942527ff434b205e797df4185518e5369466e")
+         (git-short-commit (substring git-commitv 0 6))
+         (hash "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8"))
+    (package
+      (name "rhino")
+      (version git-short-commit)
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/mozilla/rhino.git")
+                      (commit git-short-commit)))
+                (file-name (git-file-name name git-short-commit))
+                (sha256
+                 (base32
+                  hash))))
+      (build-system ant-build-system)
+      (inputs (list java-junit java-hamcrest-core
+                    `(,icedtea "jdk")))
+      (arguments
+       `(#:phases (modify-phases %standard-phases
+                    (add-after 'unpack 'clean-jars
+                      (lambda _
+                        (for-each (lambda (jarf)
+                                    (delete-file jarf)
+                                    (format #t "Deleted: ~s
+" jarf))
+                                  (find-files "." ".*\\.jar$")) #t))
+                    (replace 'check
+                      (lambda* (#:key tests? #:allow-other-keys)
+                        (if tests?
+                            (setenv "ANT_OPTS" "-Doffline=true")
+                            (invoke "ant" "junit")) #t))
+                    (replace 'install
+                      (lambda* (#:key inputs outputs #:allow-other-keys)
+                        (let* ((out (assoc-ref outputs "out"))
+                               (pkg+ver (string-append ,name ,rel-ver))
+                               (bin (string-append out "/bin"))
+                               (rhino (string-append bin "/rhino")))
+                          (mkdir-p bin)
+                          (install-file (string-append "build/" pkg+ver
+                                                       "/js.jar")
+                                        (string-append out "/share/java"))
+                          (with-output-to-file rhino
+                            (lambda _
+                              (format #t "#!~a
+~a -jar ~a $@
+"
+                                      (search-input-file inputs "/bin/bash")
+                                      (which "java")
+                                      (string-append out "/share/java/js.jar"))))
+                          (chmod rhino #o755) #t))))))
+      (home-page "https://mozilla.github.io/rhino")
+      (synopsis "Javascript implemented in java")
+      (description
+       "The Rhino engine, created primarily by Norris
+Boyd (also at Netscape) is a JavaScript implementation written in
+Java. Rhino is ECMA-262 Edition 5 compliant.")
+      (license license:mpl2.0))))
+
-- 
2.34.0





Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Wed, 16 Feb 2022 17:01:01 GMT) Full text and rfc822 format available.

Message #8 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Frank Pursel <frank.pursel <at> gmail.com>, 54021 <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] Add rhino javascript package
Date: Wed, 16 Feb 2022 18:00:20 +0100
[Message part 1 (text/plain, inline)]
Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
> +                        (if tests?
> +                            (setenv "ANT_OPTS" "-Doffline=true")
> +                            (invoke "ant" "junit")) #t))

This does 'setenv' when tests?, and runs "ant junit" when (not tests?),
which doesn't seem useful.

Did you mean

  (when tests?
    (setenv ...)
    (invoke ...))

instead?  Also, you can drop the trailing #t, while they used to be
necessary, they don't have a meaning anymore and are gradually removed
from existing packages.

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Wed, 16 Feb 2022 17:03:02 GMT) Full text and rfc822 format available.

Message #11 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Frank Pursel <frank.pursel <at> gmail.com>, 54021 <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] Add rhino javascript package
Date: Wed, 16 Feb 2022 18:02:38 +0100
[Message part 1 (text/plain, inline)]
Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
> +      (inputs (list java-junit java-hamcrest-core
> +                    `(,icedtea "jdk")))

'java-junit' is for testing and icedtea:jdk is for building Java source
code to Jaa bytecode, so these seem 'native-inputs' to me.  The
distinction between 'inputs' and 'native-inputs' is cross-compiling.

I'm not familiar enough with rhino and java-hamcrest-core to tell if
'java-hamcrest-core' would be an input or a native-input.

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Wed, 16 Feb 2022 17:09:01 GMT) Full text and rfc822 format available.

Message #14 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Frank Pursel <frank.pursel <at> gmail.com>, 54021 <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] Add rhino javascript package
Date: Wed, 16 Feb 2022 18:08:27 +0100
[Message part 1 (text/plain, inline)]
Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
> +      (synopsis "Javascript implemented in java")

AFAICT, the standard spelling of JavaScript is JavaScript,
and the spelling of Java is Java, not java.

> +      (description
> +       "The Rhino engine, created primarily by Norris
> +Boyd (also at Netscape)

The author information is not important for people searching for
packages (using "guix search" or the like) satisfying their criteria.

>  is a JavaScript implementation written in
> +Java. Rhino is ECMA-262 Edition 5 compliant.")

The last sentence almost implies that rhino has been certified for
compliance or something.  Instead, I would write something like

‘Rhino implements ECMAScript, also known as JavaScript, as specified
in  the fifth edition of ECMA-262.’

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Wed, 16 Feb 2022 17:10:02 GMT) Full text and rfc822 format available.

Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: guix-patches <at> gnu.org, Maxime Devos <maximedevos <at> telenet.be>,
 Frank Pursel <frank.pursel <at> gmail.com>, 54021 <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] Add rhino javascript package
Date: Wed, 16 Feb 2022 18:08:52 +0100
[Message part 1 (text/plain, inline)]
Hi!

Very cool work on rhino! It's a dependency I needed to work on kotlin's bootstrap :)

hamcrest-core is used by junit, so it should be a native-input too. Icedtea is useless here, because it's already an implicit input of the ant-build-system.

On February 16, 2022 6:02:38 PM GMT+01:00, Maxime Devos <maximedevos <at> telenet.be> wrote:
>Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
>> +      (inputs (list java-junit java-hamcrest-core
>> +                    `(,icedtea "jdk")))
>
>'java-junit' is for testing and icedtea:jdk is for building Java source
>code to Jaa bytecode, so these seem 'native-inputs' to me.  The
>distinction between 'inputs' and 'native-inputs' is cross-compiling.
>
>I'm not familiar enough with rhino and java-hamcrest-core to tell if
>'java-hamcrest-core' would be an input or a native-input.
>
>Greetings,
>Maxime.
[Message part 2 (text/html, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Wed, 16 Feb 2022 17:10:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Wed, 16 Feb 2022 17:10:03 GMT) Full text and rfc822 format available.

Message #23 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Frank Pursel <frank.pursel <at> gmail.com>, 54021 <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] Add rhino javascript package
Date: Wed, 16 Feb 2022 18:09:32 +0100
[Message part 1 (text/plain, inline)]
Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
> +                                      (which "java")

'which' looks in the native-inputs, which is incorrect here when cross-
compiling.   I suggest using '(search-input-file inputs "/bin/java")'
instead.

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Wed, 16 Feb 2022 17:22:01 GMT) Full text and rfc822 format available.

Message #26 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Frank Pursel <frank.pursel <at> gmail.com>, 54021 <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] Add rhino javascript package
Date: Wed, 16 Feb 2022 18:21:38 +0100
[Message part 1 (text/plain, inline)]
Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
> +(define-public rhino
> +  (let* ((rel-ver "1.7.7.2") (rel-git-tag "Rhino1_7_7_2_Release")
> +         (git-commitv "935942527ff434b205e797df4185518e5369466e")
> +         (git-short-commit (substring git-commitv 0 6))
> +         (hash "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8"))

This is quite a bit more complicated than necessary ...

 * 'rel-git-tag' is unused.
 * Conventionally, a let-bound commit string has as name 'commit', not
   'git-commitv'.  (guix upstream) expects 'commit', not 'git-commitv',
   and will fail at auto-updating if a different name is used.
 * (see later)

> +    (package
> +      (name "rhino")
> +      (version git-short-commit)

'git-short-commit' is a (shortened) commit string, not a version
number.  This needs to be (version "1.7.7.2") instead.

> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/mozilla/rhino.git")
> +                      (commit git-short-commit)))

There is no need to shorten the commit string, you can use the full
"git-commitv" here.

> +                (file-name (git-file-name name git-short-commit))

We have a version number, so you can do (git-file-name name version)
here.

> +                (sha256
> +                 (base32
> +                  hash))))

The hash is only used in one place, so you can write it here directly.
This has as benefit that (guix packages) can do some checks on the hash
at compile time.

[...]

> +      (arguments
> +       `(#:phases (modify-phases %standard-phases
> +                    (add-after 'unpack 'clean-jars
> +                      (lambda _
> +                        (for-each (lambda (jarf)
> +                                    (delete-file jarf)
> +                                    (format #t "Deleted: ~s
> +" jarf))
> +                                  (find-files "." ".*\\.jar$")) #t))

Cleaning the source code of binaries, making sure that the source code
actually consists of source code, seems more something for origin
snippets.  It's not really explicitly mentioned anywhere I think,
but the following from ‘(guix)Snipepts versus Phases’ seems close:

The boundary between using an origin snippet versus a build phase to
modify the sources of a package can be elusive.  Origin snippets are
typically used to remove unwanted files such as bundled libraries,
nonfree sources, or to apply simple substitutions.  [...]

> +                    (replace 'install
> +                      (lambda* (#:key inputs outputs #:allow-other-keys)
> +                        (let* ((out (assoc-ref outputs "out"))
> +                               (pkg+ver (string-append ,name ,rel-ver))

You can refer to the 'version' field of the package here:

  (pkg+ver (string-append ,name ,version))

> +                               (bin (string-append out "/bin"))
> +                               (rhino (string-append bin "/rhino")))
> +                          (mkdir-p bin)
> +                          (install-file (string-append "build/" pkg+ver
> +                                                       "/js.jar")
> +                                        (string-append out "/share/java"))
> +                          (with-output-to-file rhino
> +                            (lambda _
> +                              (format #t "#!~a
> +~a -jar ~a $@
> +"
> +                                      (search-input-file inputs "/bin/bash")

'bash-minimal' is missing from 'inputs'.  Not including it only works
when compiling natively.

> +                                      (which "java")
> +                                      (string-append out "/share/java/js.jar"))))


'format' has a port argument, so you could do

(call-with-output-file rhino
  (lambda (port)
    (format port "#!~a ~a -jar -a $@"
            (search-input-file [...]) [...])))

Also, what's this "$@"?

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Wed, 16 Feb 2022 18:37:01 GMT) Full text and rfc822 format available.

Message #29 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Frank Pursel <frank.pursel <at> gmail.com>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 54021 <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] Add rhino javascript package
Date: Wed, 16 Feb 2022 18:36:33 +0000
[Message part 1 (text/plain, inline)]
Thanks for the careful review.  The $@ was intended to allow the
introduction of additional command line arguments but since it starts a
repl and might be a source of nefariousness I've just removed it.  I did
not understand the bash-minimal comment.  Are you saying that
(search-input-file inputs "/bin/bash") will not work in the way I
intended?  I've changed all the inputs to native-inputs now.

I'll get back to you after I do some more testing.

Thank you for your helpful/thoughtful comments.

Regards,
Frank

On Wed, Feb 16, 2022 at 5:21 PM Maxime Devos <maximedevos <at> telenet.be> wrote:

> Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
> > +(define-public rhino
> > +  (let* ((rel-ver "1.7.7.2") (rel-git-tag "Rhino1_7_7_2_Release")
> > +         (git-commitv "935942527ff434b205e797df4185518e5369466e")
> > +         (git-short-commit (substring git-commitv 0 6))
> > +         (hash "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8"))
>
> This is quite a bit more complicated than necessary ...
>
>  * 'rel-git-tag' is unused.
>  * Conventionally, a let-bound commit string has as name 'commit', not
>    'git-commitv'.  (guix upstream) expects 'commit', not 'git-commitv',
>    and will fail at auto-updating if a different name is used.
>  * (see later)
>
> > +    (package
> > +      (name "rhino")
> > +      (version git-short-commit)
>
> 'git-short-commit' is a (shortened) commit string, not a version
> number.  This needs to be (version "1.7.7.2") instead.
>
> > +      (source (origin
> > +                (method git-fetch)
> > +                (uri (git-reference
> > +                      (url "https://github.com/mozilla/rhino.git")
> > +                      (commit git-short-commit)))
>
> There is no need to shorten the commit string, you can use the full
> "git-commitv" here.
>
> > +                (file-name (git-file-name name git-short-commit))
>
> We have a version number, so you can do (git-file-name name version)
> here.
>
> > +                (sha256
> > +                 (base32
> > +                  hash))))
>
> The hash is only used in one place, so you can write it here directly.
> This has as benefit that (guix packages) can do some checks on the hash
> at compile time.
>
> [...]
>
> > +      (arguments
> > +       `(#:phases (modify-phases %standard-phases
> > +                    (add-after 'unpack 'clean-jars
> > +                      (lambda _
> > +                        (for-each (lambda (jarf)
> > +                                    (delete-file jarf)
> > +                                    (format #t "Deleted: ~s
> > +" jarf))
> > +                                  (find-files "." ".*\\.jar$")) #t))
>
> Cleaning the source code of binaries, making sure that the source code
> actually consists of source code, seems more something for origin
> snippets.  It's not really explicitly mentioned anywhere I think,
> but the following from ‘(guix)Snipepts versus Phases’ seems close:
>
> The boundary between using an origin snippet versus a build phase to
> modify the sources of a package can be elusive.  Origin snippets are
> typically used to remove unwanted files such as bundled libraries,
> nonfree sources, or to apply simple substitutions.  [...]
>
> > +                    (replace 'install
> > +                      (lambda* (#:key inputs outputs #:allow-other-keys)
> > +                        (let* ((out (assoc-ref outputs "out"))
> > +                               (pkg+ver (string-append ,name ,rel-ver))
>
> You can refer to the 'version' field of the package here:
>
>   (pkg+ver (string-append ,name ,version))
>
> > +                               (bin (string-append out "/bin"))
> > +                               (rhino (string-append bin "/rhino")))
> > +                          (mkdir-p bin)
> > +                          (install-file (string-append "build/" pkg+ver
> > +                                                       "/js.jar")
> > +                                        (string-append out
> "/share/java"))
> > +                          (with-output-to-file rhino
> > +                            (lambda _
> > +                              (format #t "#!~a
> > +~a -jar ~a $@
> > +"
> > +                                      (search-input-file inputs
> "/bin/bash")
>
> 'bash-minimal' is missing from 'inputs'.  Not including it only works
> when compiling natively.
>
> > +                                      (which "java")
> > +                                      (string-append out
> "/share/java/js.jar"))))
>
>
> 'format' has a port argument, so you could do
>
> (call-with-output-file rhino
>   (lambda (port)
>     (format port "#!~a ~a -jar -a $@"
>             (search-input-file [...]) [...])))
>
> Also, what's this "$@"?
>
> Greetings,
> Maxime.
>
[Message part 2 (text/html, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Wed, 16 Feb 2022 18:44:01 GMT) Full text and rfc822 format available.

Message #32 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Frank Pursel <frank.pursel <at> gmail.com>
Cc: 54021 <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] Add rhino javascript package
Date: Wed, 16 Feb 2022 19:43:21 +0100
[Message part 1 (text/plain, inline)]
Frank Pursel schreef op wo 16-02-2022 om 18:36 [+0000]:
> I did not understand the bash-minimal comment.  Are you saying that
> (search-input-file inputs "/bin/bash") will not work in the way I
> intended

'bash-minimal' (*) is an implicit native-input of ant-build-system.
When compiling natively, inputs and native-inputs are merged together
into 'inputs'.  As such, bash-minimal (and hence "/bin/bash") is
contained in 'inputs' when compiling natively.  So if you compiled
natively (most likely), then using (search-input-file inputs
"/bin/bash") this succeeds.

However, if cross-compiling with "guix build --target=aarch64-linux-
gnu" or the like (**), then the native-inputs and inputs are kept
separate, so 'inputs' would not contain bash, (search-input-file ...)
would fail by raising a &search-error exception and the build would
therefore fail.

This can be resolved by adding the 'bash-minimal' package to 'inputs'.

(*) Actually a variant of 'bash-minimal' but that does not matter here.
(**) This won't work _yet_ because 'ant-build-system' does not support
cross-compilation yet.

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Thu, 17 Feb 2022 05:23:02 GMT) Full text and rfc822 format available.

Message #35 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Frank Pursel <frank.pursel <at> gmail.com>
To: 54021 <at> debbugs.gnu.org
Subject: [PATCH] Adding rhino package, revised patch
Date: Wed, 16 Feb 2022 21:22:39 -0800
Hi,

I've incorporated the feedback I've receive so far and worked to get the
check phase to complete successfully but this effort is complicated by
the default use of benchmarking and instrumentation.  I don't think this
additional instrumentation is appropriate to the check phase of this
package.  I can get testing to naively succeed using an alternate target
but because this version of the software has had longterm and widespread
experience I recommend that we simply be honest and set tests? to #f.
That is what I've done here.  Comments in the source describe choices I
made that you might decide are undesirable.

Let me know what you think.

Regards,
Frank

From 84848769a9c40e770d7a29edf200292a04bdcb2e Mon Sep 17 00:00:00 2001
Message-Id: <84848769a9c40e770d7a29edf200292a04bdcb2e.1645075292.git.frank.pursel <at> gmail.com>
From: Frank Pursel <frank.pursel <at> gmail.com>
Date: Tue, 15 Feb 2022 14:07:28 -0800
Subject: [PATCH] Adding rhino javascript guix package.

       * guix/gnu/package/javascript.scm (rhino): Added package.
---
 gnu/packages/javascript.scm | 105 +++++++++++++++++++++++++++++++++++-
 1 file changed, 104 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index c453ac432a..3068ce8197 100644
--- a/gnu/packages/javascript.scm
+++ b/gnu/packages/javascript.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2018 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
 ;;; Copyright © 2021 Pierre Neidhardt <mail <at> ambrevar.xyz>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2022 Frank Pursel <frank.pursel <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,9 @@ (define-module (gnu packages javascript)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages uglifyjs)
   #:use-module (gnu packages web)
+  #:use-module (gnu packages java)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages perl)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -38,7 +42,9 @@ (define-module (gnu packages javascript)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system trivial)
   #:use-module (guix build-system minify)
-  #:use-module (guix utils))
+  #:use-module (guix build-system ant)
+  #:use-module (guix utils)
+  #:use-module (guix gexp))
 
 (define-public cjson
   (package
@@ -788,3 +794,100 @@ (define-public duktape
 your build, and use the Duktape API to call ECMAScript functions from C code
 and vice versa.")
     (license license:expat)))
+
+(define-public rhino
+  (let* ((rel-ver "1.7.7.2")
+         (commit "935942527ff434b205e797df4185518e5369466e"))
+    (package
+      (name "rhino")
+      (version rel-ver)
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/mozilla/rhino.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32 "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8"))
+                (modules '((guix build utils)))
+                (snippet
+                 '(begin
+                    ;; Identify bundled jars to maintain build purity
+                    ;; remove bundled jars but those for testing
+                    ;; all appear to be for testing or unused build system
+                    ;;
+                    ;; source/rhino [env]$ find . -name '*.jar'
+                    ;; ./testsrc/org/mozilla/javascript/tests/commonjs/module/modules.jar
+                    ;; ./testsrc/tests/src/jstests.jar
+                    ;; ./gradle/wrapper/gradle-wrapper.jar
+                    (format #t "~%~a~%" "Sourced jars")
+                    (for-each
+                     (lambda (f) (format #t "~/~a~%" f))
+                     (find-files "." ".*\\.jar$"))
+                    #t))))
+      (build-system ant-build-system)
+      (inputs (list bash-minimal))
+      (native-inputs (list java-junit
+                           java-hamcrest-core
+                           java-snakeyaml     ;Required for tests.
+                           perl               ;Required for 'jsdriver' check target.
+                           ))
+      (arguments
+       `(#:tests? #f
+                 ;; tests? currently fail
+                 ;; the 'junit' target defaults to impure instrumentation and benchmarking.
+                 ;; there is another target 'jsdriver' of unknown scope which succeeds
+                 ;; As this pkg+ver has seen longstanding use, tests? are disabled.
+         #:phases (modify-phases %standard-phases
+                    (replace 'check
+                      (lambda* (#:key tests? inputs native-inputs #:allow-other-keys)
+                        (when tests?
+                          (setenv "ANT_OPTS" "-Doffline=true")
+                          (let ((junit-lib (assoc-ref inputs "java-junit"))
+                                (hamcrest-lib (assoc-ref inputs "java-hamcrest-core"))
+                                (snakeyaml-lib (assoc-ref inputs "java-snakeyaml")))
+                            (with-directory-excursion "testsrc"
+                              (substitute* "build.xml"
+                                (("<pathelement location=\"\\$\\{xbean.jar\\}\" */>" all)
+                                 (string-append "<!-- " all " -->"))
+                                (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
+                                 (string-append "<!-- " all " -->"))
+                                (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>" all)
+                                 (string-append "<!-- " all " -->"))
+                                (("<pathelement path=\"lib/emma.jar\"/>" all)
+                                 (string-append "<!-- " all " -->"))
+                                (("<pathelement path=\"lib/junit.jar\" ?/>")
+                                 (string-append "<fileset dir=\"" junit-lib
+                                                "\" includes=\"**/*.jar\"/>"))
+                                (("<pathelement path=\"lib/hamcrest.jar\" ?/>")
+                                 (string-append "<fileset dir=\"" hamcrest-lib
+                                                "\" includes=\"**/*.jar\"/>"))
+                                (("<pathelement path=\"lib/snakeyaml.jar\" ?/>")
+                                 (string-append "<fileset dir=\"" snakeyaml-lib
+                                                "\" includes=\"**/*.jar\"/>"))))
+                            ;; Check could alternatively invoke the jsdriver target here.
+                          (invoke "ant" "junit")))))
+                    (replace 'install
+                      (lambda* (#:key inputs outputs #:allow-other-keys)
+                        (let* ((out (assoc-ref outputs "out"))
+                               (pkg+ver (string-append ,name ,version))
+                               (bin (string-append out "/bin"))
+                               (rhino (string-append bin "/rhino")))
+                          (mkdir-p bin)
+                          (install-file (string-append "build/" pkg+ver
+                                                       "/js.jar")
+                                        (string-append out "/share/java"))
+                          (with-output-to-file rhino
+                            (lambda _
+                              (format #t "#!~a~%~a -jar ~a~%"
+                                      (search-input-file inputs "/bin/bash")
+                                      (search-input-file inputs "/bin/java")
+                                      (string-append out "/share/java/js.jar"))))
+                          (chmod rhino #o755)))))))
+      (home-page "https://mozilla.github.io/rhino")
+      (synopsis "Javascript implemented in Java")
+      (description
+       "Rhino implements ECMAScript, also known as JavaScript, in Java as
+specified in the fifth edition of ECMA-262")
+      (license license:mpl2.0))))
+
-- 
2.34.0







Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Fri, 18 Feb 2022 20:43:02 GMT) Full text and rfc822 format available.

Message #38 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Frank Pursel <frank.pursel <at> gmail.com>
To: 54021 <at> debbugs.gnu.org
Subject: [PATCH] if, at first, you don't succeed...
Date: Fri, 18 Feb 2022 12:42:16 -0800
Hi,

I think this addresses all the identified issues and, best of all, does it
with a now, meaningful check phase.

Regards,
Frank

From e45fd6a53579327667067ca0642e97d0cb373d5c Mon Sep 17 00:00:00 2001
Message-Id: <e45fd6a53579327667067ca0642e97d0cb373d5c.1645216890.git.frank.pursel <at> gmail.com>
From: Frank Pursel <frank.pursel <at> gmail.com>
Date: Tue, 15 Feb 2022 14:07:28 -0800
Subject: [PATCH] Adding rhino javascript guix package.

       * guix/gnu/package/javascript.scm (rhino): Added package.
---
 gnu/packages/javascript.scm | 106 +++++++++++++++++++++++++++++++++++-
 1 file changed, 105 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index c453ac432a..158abaded7 100644
--- a/gnu/packages/javascript.scm
+++ b/gnu/packages/javascript.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2018 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
 ;;; Copyright © 2021 Pierre Neidhardt <mail <at> ambrevar.xyz>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2022 Frank Pursel <frank.pursel <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,9 @@ (define-module (gnu packages javascript)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages uglifyjs)
   #:use-module (gnu packages web)
+  #:use-module (gnu packages java)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages perl)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -38,7 +42,9 @@ (define-module (gnu packages javascript)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system trivial)
   #:use-module (guix build-system minify)
-  #:use-module (guix utils))
+  #:use-module (guix build-system ant)
+  #:use-module (guix utils)
+  #:use-module (guix gexp))
 
 (define-public cjson
   (package
@@ -788,3 +794,101 @@ (define-public duktape
 your build, and use the Duktape API to call ECMAScript functions from C code
 and vice versa.")
     (license license:expat)))
+
+(define-public rhino
+  (let* ((rel-ver "1.7.7.2")
+         (commit "935942527ff434b205e797df4185518e5369466e"))
+    (package
+      (name "rhino")
+      (version rel-ver)
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/mozilla/rhino.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8"))
+                (modules '((guix build utils)))
+                (snippet '(begin
+                            ;; Remove benchmark testing
+                            (with-directory-excursion
+                                "testsrc"
+                              (delete-file-recursively "benchmarks"))
+                            (with-directory-excursion
+                             "testsrc/org/mozilla/javascript"
+                             (delete-file-recursively "benchmarks"))
+                            ;; Identify bundled jars
+                            (format #t "~%~a~%" "Sourced jars")
+                            (for-each (lambda (f)
+                                        (format #t "~/~a~%" f))
+                                      (find-files "." ".*\\.jar$"))))))
+      (build-system ant-build-system)
+      (inputs (list bash-minimal))
+      (native-inputs (list java-junit java-hamcrest-core java-snakeyaml))
+      (arguments
+       `(#:phases
+         (modify-phases
+             %standard-phases
+           (replace 'check
+             (lambda* (#:key tests? inputs native-inputs
+                       #:allow-other-keys)
+               (when tests?
+                 (setenv "ANT_OPTS" "-Doffline=true")
+                 (let ((junit-lib
+                        (assoc-ref inputs "java-junit"))
+                       (hamcrest-lib
+                        (assoc-ref inputs "java-hamcrest-core"))
+                       (snakeyaml-lib
+                        (assoc-ref inputs "java-snakeyaml")))
+                   (with-directory-excursion "testsrc"
+                     (substitute* "build.xml"
+                       (("<pathelement location=\"\\$\\{xbean.jar\\}\" */>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement path=\"lib/emma.jar\"/>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement path=\"lib/junit.jar\" ?/>")
+                        (string-append
+                         "<fileset dir=\"" junit-lib "\" includes=\"**/*.jar\"/>"))
+                       (("<pathelement path=\"lib/hamcrest.jar\" ?/>")
+                        (string-append "<fileset dir=\"" hamcrest-lib
+                                       "\" includes=\"**/*.jar\"/>"))
+                       (("<pathelement path=\"lib/snakeyaml.jar\" ?/>")
+                        (string-append "<fileset dir=\"" snakeyaml-lib
+                         "\" includes=\"**/*.jar\"/>"))
+                       ;; Disabling instrumentation.
+                       (("(<target name=\"junit\" depends=\"junit-compile),.*" all pre)
+                        (string-append pre "\">"))))
+                   (invoke "ant" "junit")))))
+           (replace 'install
+                      (lambda* (#:key inputs outputs #:allow-other-keys)
+                        (let* ((out (assoc-ref outputs "out"))
+                               (pkg+ver (string-append ,name ,version))
+                               (bin (string-append out "/bin"))
+                               (rhino (string-append bin "/rhino"))
+                               (man (string-append out "/share/man/man1")))
+                          (mkdir-p bin)
+                          (with-directory-excursion "man"
+                            (install-file "rhino.1" man))
+                          (install-file (string-append "build/" pkg+ver
+                                                       "/js.jar")
+                                        (string-append out "/share/java"))
+                          (with-output-to-file rhino
+                            (lambda _
+                              (format #t "#!~a~%~a -jar ~a $@~%"
+                                      (search-input-file inputs "/bin/bash")
+                                      (search-input-file inputs "/bin/java")
+                                      (string-append out "/share/java/js.jar"))))
+                          (chmod rhino #o755)))))))
+      (home-page "https://mozilla.github.io/rhino")
+      (synopsis "Javascript implemented in Java")
+      (description
+       "Rhino implements ECMAScript, also known as JavaScript, in Java as
+specified in the fifth edition of ECMA-262")
+      (license license:mpl2.0))))
+
-- 
2.34.0





Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Mon, 21 Feb 2022 13:20:02 GMT) Full text and rfc822 format available.

Message #41 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Frank Pursel <frank.pursel <at> gmail.com>
Cc: 54021 <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] if, at first, you don't succeed...
Date: Mon, 21 Feb 2022 15:19:00 +0200
[Message part 1 (text/plain, inline)]
On Fri, Feb 18, 2022 at 12:42:16PM -0800, Frank Pursel wrote:
> Hi,
> 
> I think this addresses all the identified issues and, best of all, does it
> with a now, meaningful check phase.

Very nice!

> Regards,
> Frank
> 
> From e45fd6a53579327667067ca0642e97d0cb373d5c Mon Sep 17 00:00:00 2001
> Message-Id: <e45fd6a53579327667067ca0642e97d0cb373d5c.1645216890.git.frank.pursel <at> gmail.com>
> From: Frank Pursel <frank.pursel <at> gmail.com>
> Date: Tue, 15 Feb 2022 14:07:28 -0800
> Subject: [PATCH] Adding rhino javascript guix package.
> 
>        * guix/gnu/package/javascript.scm (rhino): Added package.
> ---
>  gnu/packages/javascript.scm | 106 +++++++++++++++++++++++++++++++++++-
>  1 file changed, 105 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
> index c453ac432a..158abaded7 100644
> --- a/gnu/packages/javascript.scm
> +++ b/gnu/packages/javascript.scm
> @@ -6,6 +6,7 @@
>  ;;; Copyright © 2018 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
>  ;;; Copyright © 2021 Pierre Neidhardt <mail <at> ambrevar.xyz>
>  ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
> +;;; Copyright © 2022 Frank Pursel <frank.pursel <at> gmail.com>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -31,6 +32,9 @@ (define-module (gnu packages javascript)
>    #:use-module (gnu packages readline)
>    #:use-module (gnu packages uglifyjs)
>    #:use-module (gnu packages web)
> +  #:use-module (gnu packages java)
> +  #:use-module (gnu packages bash)
> +  #:use-module (gnu packages perl)

Please sort the (gnu packages ...) alphabetically :)

>    #:use-module (guix packages)
>    #:use-module (guix download)
>    #:use-module (guix git-download)
> @@ -38,7 +42,9 @@ (define-module (gnu packages javascript)
>    #:use-module (guix build-system cmake)
>    #:use-module (guix build-system trivial)
>    #:use-module (guix build-system minify)
> -  #:use-module (guix utils))
> +  #:use-module (guix build-system ant)
> +  #:use-module (guix utils)
> +  #:use-module (guix gexp))
>  
>  (define-public cjson
>    (package
> @@ -788,3 +794,101 @@ (define-public duktape
>  your build, and use the Duktape API to call ECMAScript functions from C code
>  and vice versa.")
>      (license license:expat)))
> +
> +(define-public rhino
> +  (let* ((rel-ver "1.7.7.2")
> +         (commit "935942527ff434b205e797df4185518e5369466e"))

rel-ver and commit can actually go in version and commit respectively,
they don't need to be separated out at the top.

> +    (package
> +      (name "rhino")
> +      (version rel-ver)
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/mozilla/rhino.git")
> +                      (commit commit)))
> +                (file-name (git-file-name name version))
> +                (sha256
> +                 (base32
> +                  "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8"))
> +                (modules '((guix build utils)))
> +                (snippet '(begin
> +                            ;; Remove benchmark testing
> +                            (with-directory-excursion
> +                                "testsrc"
> +                              (delete-file-recursively "benchmarks"))

This can be (delete-file-recursively "testsrc/benchmarks"). Similar with
the one below it.

> +                            (with-directory-excursion
> +                             "testsrc/org/mozilla/javascript"
> +                             (delete-file-recursively "benchmarks"))
> +                            ;; Identify bundled jars
> +                            (format #t "~%~a~%" "Sourced jars")
> +                            (for-each (lambda (f)
> +                                        (format #t "~/~a~%" f))
> +                                      (find-files "." ".*\\.jar$"))))))

This one is small, in find-files you don't need the leading '.*' before
\\.jar$

> +      (build-system ant-build-system)
> +      (inputs (list bash-minimal))
> +      (native-inputs (list java-junit java-hamcrest-core java-snakeyaml))
> +      (arguments
> +       `(#:phases
> +         (modify-phases
> +             %standard-phases
> +           (replace 'check
> +             (lambda* (#:key tests? inputs native-inputs
> +                       #:allow-other-keys)
> +               (when tests?
> +                 (setenv "ANT_OPTS" "-Doffline=true")
> +                 (let ((junit-lib
> +                        (assoc-ref inputs "java-junit"))
> +                       (hamcrest-lib
> +                        (assoc-ref inputs "java-hamcrest-core"))
> +                       (snakeyaml-lib
> +                        (assoc-ref inputs "java-snakeyaml")))
> +                   (with-directory-excursion "testsrc"
> +                     (substitute* "build.xml"
> +                       (("<pathelement location=\"\\$\\{xbean.jar\\}\" */>" all)
> +                        (string-append "<!-- " all " -->"))
> +                       (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
> +                        (string-append "<!-- " all " -->"))
> +                       (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>" all)
> +                        (string-append "<!-- " all " -->"))
> +                       (("<pathelement path=\"lib/emma.jar\"/>" all)
> +                        (string-append "<!-- " all " -->"))
> +                       (("<pathelement path=\"lib/junit.jar\" ?/>")
> +                        (string-append
> +                         "<fileset dir=\"" junit-lib "\" includes=\"**/*.jar\"/>"))
> +                       (("<pathelement path=\"lib/hamcrest.jar\" ?/>")
> +                        (string-append "<fileset dir=\"" hamcrest-lib
> +                                       "\" includes=\"**/*.jar\"/>"))
> +                       (("<pathelement path=\"lib/snakeyaml.jar\" ?/>")
> +                        (string-append "<fileset dir=\"" snakeyaml-lib
> +                         "\" includes=\"**/*.jar\"/>"))
> +                       ;; Disabling instrumentation.
> +                       (("(<target name=\"junit\" depends=\"junit-compile),.*" all pre)
> +                        (string-append pre "\">"))))
> +                   (invoke "ant" "junit")))))
> +           (replace 'install
> +                      (lambda* (#:key inputs outputs #:allow-other-keys)
> +                        (let* ((out (assoc-ref outputs "out"))
> +                               (pkg+ver (string-append ,name ,version))
> +                               (bin (string-append out "/bin"))
> +                               (rhino (string-append bin "/rhino"))
> +                               (man (string-append out "/share/man/man1")))
> +                          (mkdir-p bin)
> +                          (with-directory-excursion "man"
> +                            (install-file "rhino.1" man))

This one can just be (install-file "man/rhino.1" man)

> +                          (install-file (string-append "build/" pkg+ver
> +                                                       "/js.jar")
> +                                        (string-append out "/share/java"))
> +                          (with-output-to-file rhino
> +                            (lambda _
> +                              (format #t "#!~a~%~a -jar ~a $@~%"
> +                                      (search-input-file inputs "/bin/bash")
> +                                      (search-input-file inputs "/bin/java")
> +                                      (string-append out "/share/java/js.jar"))))
> +                          (chmod rhino #o755)))))))
> +      (home-page "https://mozilla.github.io/rhino")
> +      (synopsis "Javascript implemented in Java")
> +      (description
> +       "Rhino implements ECMAScript, also known as JavaScript, in Java as
> +specified in the fifth edition of ECMA-262")

Needs a period at the end of the description.

> +      (license license:mpl2.0))))
> +
> -- 
> 2.34.0
> 
> 
> 
> 

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Mon, 21 Feb 2022 15:55:01 GMT) Full text and rfc822 format available.

Message #44 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Frank Pursel <frank.pursel <at> gmail.com>
To: 54021 <at> debbugs.gnu.org
Subject: [PATCH] Better rhino
Date: Mon, 21 Feb 2022 07:54:18 -0800
Efraim,

Thank you for your comments.  I always wonder what is preferred here --
a clean single patch or the diff of changes.  Here I'm providing the
diff; if you would like me to create a single patch I'm happy to provide
it.

Regards,
Frank

From 135ea5541a9a5e4e009b9ee90eae36bec2b74dce Mon Sep 17 00:00:00 2001
Message-Id: <135ea5541a9a5e4e009b9ee90eae36bec2b74dce.1645458837.git.frank.pursel <at> gmail.com>
From: Frank Pursel <frank.pursel <at> gmail.com>
Date: Mon, 21 Feb 2022 07:48:07 -0800
Subject: [PATCH] Additional refinements.

---
 gnu/packages/javascript.scm | 44 ++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index 158abaded7..d8ebee3c3f 100644
--- a/gnu/packages/javascript.scm
+++ b/gnu/packages/javascript.scm
@@ -27,24 +27,22 @@ (define-module (gnu packages javascript)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages node)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages uglifyjs)
   #:use-module (gnu packages web)
-  #:use-module (gnu packages java)
-  #:use-module (gnu packages bash)
-  #:use-module (gnu packages perl)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
-  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system ant)
   #:use-module (guix build-system cmake)
-  #:use-module (guix build-system trivial)
+  #:use-module (guix build-system gnu)
   #:use-module (guix build-system minify)
-  #:use-module (guix build-system ant)
-  #:use-module (guix utils)
-  #:use-module (guix gexp))
+  #:use-module (guix build-system trivial)
+  #:use-module (guix utils))
 
 (define-public cjson
   (package
@@ -796,16 +794,14 @@ (define-public duktape
     (license license:expat)))
 
 (define-public rhino
-  (let* ((rel-ver "1.7.7.2")
-         (commit "935942527ff434b205e797df4185518e5369466e"))
     (package
       (name "rhino")
-      (version rel-ver)
+      (version "1.7.7.2")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
                       (url "https://github.com/mozilla/rhino.git")
-                      (commit commit)))
+                      (commit "935942527ff434b205e797df4185518e5369466e")))
                 (file-name (git-file-name name version))
                 (sha256
                  (base32
@@ -813,17 +809,14 @@ (define-public rhino
                 (modules '((guix build utils)))
                 (snippet '(begin
                             ;; Remove benchmark testing
-                            (with-directory-excursion
-                                "testsrc"
-                              (delete-file-recursively "benchmarks"))
-                            (with-directory-excursion
-                             "testsrc/org/mozilla/javascript"
-                             (delete-file-recursively "benchmarks"))
+                            (delete-file-recursively "testsrc/benchmarks")
+                            (delete-file-recursively
+                             "testsrc/org/mozilla/javascript/benchmarks")
                             ;; Identify bundled jars
                             (format #t "~%~a~%" "Sourced jars")
                             (for-each (lambda (f)
                                         (format #t "~/~a~%" f))
-                                      (find-files "." ".*\\.jar$"))))))
+                                      (find-files "." "\\.jar$"))))))
       (build-system ant-build-system)
       (inputs (list bash-minimal))
       (native-inputs (list java-junit java-hamcrest-core java-snakeyaml))
@@ -848,7 +841,8 @@ (define-public rhino
                         (string-append "<!-- " all " -->"))
                        (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
                         (string-append "<!-- " all " -->"))
-                       (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>" all)
+                       (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>"
+                         all)
                         (string-append "<!-- " all " -->"))
                        (("<pathelement path=\"lib/emma.jar\"/>" all)
                         (string-append "<!-- " all " -->"))
@@ -862,7 +856,8 @@ (define-public rhino
                         (string-append "<fileset dir=\"" snakeyaml-lib
                          "\" includes=\"**/*.jar\"/>"))
                        ;; Disabling instrumentation.
-                       (("(<target name=\"junit\" depends=\"junit-compile),.*" all pre)
+                       (("(<target name=\"junit\" depends=\"junit-compile),.*"
+                         all pre)
                         (string-append pre "\">"))))
                    (invoke "ant" "junit")))))
            (replace 'install
@@ -873,8 +868,7 @@ (define-public rhino
                                (rhino (string-append bin "/rhino"))
                                (man (string-append out "/share/man/man1")))
                           (mkdir-p bin)
-                          (with-directory-excursion "man"
-                            (install-file "rhino.1" man))
+                          (install-file "man/rhino.1" man)
                           (install-file (string-append "build/" pkg+ver
                                                        "/js.jar")
                                         (string-append out "/share/java"))
@@ -889,6 +883,6 @@ (define-public rhino
       (synopsis "Javascript implemented in Java")
       (description
        "Rhino implements ECMAScript, also known as JavaScript, in Java as
-specified in the fifth edition of ECMA-262")
-      (license license:mpl2.0))))
+specified in the fifth edition of ECMA-262.")
+      (license license:mpl2.0)))
 
-- 
2.34.0






Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Mon, 21 Feb 2022 16:29:02 GMT) Full text and rfc822 format available.

Message #47 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Frank Pursel <frank.pursel <at> gmail.com>, 54021 <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] Adding rhino package, revised patch
Date: Mon, 21 Feb 2022 17:28:31 +0100
[Message part 1 (text/plain, inline)]
Frank Pursel schreef op wo 16-02-2022 om 21:22 [-0800]:
> +                    ;; Identify bundled jars to maintain build purity
> +                    ;; remove bundled jars but those for testing

Jars for testing need to be removed too, they could influence the build
by modifying source files etc. when run.

Also, some licenses (e.g. GPL) require you to to publish the source
code whenever binaries are published.  I don't know if this is the
case for the bundled jars, rhino or dependents of rhino, but it's
simplest to just remove the binaries.

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Mon, 21 Feb 2022 18:47:01 GMT) Full text and rfc822 format available.

Message #50 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Frank Pursel <frank.pursel <at> gmail.com>
To: 54021 <at> debbugs.gnu.org
Subject: [PATCH] Removing all bundled jars prior to build.
Date: Mon, 21 Feb 2022 10:45:59 -0800
Maxime,

Bundled jars removed.

Regards,
Frank

From 7aaefc20bfdbe85dd65fff4ed3d0683cab994b98 Mon Sep 17 00:00:00 2001
Message-Id: <7aaefc20bfdbe85dd65fff4ed3d0683cab994b98.1645469136.git.frank.pursel <at> gmail.com>
From: Frank Pursel <frank.pursel <at> gmail.com>
Date: Mon, 21 Feb 2022 10:43:07 -0800
Subject: [PATCH] Removed all pre-bundled jars.

---
 gnu/packages/javascript.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index d8ebee3c3f..bdeeb03a58 100644
--- a/gnu/packages/javascript.scm
+++ b/gnu/packages/javascript.scm
@@ -815,7 +815,8 @@ (define-public rhino
                             ;; Identify bundled jars
                             (format #t "~%~a~%" "Sourced jars")
                             (for-each (lambda (f)
-                                        (format #t "~/~a~%" f))
+                                        (format #t "~/Deleting: ~a~%" f)
+                                        (delete-file f))
                                       (find-files "." "\\.jar$"))))))
       (build-system ant-build-system)
       (inputs (list bash-minimal))
-- 
2.34.0





Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Sat, 26 Feb 2022 21:08:02 GMT) Full text and rfc822 format available.

Message #53 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: Frank Pursel <frank.pursel <at> gmail.com>
Cc: 54021 <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] Removing all bundled jars prior to build.
Date: Sat, 26 Feb 2022 22:07:34 +0100
Hi Frank,

could you send the complete patch? This would be easier to then test
and apply/comment.

Thanks!

Le Mon, 21 Feb 2022 10:45:59 -0800,
Frank Pursel <frank.pursel <at> gmail.com> a écrit :

> Maxime,
> 
> Bundled jars removed.
> 
> Regards,
> Frank
> 
> From 7aaefc20bfdbe85dd65fff4ed3d0683cab994b98 Mon Sep 17 00:00:00 2001
> Message-Id:
> <7aaefc20bfdbe85dd65fff4ed3d0683cab994b98.1645469136.git.frank.pursel <at> gmail.com>
> From: Frank Pursel <frank.pursel <at> gmail.com> Date: Mon, 21 Feb 2022
> 10:43:07 -0800 Subject: [PATCH] Removed all pre-bundled jars.
> 
> ---
>  gnu/packages/javascript.scm | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
> index d8ebee3c3f..bdeeb03a58 100644
> --- a/gnu/packages/javascript.scm
> +++ b/gnu/packages/javascript.scm
> @@ -815,7 +815,8 @@ (define-public rhino
>                              ;; Identify bundled jars
>                              (format #t "~%~a~%" "Sourced jars")
>                              (for-each (lambda (f)
> -                                        (format #t "~/~a~%" f))
> +                                        (format #t "~/Deleting:
> ~a~%" f)
> +                                        (delete-file f))
>                                        (find-files "." "\\.jar$"))))))
>        (build-system ant-build-system)
>        (inputs (list bash-minimal))





Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Mon, 28 Feb 2022 19:39:01 GMT) Full text and rfc822 format available.

Message #56 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Frank Pursel <frank.pursel <at> gmail.com>
To: 54021 <at> debbugs.gnu.org
Subject: [PATCH] package for rhino
Date: Mon, 28 Feb 2022 11:38:39 -0800
Julien,

A single patch, to rule them all, as requested. :) This patch should add
the rhino package to the existing javascript.scm file.  I think all the
issues have been addressed.  Thank you for your patience.

Regards,
Frank

From a422095cf0ac8778936661952d375abd35293253 Mon Sep 17 00:00:00 2001
Message-Id: <a422095cf0ac8778936661952d375abd35293253.1646075744.git.frank.pursel <at> gmail.com>
From: Frank Pursel <frank.pursel <at> gmail.com>
Date: Tue, 15 Feb 2022 14:07:28 -0800
Subject: [PATCH] Adding rhino javascript guix package.

       * guix/gnu/package/javascript.scm (rhino): Added package.
---
 gnu/packages/javascript.scm | 103 +++++++++++++++++++++++++++++++++++-
 1 file changed, 101 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index 779ffcb7b8..68d338de8d 100644
--- a/gnu/packages/javascript.scm
+++ b/gnu/packages/javascript.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2018 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
 ;;; Copyright © 2021 Pierre Neidhardt <mail <at> ambrevar.xyz>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2022 Frank Pursel <frank.pursel <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,7 +27,9 @@ (define-module (gnu packages javascript)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages node)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages uglifyjs)
@@ -34,10 +37,11 @@ (define-module (gnu packages javascript)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
-  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system ant)
   #:use-module (guix build-system cmake)
-  #:use-module (guix build-system trivial)
+  #:use-module (guix build-system gnu)
   #:use-module (guix build-system minify)
+  #:use-module (guix build-system trivial)
   #:use-module (guix utils))
 
 (define-public cjson
@@ -791,3 +795,98 @@ (define-public duktape
 your build, and use the Duktape API to call ECMAScript functions from C code
 and vice versa.")
     (license license:expat)))
+
+(define-public rhino
+    (package
+      (name "rhino")
+      (version "1.7.7.2")
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/mozilla/rhino.git")
+                      (commit "935942527ff434b205e797df4185518e5369466e")))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8"))
+                (modules '((guix build utils)))
+                (snippet '(begin
+                            ;; Remove benchmark testing
+                            (delete-file-recursively "testsrc/benchmarks")
+                            (delete-file-recursively
+                             "testsrc/org/mozilla/javascript/benchmarks")
+                            ;; Identify bundled jars
+                            (format #t "~%~a~%" "Sourced jars")
+                            (for-each (lambda (f)
+                                        (format #t "~/Deleting: ~a~%" f)
+                                        (delete-file f))
+                                      (find-files "." "\\.jar$"))))))
+      (build-system ant-build-system)
+      (inputs (list bash-minimal))
+      (native-inputs (list java-junit java-hamcrest-core java-snakeyaml))
+      (arguments
+       `(#:phases
+         (modify-phases
+             %standard-phases
+           (replace 'check
+             (lambda* (#:key tests? inputs native-inputs
+                       #:allow-other-keys)
+               (when tests?
+                 (setenv "ANT_OPTS" "-Doffline=true")
+                 (let ((junit-lib
+                        (assoc-ref inputs "java-junit"))
+                       (hamcrest-lib
+                        (assoc-ref inputs "java-hamcrest-core"))
+                       (snakeyaml-lib
+                        (assoc-ref inputs "java-snakeyaml")))
+                   (with-directory-excursion "testsrc"
+                     (substitute* "build.xml"
+                       (("<pathelement location=\"\\$\\{xbean.jar\\}\" */>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>"
+                         all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement path=\"lib/emma.jar\"/>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement path=\"lib/junit.jar\" ?/>")
+                        (string-append
+                         "<fileset dir=\"" junit-lib "\" includes=\"**/*.jar\"/>"))
+                       (("<pathelement path=\"lib/hamcrest.jar\" ?/>")
+                        (string-append "<fileset dir=\"" hamcrest-lib
+                                       "\" includes=\"**/*.jar\"/>"))
+                       (("<pathelement path=\"lib/snakeyaml.jar\" ?/>")
+                        (string-append "<fileset dir=\"" snakeyaml-lib
+                         "\" includes=\"**/*.jar\"/>"))
+                       ;; Disabling instrumentation.
+                       (("(<target name=\"junit\" depends=\"junit-compile),.*"
+                         all pre)
+                        (string-append pre "\">"))))
+                   (invoke "ant" "junit")))))
+           (replace 'install
+                      (lambda* (#:key inputs outputs #:allow-other-keys)
+                        (let* ((out (assoc-ref outputs "out"))
+                               (pkg+ver (string-append ,name ,version))
+                               (bin (string-append out "/bin"))
+                               (rhino (string-append bin "/rhino"))
+                               (man (string-append out "/share/man/man1")))
+                          (mkdir-p bin)
+                          (install-file "man/rhino.1" man)
+                          (install-file (string-append "build/" pkg+ver
+                                                       "/js.jar")
+                                        (string-append out "/share/java"))
+                          (with-output-to-file rhino
+                            (lambda _
+                              (format #t "#!~a~%~a -jar ~a $@~%"
+                                      (search-input-file inputs "/bin/bash")
+                                      (search-input-file inputs "/bin/java")
+                                      (string-append out "/share/java/js.jar"))))
+                          (chmod rhino #o755)))))))
+      (home-page "https://mozilla.github.io/rhino")
+      (synopsis "Javascript implemented in Java")
+      (description
+       "Rhino implements ECMAScript, also known as JavaScript, in Java as
+specified in the fifth edition of ECMA-262.")
+      (license license:mpl2.0)))
+
-- 
2.34.0





Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Mon, 28 Feb 2022 20:46:01 GMT) Full text and rfc822 format available.

Message #59 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: Frank Pursel <frank.pursel <at> gmail.com>, 54021 <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] package for rhino
Date: Mon, 28 Feb 2022 21:45:16 +0100
[Message part 1 (text/plain, inline)]
Thanks!

I guess my only question remaining is why package this version instead of the latest, 1.7.15?

Also the commit message should be:

gnu: Add rhino.

* gnu/packages/javascript.scm (rhino): New variable

You didn't change the synopsis to spell JavaScript properly. Other than that, it's fine with me. We can take care of that, no need to resend a patch, unless Maxime has other comments :)

On February 28, 2022 8:38:39 PM GMT+01:00, Frank Pursel <frank.pursel <at> gmail.com> wrote:
>Julien,
>
>A single patch, to rule them all, as requested. :) This patch should add
>the rhino package to the existing javascript.scm file.  I think all the
>issues have been addressed.  Thank you for your patience.
>
>Regards,
>Frank
>
>From a422095cf0ac8778936661952d375abd35293253 Mon Sep 17 00:00:00 2001
>Message-Id: <a422095cf0ac8778936661952d375abd35293253.1646075744.git.frank.pursel <at> gmail.com>
>From: Frank Pursel <frank.pursel <at> gmail.com>
>Date: Tue, 15 Feb 2022 14:07:28 -0800
>Subject: [PATCH] Adding rhino javascript guix package.
>
>       * guix/gnu/package/javascript.scm (rhino): Added package.
>---
> gnu/packages/javascript.scm | 103 +++++++++++++++++++++++++++++++++++-
> 1 file changed, 101 insertions(+), 2 deletions(-)
>
>diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
>index 779ffcb7b8..68d338de8d 100644
>--- a/gnu/packages/javascript.scm
>+++ b/gnu/packages/javascript.scm
>@@ -6,6 +6,7 @@
> ;;; Copyright © 2018 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
> ;;; Copyright © 2021 Pierre Neidhardt <mail <at> ambrevar.xyz>
> ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
>+;;; Copyright © 2022 Frank Pursel <frank.pursel <at> gmail.com>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
>@@ -26,7 +27,9 @@ (define-module (gnu packages javascript)
>   #:use-module ((guix licenses) #:prefix license:)
>   #:use-module (gnu packages)
>   #:use-module (gnu packages base)
>+  #:use-module (gnu packages bash)
>   #:use-module (gnu packages compression)
>+  #:use-module (gnu packages java)
>   #:use-module (gnu packages node)
>   #:use-module (gnu packages readline)
>   #:use-module (gnu packages uglifyjs)
>@@ -34,10 +37,11 @@ (define-module (gnu packages javascript)
>   #:use-module (guix packages)
>   #:use-module (guix download)
>   #:use-module (guix git-download)
>-  #:use-module (guix build-system gnu)
>+  #:use-module (guix build-system ant)
>   #:use-module (guix build-system cmake)
>-  #:use-module (guix build-system trivial)
>+  #:use-module (guix build-system gnu)
>   #:use-module (guix build-system minify)
>+  #:use-module (guix build-system trivial)
>   #:use-module (guix utils))
> 
> (define-public cjson
>@@ -791,3 +795,98 @@ (define-public duktape
> your build, and use the Duktape API to call ECMAScript functions from C code
> and vice versa.")
>     (license license:expat)))
>+
>+(define-public rhino
>+    (package
>+      (name "rhino")
>+      (version "1.7.7.2")
>+      (source (origin
>+                (method git-fetch)
>+                (uri (git-reference
>+                      (url "https://github.com/mozilla/rhino.git")
>+                      (commit "935942527ff434b205e797df4185518e5369466e")))
>+                (file-name (git-file-name name version))
>+                (sha256
>+                 (base32
>+                  "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8"))
>+                (modules '((guix build utils)))
>+                (snippet '(begin
>+                            ;; Remove benchmark testing
>+                            (delete-file-recursively "testsrc/benchmarks")
>+                            (delete-file-recursively
>+                             "testsrc/org/mozilla/javascript/benchmarks")
>+                            ;; Identify bundled jars
>+                            (format #t "~%~a~%" "Sourced jars")
>+                            (for-each (lambda (f)
>+                                        (format #t "~/Deleting: ~a~%" f)
>+                                        (delete-file f))
>+                                      (find-files "." "\\.jar$"))))))
>+      (build-system ant-build-system)
>+      (inputs (list bash-minimal))
>+      (native-inputs (list java-junit java-hamcrest-core java-snakeyaml))
>+      (arguments
>+       `(#:phases
>+         (modify-phases
>+             %standard-phases
>+           (replace 'check
>+             (lambda* (#:key tests? inputs native-inputs
>+                       #:allow-other-keys)
>+               (when tests?
>+                 (setenv "ANT_OPTS" "-Doffline=true")
>+                 (let ((junit-lib
>+                        (assoc-ref inputs "java-junit"))
>+                       (hamcrest-lib
>+                        (assoc-ref inputs "java-hamcrest-core"))
>+                       (snakeyaml-lib
>+                        (assoc-ref inputs "java-snakeyaml")))
>+                   (with-directory-excursion "testsrc"
>+                     (substitute* "build.xml"
>+                       (("<pathelement location=\"\\$\\{xbean.jar\\}\" */>" all)
>+                        (string-append "<!-- " all " -->"))
>+                       (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
>+                        (string-append "<!-- " all " -->"))
>+                       (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>"
>+                         all)
>+                        (string-append "<!-- " all " -->"))
>+                       (("<pathelement path=\"lib/emma.jar\"/>" all)
>+                        (string-append "<!-- " all " -->"))
>+                       (("<pathelement path=\"lib/junit.jar\" ?/>")
>+                        (string-append
>+                         "<fileset dir=\"" junit-lib "\" includes=\"**/*.jar\"/>"))
>+                       (("<pathelement path=\"lib/hamcrest.jar\" ?/>")
>+                        (string-append "<fileset dir=\"" hamcrest-lib
>+                                       "\" includes=\"**/*.jar\"/>"))
>+                       (("<pathelement path=\"lib/snakeyaml.jar\" ?/>")
>+                        (string-append "<fileset dir=\"" snakeyaml-lib
>+                         "\" includes=\"**/*.jar\"/>"))
>+                       ;; Disabling instrumentation.
>+                       (("(<target name=\"junit\" depends=\"junit-compile),.*"
>+                         all pre)
>+                        (string-append pre "\">"))))
>+                   (invoke "ant" "junit")))))
>+           (replace 'install
>+                      (lambda* (#:key inputs outputs #:allow-other-keys)
>+                        (let* ((out (assoc-ref outputs "out"))
>+                               (pkg+ver (string-append ,name ,version))
>+                               (bin (string-append out "/bin"))
>+                               (rhino (string-append bin "/rhino"))
>+                               (man (string-append out "/share/man/man1")))
>+                          (mkdir-p bin)
>+                          (install-file "man/rhino.1" man)
>+                          (install-file (string-append "build/" pkg+ver
>+                                                       "/js.jar")
>+                                        (string-append out "/share/java"))
>+                          (with-output-to-file rhino
>+                            (lambda _
>+                              (format #t "#!~a~%~a -jar ~a $@~%"
>+                                      (search-input-file inputs "/bin/bash")
>+                                      (search-input-file inputs "/bin/java")
>+                                      (string-append out "/share/java/js.jar"))))
>+                          (chmod rhino #o755)))))))
>+      (home-page "https://mozilla.github.io/rhino")
>+      (synopsis "Javascript implemented in Java")
>+      (description
>+       "Rhino implements ECMAScript, also known as JavaScript, in Java as
>+specified in the fifth edition of ECMA-262.")
>+      (license license:mpl2.0)))
>+
>-- 
>2.34.0
>
>
>
>
[Message part 2 (text/html, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54021; Package guix-patches. (Mon, 28 Feb 2022 21:47:01 GMT) Full text and rfc822 format available.

Message #62 received at 54021 <at> debbugs.gnu.org (full text, mbox):

From: Frank Pursel <frank.pursel <at> gmail.com>
To: 54021 <at> debbugs.gnu.org
Subject: [PATCH] question -> answers
Date: Mon, 28 Feb 2022 13:45:58 -0800
Julien,

I missed the JavaScript in the synopsis, my fault; I did get the one in the
description.

Why the older version?  A couple of reasons.  First, is that I'm trying
to address the problems that have been pointed out with my earlier
patches for a ditaa package.  'ditaa' has a sequence of dependencies
that lead to the version of rhino I've packaged.  I looked at the latest
version too (because that would certainly be a good thing) but newer
releases of rhino have transitioned to the gradle build system.  I have
experience with ant that I can use but none, yet, with gradle.  Plus,
and this may be naive, I thought it might be a good experiment (perhaps
even better for guix) to see if a guix transformation based on this ant
build could build one of the later rhino versions that otherwise would
require gradle.  I may pursue such experiments later after I achieve my
first goal, which is to package ditaa.  I also think there is a risk
that the latest version of rhino will not work with ditaa as the one we
are packaging does.

If I can suceed with rhino and my more recent submission of xalan then I
will have a clean build of batik that will allow ditaa to be built
properly using only guix quality, built-from-source, libraries.  That is
my current small guix ambition.    

Regards,
Frank






Reply sent to Julien Lepiller <julien <at> lepiller.eu>:
You have taken responsibility. (Tue, 01 Mar 2022 21:27:02 GMT) Full text and rfc822 format available.

Notification sent to Frank Pursel <frank.pursel <at> gmail.com>:
bug acknowledged by developer. (Tue, 01 Mar 2022 21:27:02 GMT) Full text and rfc822 format available.

Message #67 received at 54021-done <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: Frank Pursel <frank.pursel <at> gmail.com>
Cc: 54021-done <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] Add rhino javascript package
Date: Tue, 1 Mar 2022 22:26:01 +0100
Thanks for the answer (I didn't spot your message immediately because
you renamed the subject). I suppose this is good for now, especially
since I need a version of rhino for kotlin, which I need for gradle,
which we would need for future versions of rhino :)

Pushed to master as 22525731fdbfeebfc51d17dc6674a92d75383213, thanks!

Le Mon, 28 Feb 2022 13:45:58 -0800,
Frank Pursel <frank.pursel <at> gmail.com> a écrit :

> Julien,
> 
> I missed the JavaScript in the synopsis, my fault; I did get the one
> in the description.
> 
> Why the older version?  A couple of reasons.  First, is that I'm
> trying to address the problems that have been pointed out with my
> earlier patches for a ditaa package.  'ditaa' has a sequence of
> dependencies that lead to the version of rhino I've packaged.  I
> looked at the latest version too (because that would certainly be a
> good thing) but newer releases of rhino have transitioned to the
> gradle build system.  I have experience with ant that I can use but
> none, yet, with gradle.  Plus, and this may be naive, I thought it
> might be a good experiment (perhaps even better for guix) to see if a
> guix transformation based on this ant build could build one of the
> later rhino versions that otherwise would require gradle.  I may
> pursue such experiments later after I achieve my first goal, which is
> to package ditaa.  I also think there is a risk that the latest
> version of rhino will not work with ditaa as the one we are packaging
> does.
> 
> If I can suceed with rhino and my more recent submission of xalan
> then I will have a clean build of batik that will allow ditaa to be
> built properly using only guix quality, built-from-source, libraries.
>  That is my current small guix ambition.    
> 
> Regards,
> Frank
> 
> 
> 
> 
> 





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 Mar 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 77 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.