Linuxbrew / brew

:beer::penguin: The Homebrew package manager for Linux
https://linuxbrew.sh
BSD 2-Clause "Simplified" License
2.65k stars 235 forks source link

Installing maven is too hard. #700

Closed bukzor closed 6 years ago

bukzor commented 6 years ago

There's several interrelated issues conspiring to make this very confusing and hard. They may perhaps have a single solution however.

  1. Oracle has broken your license-acceptance-cookie code by requiring login.
  2. Oracle has deprecated JDK 9. The JDK 9 download page has no downloads and redirects to JDK 10 downloads. The JDK 9 archive page is much harder to find.
  3. Linuxbrew converts "depends_on :java" to a dependency on the jdk formula, sometimes. It took me a long while and a good deal of research to realize that a system-installed java would (should) also fill the dependency.
  4. Linuxbrew doesn't recognized the output of java -version when OpenJDK is installed. This is the only supported JDK for Ubuntu. The output is
    $ java -version
    openjdk version "9-Ubuntu"
    OpenJDK Runtime Environment (build 9-Ubuntu+0-9b181-4)
    OpenJDK 64-Bit Server VM (build 9-Ubuntu+0-9b181-4, mixed mode)

This change (along with sudo apt install openjdk-9-jdk) worked around the issue for me, although I feel sure it's not the Right Fix:

diff --git a/Library/Homebrew/requirements/java_requirement.rb b/Library/Homebrew/requirements/java_requirement.rb
index 27348fa8c..874630840 100644
--- a/Library/Homebrew/requirements/java_requirement.rb
+++ b/Library/Homebrew/requirements/java_requirement.rb
@@ -122,7 +122,7 @@ class JavaRequirement < Requirement
   end

   def satisfies_version(java)
-    java_version_s = Utils.popen_read(java, "-version", err: :out)[/\d+.\d/]
+    java_version_s = Utils.popen_read(java, "-version", err: :out)[/\d+/]
     return false unless java_version_s
     java_version = Version.create(java_version_s)
     needed_version = Version.create(version_without_plus)

To help us debug your issue please explain:

sjackman commented 6 years ago

Thanks for the useful bug report, Buck. @suujia will be looking into Java in Linuxbrew. I'm at a workshop for one week. Please bump this issue in one week if you don't hear from us.

iMichka commented 6 years ago

One thing I have already seen is the jdk people deleting these links. I think we should host a copy of the original file on bintray, else we loose the sources ...

sjackman commented 6 years ago

I think we should host a copy of the original file on bintray, else we loose the sources

Good idea. Can you check that the license permits redistribution? I hope so.

bukzor commented 6 years ago

I've copy-pasted the relevant section below in case you care to check my interpretation. My take is that we have a license to redistribute, but it has to be under the same unmodified license and we have to take all legal responsibility for its content.

http://www.oracle.com/technetwork/java/javase/terms/license/index.html

C. LICENSE TO DISTRIBUTE SOFTWARE. Subject to the terms and conditions of this Agreement and restrictions and exceptions set forth in the Java SE LIUM, including, but not limited to the Java Technology Restrictions and Limitations on Redistribution of these Supplemental Terms, Oracle grants you a non-exclusive, non-transferable, limited license without fees to reproduce and distribute the Software, provided that (i) you distribute the Software complete and unmodified and only bundled as part of, and for the sole purpose of running, your Programs, (ii) the Programs add significant and primary functionality to the Software, (iii) you do not distribute additional software intended to replace any component(s) of the Software, (iv) you do not remove or alter any proprietary legends or notices contained in the Software, (v) you only distribute the Software subject to a license agreement that: (a) is a complete, unmodified reproduction of this Agreement; or (b) protects Oracle's interests consistent with the terms contained in this Agreement and that includes the notice set forth in Section H, and (vi) you agree to defend and indemnify Oracle and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Software. The license set forth in this Section C does not extend to the Software identified in Section G.

G. LIMITATIONS ON REDISTRIBUTION. You may not redistribute or otherwise transfer patches, bug fixes or updates made available by Oracle through Oracle Premier Support, including those made available under Oracle's Java SE Support program.

The "Java SE LIUM" is here, but I don't see that it has anything relevant to say: http://www.oracle.com/technetwork/java/javase/documentation/java-se-lium-2018-03-19-4421425.pdf

sjackman commented 6 years ago

Yep, looks to me like we have a license to redistribute JDK. Can we find a mirror of this file? Perhaps from Debian or Ubuntu, or these unverified hits from Google: http://ftp.osuosl.org/pub/funtoo/distfiles/oracle-java/ http://ghaffarian.net/downloads/Java/

This related gist was recently updated 17 days go. https://gist.github.com/scottvrosenthal/11187116

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

bukzor commented 6 years ago

:sadface:

iMichka commented 6 years ago

Yes, it is sad :( But also a lot of work to clean this up, and I do not have much time to spend on this. Pull requests are welcome. I am really sorry about the situation.

bukzor commented 6 years ago

@sjackman Earlier in the conversation, it looks like @iMichka and yourself decided "we should host a copy of the original file on bintray". Is that something I can do for you? I had assumed you'd need to use your own permissions.

I haven't heard of bintray. Researching it now...

sjackman commented 6 years ago

Hi, Buck. Since we and everyone have permission to redistribute Oracle JDK, I'd expect someone else to already have mirrored the file. Could you please search the Internets and see if you're able to find such a mirror? It should have an identical SHA-256. If nothing turns up, we can mirror it on Bintray. One of us Linuxbrew developers with permissions will need to do that.

bukzor commented 6 years ago

Roger. Do you only care about linux, or should I look for the osx-bin.dmg too?

iMichka commented 6 years ago

Just linux, there are no jdk formulae on mac. If we do not find stable mirror urls, just give me the url where I can download a version, I'll add it to bintray and provide you the new url.

bukzor commented 6 years ago

I found a mirror hosted by funtoo linux, below, and verified that its sha1sum is the same as the binary from oracle.

http://ftp.osuosl.org/pub/funtoo/distfiles/oracle-java/

jdk-9.0.4_linux-x64_bin (from ftp.osuosl.org).tar.gz
MD5: 41de6337d523d365dc3d9c5f862f71cc SHA1: 3e0a31a77760f87e7b73242f3faa0f95ee867983 Length: 354635831

jdk-9.0.4_linux-x64_bin.tar.gz
MD5: 41de6337d523d365dc3d9c5f862f71cc SHA1: 3e0a31a77760f87e7b73242f3faa0f95ee867983 Length: 354635831
sjackman commented 6 years ago

Cool. Thanks, Buck. Would you like to open a PR to modify the jdk formula https://github.com/Linuxbrew/homebrew-core/blob/master/Formula/jdk.rb Do the jdk@7 and jdk@8 formulae need to be similarly modified?

bukzor commented 6 years ago

I'm doing it now. Humorously, jdk@7 already has the exact edit I was about to create:

cdc97d48cc9 Formula/jdk7.rb  (VonUniGE      2017-08-01 15:52:48 +0000  8)     url "http://ftp.osuosl.org/pub/funtoo/distfiles/oracle-java/jdk-7u80-linux-x64.tar.gz"

[2018-06-17 06:01:46 PM -0700 (Sun)]$ git show cdc97d48cc9 

commit cdc97d48cc9bcaf000aed915077ca5dd549d7a10
Author: VonUniGE <VonUniGE@github.com>
Date:   Tue Aug 1 15:52:48 2017 +0000

    jdk7 1.7.0-80

    Update from jdk 1.7.0-75 to jdk 1.7.0-80. Old formula gives 404.
    Now an Oracle account is needed to download jdk7. Use a third party
    repository.

    Remove unnecessary JdkDownloadStrategy

    Closes Linuxbrew/homebrew-core#3493.

    Signed-off-by: Michka Popoff <michkapopoff@gmail.com>
sjackman commented 6 years ago

Convergent evolution! Thanks, Buck. 👍

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

bukzor commented 6 years ago

The corresponding pull request is this one:

https://github.com/Linuxbrew/homebrew-core/pull/8082

It's ready to merge, to the best of my knowledge.

sjackman commented 6 years ago

Has this issue been resolved by merging Linuxbrew/homebrew-core#8082?