From: Frank Pursel <frank.pursel@gmail.com>
To: Maxime Devos <maximedevos@telenet.be>
Cc: 54021@debbugs.gnu.org
Subject: [bug#54021] [PATCH] Add rhino javascript package
Date: Wed, 16 Feb 2022 18:36:33 +0000 [thread overview]
Message-ID: <CANp2FMedrCBT9yTP6NPCk2p-kfTzp3vn-n-h_nc3ZbUmoS5bnA@mail.gmail.com> (raw)
In-Reply-To: <5ad705f1e2d97a07057aca0945de8ce18c145662.camel@telenet.be>
[-- Attachment #1: Type: text/plain, Size: 4926 bytes --]
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@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.
>
[-- Attachment #2: Type: text/html, Size: 6963 bytes --]
next prev parent reply other threads:[~2022-02-16 18:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-16 1:58 [bug#54021] [PATCH] Add rhino javascript package Frank Pursel
2022-02-16 17:00 ` Maxime Devos
2022-02-16 17:02 ` Maxime Devos
2022-02-16 17:08 ` Julien Lepiller
2022-02-16 17:08 ` Maxime Devos
2022-02-16 17:09 ` Maxime Devos
2022-02-16 17:21 ` Maxime Devos
2022-02-16 18:36 ` Frank Pursel [this message]
2022-02-16 18:43 ` Maxime Devos
2022-02-17 5:22 ` [bug#54021] [PATCH] Adding rhino package, revised patch Frank Pursel
2022-02-21 16:28 ` Maxime Devos
2022-02-18 20:42 ` [bug#54021] [PATCH] if, at first, you don't succeed Frank Pursel
2022-02-21 13:19 ` Efraim Flashner
2022-02-21 15:54 ` [bug#54021] [PATCH] Better rhino Frank Pursel
2022-02-21 18:45 ` [bug#54021] [PATCH] Removing all bundled jars prior to build Frank Pursel
2022-02-26 21:07 ` Julien Lepiller
2022-02-28 19:38 ` [bug#54021] [PATCH] package for rhino Frank Pursel
2022-02-28 20:45 ` Julien Lepiller
2022-02-28 21:45 ` [bug#54021] [PATCH] question -> answers Frank Pursel
2022-03-01 21:26 ` bug#54021: [PATCH] Add rhino javascript package Julien Lepiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANp2FMedrCBT9yTP6NPCk2p-kfTzp3vn-n-h_nc3ZbUmoS5bnA@mail.gmail.com \
--to=frank.pursel@gmail.com \
--cc=54021@debbugs.gnu.org \
--cc=maximedevos@telenet.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.