Bug 256705 - [NEW] devel/py-jsonnet: Python bindings for Jsonnet: The data templating language
Summary: [NEW] devel/py-jsonnet: Python bindings for Jsonnet: The data templating lang...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Kevin Bowling
URL:
Keywords: easy, feature
Depends on:
Blocks:
 
Reported: 2021-06-19 03:11 UTC by Pavel Timofeev
Modified: 2021-06-28 05:06 UTC (History)
3 users (show)

See Also:
koobs: maintainer-feedback+


Attachments
port patch (1.66 KB, patch)
2021-06-19 03:11 UTC, Pavel Timofeev
no flags Details | Diff
port.diff (4.58 KB, patch)
2021-06-22 04:17 UTC, Pavel Timofeev
timp87: maintainer-approval+
Details | Diff
port.diff2 (4.79 KB, patch)
2021-06-23 00:35 UTC, Pavel Timofeev
timp87: maintainer-approval+
Details | Diff
py38-jsonnet-0.17.0.log (15.08 KB, text/plain)
2021-06-23 00:37 UTC, Pavel Timofeev
no flags Details
py37-jsonnet-0.17.0.log (15.77 KB, text/plain)
2021-06-23 02:11 UTC, Pavel Timofeev
no flags Details
py36-jsonnet-0.17.0.log (15.27 KB, text/plain)
2021-06-23 03:13 UTC, Pavel Timofeev
no flags Details
py39-jsonnet-0.17.0.log (17.25 KB, text/plain)
2021-06-23 04:18 UTC, Pavel Timofeev
no flags Details
port.diff3 (4.87 KB, patch)
2021-06-24 04:09 UTC, Pavel Timofeev
timp87: maintainer-approval+
Details | Diff
port.diff4 (4.87 KB, patch)
2021-06-24 04:12 UTC, Pavel Timofeev
timp87: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Timofeev 2021-06-19 03:11:46 UTC
Created attachment 225918 [details]
port patch

Add new port devel/py-jsonnet - python bindings for jsonnet
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-19 03:23:54 UTC
Please confirm this passes QA across multiple Python versions.

Initial review:

 - strip command is hardcoded (38)
 - What is gmake used for and is it required? Upstream install directions specify only requiring pip install, which should not require make/gmake. If not, BINARY_ALIAS over REINPLACE
 - Upstream provides and utilises a test suite [1], please hook this up in a do-test target and add TEST_DEPENDS if required

[] setup.py:test_suite="python._jsonnet_test",
Comment 2 Pavel Timofeev 2021-06-19 04:00:20 UTC
(In reply to Kubilay Kocak from comment #1)
Thanks for this fast reply!

- Can you describe a bit more your thoughts about strip?
- It build .so during installation https://github.com/google/jsonnet/blob/master/setup.py#L63 and uses Makefile in the same dir which is not compatible with freebsd make
Didn't know about BINARY_ALIAS, thanks!
- I'll take a look, thanks!
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-19 04:22:46 UTC
(In reply to timp87 from comment #2)

The strip method in the patch has a hardcoded python version (38). It will fail for all other versions.

It looks like they're using make to build libraries (not the binding)? [1] This port will need to depend on the libraries from the ports tree (if they exist)

[1] https://github.com/google/jsonnet/blob/master/setup.py#L22
Comment 4 Pavel Timofeev 2021-06-20 14:03:23 UTC
(In reply to Kubilay Kocak from comment #3)
Thanks, initially I thought 38 is a line number in Makefile or something. I just missed thath.

Yep, depending on jsonnet shared lib would be great, but they don't provide such knob. They build it everytime statically.
I've submitted a improvement for devel/jsonnet which may help me to depend on it, but anyway python installation part should be modified to be linked to that lib dynamically.
So gimme some time to investigate it.
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-21 02:15:58 UTC
(In reply to Pavel Timofeev from comment #4)

Try removing the dependency sources in WRKSRC post-extract and adding USES=localbase which will setup CFLAGS/LDFLAGS to /usr/local/{include,lib}
Comment 6 Pavel Timofeev 2021-06-22 04:17:28 UTC
Created attachment 225986 [details]
port.diff

It was a bit harder to make it dynamically link to libjsonnet.so
Also I had to change MASTER_SITE to google repo on github as guys from CHEESESHOP repacked it w/o tests. Fix tests.
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-22 05:20:35 UTC
(In reply to Pavel Timofeev from comment #6)

Nice work Pavel. Does this pass QA (poudriere) for default and a non default Python version?
Comment 8 Pavel Timofeev 2021-06-22 19:22:21 UTC
(In reply to Kubilay Kocak from comment #7)
Lemme run it and attach logs
Comment 9 Pavel Timofeev 2021-06-23 00:21:56 UTC
Poudriere found small issue.
Fixing it and rerunning
Comment 10 Pavel Timofeev 2021-06-23 00:35:44 UTC
Created attachment 226002 [details]
port.diff2
Comment 11 Pavel Timofeev 2021-06-23 00:37:00 UTC
Created attachment 226003 [details]
py38-jsonnet-0.17.0.log

Running against py36, py37 and py39 also. Stay tuned ;)
Comment 12 Pavel Timofeev 2021-06-23 02:11:04 UTC
Created attachment 226004 [details]
py37-jsonnet-0.17.0.log
Comment 13 Pavel Timofeev 2021-06-23 03:13:27 UTC
Created attachment 226005 [details]
py36-jsonnet-0.17.0.log
Comment 14 Pavel Timofeev 2021-06-23 04:18:39 UTC
Created attachment 226007 [details]
py39-jsonnet-0.17.0.log
Comment 15 Pavel Timofeev 2021-06-23 05:13:03 UTC
I've tested it against all available in ports tree python version. See attached poudriere logs. But I did it only on FreeBSD 13.0 amd64 as I don't have other machines.
Comment 16 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-24 02:31:42 UTC
Thanks Pavel. No need for logs in future, just confirmation on what combinations were run, and their final PASS/FAIL

Can you detail what LDFLAGS -s is for? Ideally comment that block too (if it remains necessary)
Comment 17 Pavel Timofeev 2021-06-24 03:06:00 UTC
(In reply to Kubilay Kocak from comment #16)
This flag tells the linked to strip shared lib which is part of this port
Comment 18 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-24 03:08:19 UTC
(In reply to Pavel Timofeev from comment #17)

Ah ok, yep, definitely use post-install: STRIP_CMD <path/to/file> for this, as it has support for WITH_DEBUG at the framework level
Comment 19 Pavel Timofeev 2021-06-24 04:09:31 UTC
Created attachment 226024 [details]
port.diff3

Ok, the only change here is use STRIP_CMD instead of LDFLAGS -s
Comment 20 Pavel Timofeev 2021-06-24 04:12:06 UTC
Created attachment 226025 [details]
port.diff4

Use PYTHON_EXT_SUFFIX fir that
Comment 21 commit-hook freebsd_committer 2021-06-26 06:33:49 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f091166687409804b91a1a041fb715d24f25c028

commit f091166687409804b91a1a041fb715d24f25c028
Author:     Pavel Timofeev <timp87@gmail.com>
AuthorDate: 2021-06-26 06:22:32 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2021-06-26 06:32:53 +0000

    devel/py-jsonnet: Python bindings for Jsonnet

    Jsonnet lets you compute fragments of JSON within the structure,
    bringing the same benefit to structured data that templating languages
    bring to plain text.

    WWW: https://github.com/google/jsonnet

    PR:             256705
    Reviewed by:    koobs
    Approved by:    new maintainer

 devel/Makefile                                     |  1 +
 devel/py-jsonnet/Makefile (new)                    | 31 +++++++++++++
 devel/py-jsonnet/distinfo (new)                    |  3 ++
 ...ch-case__studies_kubernetes_test__same.py (new) | 35 +++++++++++++++
 devel/py-jsonnet/files/patch-setup.py (new)        | 52 ++++++++++++++++++++++
 devel/py-jsonnet/pkg-descr (new)                   |  6 +++
 6 files changed, 128 insertions(+)
Comment 22 Kevin Bowling freebsd_committer 2021-06-26 07:04:31 UTC
Thanks for your contribution!
Comment 23 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-27 02:36:20 UTC
Re-open to update MAINTAINER line to match Reporter email (and other port) maintainer lines
Comment 24 commit-hook freebsd_committer 2021-06-27 04:33:24 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=65fbda12aea9ace689972d9c7e726ceb706c876f

commit 65fbda12aea9ace689972d9c7e726ceb706c876f
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2021-06-27 04:31:45 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2021-06-27 04:31:45 +0000

    devel/py-jsonnet: Correct maintainer mail

    PR:             256705
    Reported by:    jbeich
    Reviewed by:    koobs

 devel/py-jsonnet/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)