FS#60468 - [netbeans] Explicit (make)dependencies to a specific jdk

Attached to Project: Community Packages
Opened by Alexandre Garnier (agarnier) - Thursday, 18 October 2018, 08:22 GMT
Last edited by Santiago Torres (sangy) - Tuesday, 23 October 2018, 04:17 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Santiago Torres (sangy)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Is there any need for this package to depend on jdk10-openjdk rather than java-{environment,runtime}?
Same question goes for the makedep to jdk8-openjdk.

AFAIK this packages and aur/apache-netbeans (https://aur.archlinux.org/packages/apache-netbeans/) bundle the very same IDE, and I’ve been using the latter flawlessly for quite a few weeks without having any openjdk installed.
This task depends upon

Closed by  Santiago Torres (sangy)
Tuesday, 23 October 2018, 04:17 GMT
Reason for closing:  Fixed
Comment by Santiago Torres (sangy) - Thursday, 18 October 2018, 15:33 GMT
If you don't have oracle/open jdk 9+ when running you probably get a prompt asking to install it for you.
Comment by Alexandre Garnier (agarnier) - Thursday, 18 October 2018, 18:15 GMT
I think you misunderstood what I’m trying to say.
It is because I have oracle jdk 9+ that I don’t want this package to install an openjdk one.

But it does so, systematically, just have a look at the PKGBUILD if you have a doubt:
depends=([…] 'jdk10-openjdk')
makedepends=([…] 'jdk8-openjdk')
Comment by Santiago Torres (sangy) - Thursday, 18 October 2018, 19:12 GMT
I'll remove the depends, why do you care about the makedepends at all?
Comment by Alexandre Garnier (agarnier) - Friday, 19 October 2018, 09:19 GMT
It’s not that I care about this package’s makedepends in particular, but any user rebuilding a package from a PKGBUILD to tweak the install in any way intends to get a clean process, that installs only what it needs to work flawlessly.

And basically, I assume netbeans needs any jdk8+ to be built, not the very specific jdk8-openjdk. The way to go here is to specify the make-dependency as java-environment>=8.
But there is something worse: in your PKGBUILD, you *also* have java-environment as make dependency, which defaults to jdk10-openjdk, instead of jdk8-openjdk, and most definitely uses it by default. The consequence of this is your PKGBUILD does use time, bandwidth, CPU and disk space to install jdk8-openjdk, and never uses it.

Another issue, though not so important, with your PKGBUILD is the presence of java-environment in depends & makedepends: from the Wiki it is stated that depends lists dependencies for build *and* run, while makedepends manages dependencies only needed to build the package.
Ideally, I assume these two lines should look like this:
depends=('java-environment>=8' 'ttf-font')
makedepends=('ant')

Here I’m assuming a jdk8+ is enough for netbeans 9.0 to be built *and* run; you may want to replace the version with 10 if it is needed to run netbeans (which might be the case, as you put jdk10-openjdk as a dependency at the moment?)

This lets users use their already installed jdk, or chose which one they want in order to build & run netbeans, and this is the way to go.
Comment by Santiago Torres (sangy) - Friday, 19 October 2018, 16:02 GMT
> It’s not that I care about this package’s makedepends in particular, but any user rebuilding a package from a PKGBUILD to tweak the install in any way intends to get a clean process, that installs only what it needs to work flawlessly.

Well that's the intention. As of now, we don't provide any other type of jdk in any of the official repositories

>And basically, I assume netbeans needs any jdk8+ to be built, not the very specific jdk8-openjdk. The way to go here is to specify the make-dependency as java-environment>=8.

The reason as to why I need to do this is because it *will* default to jdk 10 as you mention down there.

> But there is something worse: in your PKGBUILD, you *also* have java-environment as make dependency, which defaults to jdk10-openjdk, instead of jdk8-openjdk, and most definitely uses it by default. The consequence of this is your PKGBUILD does use time, bandwidth, CPU and disk space to install jdk8-openjdk, and never uses it.

It uses if, you should read the build() section of the PKGBUILD.

> Another issue, though not so important, with your PKGBUILD is the presence of java-environment in depends & makedepends: from the Wiki it is stated that depends lists dependencies for build *and* run, while makedepends manages dependencies only needed to build the package.

> Ideally, I assume these two lines should look like this:
> depends=('java-environment>=8' 'ttf-font')
> makedepends=('ant')

> Here I’m assuming a jdk8+ is enough for netbeans 9.0 to be built *and* run; you may want to replace the version with 10 if it is needed to run netbeans (which might be the case, as you put jdk10-openjdk as a dependency at the moment?)

They explicitly mention in the readme you need jdk8 for building and 9+ for running.

> This lets users use their already installed jdk, or chose which one they want in order to build & run netbeans, and this is the way to go.

I think part of the reason is that you haven't tried these changes yourself and are just speculating on what needs to be done to build from source. The AUR package that you mention is a -bin package, which by the way should be renamed as such.
Comment by Alexandre Garnier (agarnier) - Friday, 19 October 2018, 16:11 GMT
I never realized the AUR package is a -bin one, hence my assumptions, my bad then.
Nevertheless, can’t the makedepend be replaced with java-environment=8?
Comment by Eli Schwartz (eschwartz) - Friday, 19 October 2018, 16:16 GMT
@sangy,

It is unambiguously true that the makedepends and depends on java-environment are pointless. They're the same dependency string.

And if it depends on java-environment=8 to build, then it must specify that versioned dependency, rather than assuming what the user selects in the maybe interactive prompt. Same goes for the depends on >=9.

Rigging the depends/makedepends by *also* hardcoding the jdk8/jdk10 package means you're not using the java-environment dependency string *at all*. Its being there is a lie.

This PKGBUILD only depends on jdk10-openjdk, and it only makedepends on jdk8-openjdk, and that defeats the purpose of having the provides in our repository at all.
Comment by Santiago Torres (sangy) - Friday, 19 October 2018, 16:46 GMT
@agarnier

You do raise a valid point though. After discussing with some other TU's it appears there's a way to do this cleanly and allowing you to use the jdk that you want. Let me push a -3 version of this for you and thanks for reporting this issue.
Comment by Santiago Torres (sangy) - Tuesday, 23 October 2018, 04:17 GMT
@agarnier

I updated the package to not have a hard dependency on openjdk.

Loading...