Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addpkg(main/openjdk-21): 21.0.5 #20793

Merged
merged 9 commits into from
Oct 17, 2024
Merged

Conversation

nexplorer-3e
Copy link
Contributor

@nexplorer-3e nexplorer-3e commented Jul 7, 2024

cherry-pick patches from openjdk-termux-mobile, adopted for latest update
TODO: enable or disable auto update currently set to tracking ga releases.

@TomJo2000
Copy link
Member

Duplicate of:

@agnostic-apollo
Copy link
Member

Duplicate of #19682

@agnostic-apollo agnostic-apollo marked this as a duplicate of #19682 Jul 7, 2024
@nexplorer-3e
Copy link
Contributor Author

Duplicate of #19682

Note that this one is based on mainline java, and there is no TERMUX_PACKAGE_REPLACES=openjdk-17
if termux have not prepared enough to switch to newer jdk, let me submit a copy to tur.

@TomJo2000
Copy link
Member

Note that this one is based on mainline java, and there is no TERMUX_PACKAGE_REPLACES=openjdk-17
if termux have not prepared enough to switch to newer jdk, let me submit a copy to tur.

The problem is not your approach.
The problem is this work has already been started, and any input you have regarding the way it should be handled should be directed towards #19682.

Copy link
Member

@Grimler91 Grimler91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please comment on the patches, any differences compared to what is checked in at https://github.com/termux/openjdk-mobile-termux/tree/termux/jdk-21?

I think it would help to add an "openjdk" package as well, that depends on openjdk-17 | openjdk-21, and that provides some java selector script (for example similar to archlinux's archlinux-java). We can then also make packages depend on openjdk instead of a specific openjdk version, where applicable (but that can be done later).

packages/openjdk-21/build.sh Outdated Show resolved Hide resolved
packages/openjdk-21/build.sh Outdated Show resolved Hide resolved
packages/openjdk-21/build.sh Outdated Show resolved Hide resolved
packages/openjdk-21/hooks/pacman/postinst.in Outdated Show resolved Hide resolved
@nexplorer-3e
Copy link
Contributor Author

Please comment on the patches, any differences compared to what is checked in at https://github.com/termux/openjdk-mobile-termux/tree/termux/jdk-21?

difference is that patches are to adapted for applying on mainline branch, in order to provide a more "vanilla" build.

I think it would help to add an "openjdk" package as well, that depends on openjdk-17 | openjdk-21, and that provides some java selector script (for example similar to archlinux's archlinux-java). We can then also make packages depend on openjdk instead of a specific openjdk version, where applicable (but that can be done later).

The current Debian management on JDK isn't intuitive. While unable to provide a choice for user to fill the virtual package (java-compiler or java-sdk here) dependency like pacman, they provides default-java which is still at JDK17, and there is no such thing as latest-java latest-java-lts or so to let you rolling to latest version.

:/etc/apt$ sudo apt install java-compiler
[sudo] password for :
Package java-compiler is a virtual package provided by:
  openjdk-8-jdk 8u412-ga-1
  openjdk-23-jdk-headless 23~28ea-1
  openjdk-23-jdk 23~28ea-1
  openjdk-22-jdk-headless 22.0.1+8-2
  openjdk-22-jdk 22.0.1+8-2
  openjdk-21-jdk-headless 21.0.4~6ea-1
  openjdk-21-jdk 21.0.4~6ea-1
  openjdk-20-jdk-headless 20.0.2+9-1+b6
  openjdk-20-jdk 20.0.2+9-1+b6
  openjdk-19-jdk-headless 19.0.2+7-4
  openjdk-19-jdk 19.0.2+7-4
  openjdk-17-jdk-headless 17.0.12~6ea-1
  openjdk-17-jdk 17.0.12~6ea-1
  openjdk-11-jdk-headless 11.0.24~7ea-1
  openjdk-11-jdk 11.0.24~7ea-1
You should explicitly select one to install.

Error: Package 'java-compiler' has no installation candidate

As for java management, Debian do have something called update-java-alternatives, an wrapper to their update-alternatives that change many symlinks in "one click": https://askubuntu.com/a/1454887/164946
In my opinion update-alternatives is something like CAPSLOCK, most of time I just neet to export JAVA_PATH=;PATH=$JAVA_PATH/bin:$PATH for testing, and tell the user when pkg in finished that termux had packaged a source script to make life easier may be enough.

@nexplorer-3e
Copy link
Contributor Author

nexplorer-3e commented Jul 8, 2024

topic of bf4f0b1 should be enhance rebased

@nexplorer-3e nexplorer-3e changed the title addpkg(main/openjdk-21): 21.0.3+6 addpkg(main/openjdk-21): 21.0.3-ga Jul 8, 2024
@nexplorer-3e
Copy link
Contributor Author

nexplorer-3e commented Jul 8, 2024

looks like mainline java is unable to enable features on arm that should able to be enabled:

Configuration summary:
* Name:           linux-arm-server-release
* Debug level:    release
* HS debug level: product
* JVM variants:   server
* JVM features:   server: 'cds compiler1 compiler2 epsilongc g1gc jfr jni-check jvmti management parallelgc serialgc services vm-structs'
* OpenJDK target: OS: linux, CPU architecture: arm, address length: 32
* Version string: 21.0.3 (21.0.3)
* Source date:    1720425658 (2024-07-08T08:00:58Z)

aarch64 docker doesn't have this issue.

Configuration summary:
* Name:           linux-aarch64-server-release
* Debug level:    release
* HS debug level: product
* JVM variants:   server
* JVM features:   server: 'cds compiler1 compiler2 epsilongc g1gc jfr jni-check jvmci jvmti management parallelgc serialgc services shenandoahgc vm-structs zgc'
* OpenJDK target: OS: linux, CPU architecture: aarch64, address length: 64
* Version string: 21.0.3 (21.0.3)
* Source date:    1720425925 (2024-07-08T08:05:25Z)

./build-package.sh -a arm openjdk-17:

Configuration summary:
* Name:           linux-arm-server-release
* Debug level:    release
* HS debug level: product
* JVM variants:   server
* JVM features:   server: 'cds compiler1 compiler2 epsilongc g1gc jfr jni-check jvmti management nmt parallelgc serialgc services vm-structs'
* OpenJDK target: OS: linux, CPU architecture: arm, address length: 32
* Version string: 17-internal+0-adhoc..src (17-internal)

@IntinteDAO
Copy link
Contributor

and there is no TERMUX_PACKAGE_REPLACES=openjdk-17

Well - normally Java can be in different versions. I don't see a problem why Java 17 and 21 shouldn't be in one repo

@Grimler91
Copy link
Member

Grimler91 commented Jul 8, 2024

I've cherry-picked the setup-ubuntu.sh openjdk-21 commit to master, so that it is added to docker image. Please rebase, and in future changes CI will not have to build a custom docker image every time.

edit: CI build failed, so openjdk-21 has not been added to docker image yet

@nexplorer-3e nexplorer-3e force-pushed the addpkg/openjdk-21 branch 2 times, most recently from fe4b2b9 to 8280b22 Compare July 8, 2024 17:23
Copy link
Member

@Grimler91 Grimler91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now, thanks!

Commit messages should be updated, FIXME: fix: type redefinition introduced in 21.0.2 should be squashed, and the chore and enhance commits should be rewritten so that it is clear that they are related to openjdk-21 (i.e. start with chore(main/openjdk-21): or enhance(main/openjdk-21): instead)

@TomJo2000
Copy link
Member

(This is a pre-written, saved reply.)
If you want to test this PR please download the appropriate DEB package(s)
from the build artifacts of the associated PR's latest CI run.
Screenshot_20240619_232413

After downloading the build artifact, make sure to unzip and un-tar it.

Detailed instructions, if needed.

# finding out what architecture you need
# architecture is just below the TERMUX_VERSION
termux-info

# e.g.
# [...]
# TERMUX_MAIN_PACKAGE_FORMAT=debian
# TERMUX_VERSION=0.118.0
# TERMUX__USER_ID=0
# Packages CPU architecture:
# aarch64
# [...]

# =======================

# make sure `unzip` and `tar` are installed using
pkg install unzip tar

# unzip the artifact (if you have a different architecture this might be arm, i686 or x86_64 instead)
unzip debs-aarch64-*.zip

# untar the artifact
tar xf debs-aarch64-*.tar

# You should now have a debs/ directory in your current working directory
# Install the packages from the local source using
pkg install -- ./debs/*.deb

# to clean up, you can remove the debs/ directory, .tar file and .zip file
rm -rfi debs debs-aarch64-*.zip debs-aarch64-*.tar

@Grimler91
Copy link
Member

I will do some tests locally, and merge this within a day assuming everything works fine. Thanks!

@o81018o
Copy link

o81018o commented Aug 29, 2024

(This is a pre-written, saved reply.) If you want to test this PR please download the appropriate DEB package(s) from the build artifacts of the associated PR's latest CI run. Screenshot_20240619_232413

After downloading the build artifact, make sure to unzip and un-tar it.

Detailed instructions, if needed.

Error with latest build, aarch64 version not available

cherry-pick all patches, apply them on upstream JDK, and adapted for
newer $UPDATE version

fix: type redefinition introduced in 21.0.2
nexplorer-3e and others added 5 commits October 16, 2024 23:15
…rrange

- change base version to 21.0.3, and track GA build for upgrade
- move make JOBS arg to configure stage
- configure args resort
- strip version string, add vendor name (Termux)
update-alternatives take the path to the real file as argument, not
the symlink installation path.
update-alternatives take the path to the real file as argument, not
the symlink installation path.
@fornwall fornwall changed the title addpkg(main/openjdk-21): 21.0.3-ga addpkg(main/openjdk-21): 21.0.5 Oct 16, 2024
@fornwall
Copy link
Member

Let's merge this?

Copy link
Member

@twaik twaik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@fornwall fornwall merged commit a2a3bbf into termux:master Oct 17, 2024
7 checks passed
@fornwall
Copy link
Member

Thanks @nexplorer-3e !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants