Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Support for Java 7 updates >= 10 #6

Merged
merged 3 commits into from

2 participants

Emmanuel Bourg cedricpineau
Emmanuel Bourg

The current detection code assumes the Java 7 update has a single digit. I reworked this part of the code with some regular expressions to support any number of digits.

This patch also aligns the version scheme with the sun-java6 package (i.e version 6.30 for Java 6u30 instead of 1.6.0+update30)

cedricpineau
Owner

I prefer not to merge this one as it goes a bit to far in code reduction with several fallbacks :

  • min_size is not set per binary any more
  • 1.6.0+updateXX seems to be the Debian scheme and I want to keep this scripts with the one I use in the debian Java-package.
  • I'm not sure BASH_REMATCH works with dash and I would like to keep this as a goal
  • Code is longer but clearer the way it was, easier to add new entries to (my feeling)

I'll fix the two digit Java 7 update with a great duplication of entries :-)

Emmanuel Bourg
  • How is determined min_size? Could it be computed with the size of the archive instead of hardcoding the value in the script?

  • Regarding the version, I simply followed the scheme of the sun-java6 package. Since the packages generated by java-package will most probably replace sun-java6 I think it's wise to follow this pattern.

  • I confirm BASH_REMATCH doesn't work with dash, however there are other bashisms that prevent the script from running with dash. I thought that was ok as long as the generated packages can be installed with dash.

  • The purpose of the patch is to not add new entries in the future, it could work with jdk10u23 in 15 years ;)

cedricpineau cedricpineau reopened this
cedricpineau
Owner
  • Yes it probably can. It's approximately the size of expanded binary archive. The goal is just to check disk space.
  • It could. After all, current java-package output is not compliant with openjdk scheme on Debian neither..
  • Well, it's a goal, I know it's not dash compliant right now.
  • Oh yes, I didn't notice that :-/ ! Ok then, let's go. I'll see what can fit in the Debian packaged version later.
cedricpineau cedricpineau merged commit 2e7605e into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 6, 2012
  1. Emmanuel Bourg
  2. Emmanuel Bourg
  3. Emmanuel Bourg

    Improved the detection of the JRE/JDK version (supports 2 digits Java…

    ebourg authored
    … 7 updates)
    
    Changed the version of the generated package from 1.6.0+update30 to 6.30
This page is out of date. Refresh to see the latest.
Showing with 91 additions and 108 deletions.
  1. +30 −39 lib/oracle-j2re.sh
  2. +17 −16 lib/oracle-j2sdk-doc.sh
  3. +44 −53 lib/oracle-j2sdk.sh
69 lib/oracle-j2re.sh
View
@@ -1,53 +1,44 @@
# Detect product
j2se_detect_oracle_j2re=oracle_j2re_detect
oracle_j2re_detect() {
- local found=
+
+ if [[ $archive_name =~ jre-([0-9]+)u([0-9]+)-linux-(i586|x64)\.(bin|tar\.gz) ]]
+ then
+ j2se_release=${BASH_REMATCH[1]}
+ j2se_update=${BASH_REMATCH[2]}
+ j2se_arch=${BASH_REMATCH[3]}
+ j2se_version=$j2se_release.$j2se_update
+ j2se_priority=$((310 + $j2se_release - 1))
+ j2se_expected_min_size=95 #Mb
+
+ # check if the architecture matches
+ let compatible=1
- case "${DEB_BUILD_ARCH:-$DEB_BUILD_GNU_TYPE}" in
- i386|i486-linux-gnu)
- case "$archive_name" in
- "jre-6u"[0-9][0-9]"-linux-i586.bin") # SUPPORTED
- j2se_version=1.6.0+update${archive_name:6:2}${revision}
- j2se_expected_min_size=16 #Mb
- j2se_priority=314
- found=true
- ;;
- "jre-7u"[0-9]"-linux-i586.tar.gz") # SUPPORTED
- j2se_version=1.7.0+update${archive_name:6:1}${revision}
- j2se_expected_min_size=94 #Mb
- j2se_priority=316
- found=true
- ;;
- esac
- ;;
- amd64|x86_64-linux-gnu)
- case "$archive_name" in
- "jre-6u"[0-9][0-9]"-linux-x64.bin") # SUPPORTED
- j2se_version=1.6.0+update${archive_name:6:2}${revision}
- j2se_expected_min_size=16 #Mb
- j2se_priority=314
- found=true
- ;;
- "jre-7u"[0-9]"-linux-x64.tar.gz") # SUPPORTED
- j2se_version=1.7.0+update${archive_name:6:1}${revision}
- j2se_expected_min_size=88 #Mb
- j2se_priority=316
- found=true
- ;;
- esac
- ;;
- esac
- if [[ -n "$found" ]]; then
+ case "${DEB_BUILD_ARCH:-$DEB_BUILD_GNU_TYPE}" in
+ i386|i486-linux-gnu)
+ if [[ "$j2se_arch" != "i586" ]]; then compatible=0; fi
+ ;;
+ amd64|x86_64-linux-gnu)
+ if [[ "$j2se_arch" != "x64" ]]; then compatible=0; fi
+ ;;
+ esac
+
+ if [[ $compatible == 0 ]]
+ then
+ echo "The archive $archive_name is not supported on the ${DEB_BUILD_ARCH} architecture"
+ return
+ fi
+
+
cat << EOF
Detected product:
Java(TM) Runtime Environment (JRE)
- Standard Edition, Version $j2se_version
+ Standard Edition, Version $j2se_release Update $j2se_update
Oracle(TM)
EOF
if read_yn "Is this correct [Y/n]: "; then
j2se_found=true
- j2se_release="${j2se_version:2:1}"
j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
j2se_vendor="oracle"
j2se_title="Java(TM) JRE, Standard Edition, Oracle(TM)"
@@ -61,7 +52,7 @@ EOF
oracle_jre_lib_hl="jexec"
j2re_run
fi
- fi
+ fi
}
oracle_j2re_install() {
33 lib/oracle-j2sdk-doc.sh
View
@@ -1,29 +1,30 @@
# Detect product
oracle_j2sdk_doc_detect() {
- local found=
- case "$archive_name" in
- "jdk-6u"[0-9][0-9]"-apidocs.zip") # SUPPORTED
- j2se_version=1.6.0+update${archive_name:6:2}${revision}
- j2se_expected_min_size=44 #Mb
- found=true
- ;;
- "jdk-7u"[0-9]"-apidocs.zip") # SUPPORTED
- j2se_version=1.7.0+update${archive_name:6:1}${revision}
- j2se_expected_min_size=290 #Mb
- found=true
- ;;
- esac
- if [[ -n "$found" ]]; then
+
+ if [[ $archive_name =~ jdk-([0-9]+)u([0-9]+)-apidocs\.zip ]]
+ then
+ j2se_release=${BASH_REMATCH[1]}
+ j2se_update=${BASH_REMATCH[2]}
+ j2se_version=$j2se_release.$j2se_update
+
+ case "$j2se_release" in
+ 6) # JDK 6
+ j2se_expected_min_size=44 #Mb
+ ;;
+ *) # JDK 7 and higher
+ j2se_expected_min_size=290 #Mb
+ ;;
+ esac
+
cat << EOF
Detected product:
Java(TM) Development Kit (JDK) Documentation
- Standard Edition, Version $j2se_version
+ Standard Edition, Version $j2se_release Update $j2se_update
Oracle(TM)
EOF
if read_yn "Is this correct [Y/n]: "; then
j2se_found=true
- j2se_release="${j2se_version:2:1}"
j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
j2se_vendor="oracle"
j2se_title="Java(TM) JDK, Standard Edition, Oracle(TM) Documentation"
97 lib/oracle-j2sdk.sh
View
@@ -1,68 +1,59 @@
# Detect product
j2se_detect_oracle_j2sdk=oracle_j2sdk_detect
oracle_j2sdk_detect() {
- local found=
+
+ if [[ $archive_name =~ jdk-([0-9]+)u([0-9]+)-linux-(i586|x64)\.(bin|tar\.gz) ]]
+ then
+ j2se_release=${BASH_REMATCH[1]}
+ j2se_update=${BASH_REMATCH[2]}
+ j2se_arch=${BASH_REMATCH[3]}
+ j2se_version=$j2se_release.$j2se_update
+ j2se_priority=$((310 + $j2se_release))
+ j2se_expected_min_size=130 #Mb
+
+ # check if the architecture matches
+ let compatible=1
- case "${DEB_BUILD_ARCH:-$DEB_BUILD_GNU_TYPE}" in
- i386|i486-linux-gnu)
- case "$archive_name" in
- "jdk-6u"[0-9][0-9]"-linux-i586.bin") # SUPPORTED
- j2se_version=1.6.0+update${archive_name:6:2}${revision}
- j2se_expected_min_size=130 #Mb
- j2se_priority=315
- found=true
- ;;
- "jdk-7u"[0-9]"-linux-i586.tar.gz") # SUPPORTED
- j2se_version=1.7.0+update${archive_name:6:1}${revision}
- j2se_expected_min_size=190 #Mb
- j2se_priority=317
- found=true
- ;;
- esac
- ;;
- amd64|x86_64-linux-gnu)
- case "$archive_name" in
- "jdk-6u"[0-9][0-9]"-linux-x64.bin") # SUPPORTED
- j2se_version=1.6.0+update${archive_name:6:2}${revision}
- j2se_expected_min_size=130 #Mb
- j2se_priority=315
- found=true
- ;;
- "jdk-7u"[0-9]"-linux-x64.tar.gz") # SUPPORTED
- j2se_version=1.7.0+update${archive_name:6:1}${revision}
- j2se_expected_min_size=180 #Mb
- j2se_priority=317
- found=true
- ;;
- esac
- ;;
- esac
- if [[ -n "$found" ]]; then
- cat << EOF
+ case "${DEB_BUILD_ARCH:-$DEB_BUILD_GNU_TYPE}" in
+ i386|i486-linux-gnu)
+ if [[ "$j2se_arch" != "i586" ]]; then compatible=0; fi
+ ;;
+ amd64|x86_64-linux-gnu)
+ if [[ "$j2se_arch" != "x64" ]]; then compatible=0; fi
+ ;;
+ esac
+
+ if [[ $compatible == 0 ]]
+ then
+ echo "The archive $archive_name is not supported on the ${DEB_BUILD_ARCH} architecture"
+ return
+ fi
+
+
+ cat << EOF
Detected product:
Java(TM) Development Kit (JDK)
- Standard Edition, Version $j2se_version
+ Standard Edition, Version $j2se_release Update $j2se_update
Oracle(TM)
EOF
if read_yn "Is this correct [Y/n]: "; then
- j2se_found=true
- j2se_release="${j2se_version:2:1}"
- j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
- j2se_vendor="oracle"
- j2se_title="Java(TM) JDK, Standard Edition, Oracle(TM)"
+ j2se_found=true
+ j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
+ j2se_vendor="oracle"
+ j2se_title="Java(TM) JDK, Standard Edition, Oracle(TM)"
- j2se_install=oracle_j2sdk_install
- j2se_remove=oracle_j2sdk_remove
- j2se_jinfo=oracle_j2sdk_jinfo
- oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
- oracle_jre_bin_jre="javaws policytool"
- oracle_no_man_jre_bin_jre="ControlPanel"
- oracle_jre_lib_hl="jexec"
- oracle_bin_jdk="appletviewer extcheck idlj jar jarsigner javac javadoc javah javap jconsole jdb jinfo jmap jps jsadebugd jstack jstat jstatd native2ascii rmic serialver"
- j2sdk_run
+ j2se_install=oracle_j2sdk_install
+ j2se_remove=oracle_j2sdk_remove
+ j2se_jinfo=oracle_j2sdk_jinfo
+ oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
+ oracle_jre_bin_jre="javaws policytool"
+ oracle_no_man_jre_bin_jre="ControlPanel"
+ oracle_jre_lib_hl="jexec"
+ oracle_bin_jdk="appletviewer extcheck idlj jar jarsigner javac javadoc javah javap jconsole jdb jinfo jmap jps jsadebugd jstack jstat jstatd native2ascii rmic serial$
+ j2sdk_run
fi
- fi
+ fi
}
oracle_j2sdk_install() {
Something went wrong with that request. Please try again.