From 51ee7c61c7b019c94c424e7651ddc2ce9dd27b14 Mon Sep 17 00:00:00 2001 From: Ladios Jonquil Date: Thu, 16 Jan 2014 11:58:02 +0800 Subject: [PATCH 1/3] Update condition on downloading binary file(s) Since upstream v7.45-2, it requires binary files for both architectures again. This patch updates the condition on detecting whether we need both files or just one for the version we are building against. --- oab-java.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oab-java.sh b/oab-java.sh index c732cb4..7d059c9 100755 --- a/oab-java.sh +++ b/oab-java.sh @@ -482,11 +482,11 @@ if [ "${JAVA_UPSTREAM}" == "sun-java6" ]; then else JAVA_EXT=.tar.gz fi -if grep -q ia32 ${WORK_PATH}/src/debian/rules; then - # Upstream still builds ia32 package, download both architectures +if grep -q 'srcdir.*:=.*$(arch)' ${WORK_PATH}/src/debian/rules; then + # Upstream requires binary files for both architectures JAVA_BINS="jdk-${JAVA_VER}u${JAVA_UPD}-linux-i586${JAVA_EXT} jdk-${JAVA_VER}u${JAVA_UPD}-linux-x64${JAVA_EXT}" else - # Upstream has removed ia32 package, just download the appropriate one + # Upstream requires binary file of the machine's architecture only if [ "${LSB_ARCH}" == "amd64" ]; then JAVA_BINS="jdk-${JAVA_VER}u${JAVA_UPD}-linux-x64${JAVA_EXT}" else From 70408f49e9e5b44820354b630220ca2c0c1060a7 Mon Sep 17 00:00:00 2001 From: Ladios Jonquil Date: Thu, 16 Jan 2014 13:21:58 +0800 Subject: [PATCH 2/3] Run upstream's preparing script if it exists Upstream v7.45-2 introduced a preparing script to download and inflate archives. If the version we are building against contains that script, then run it to inflate archives in order to build packages. --- oab-java.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/oab-java.sh b/oab-java.sh index 7d059c9..86b2391 100755 --- a/oab-java.sh +++ b/oab-java.sh @@ -562,6 +562,13 @@ BUILD_MESSAGE="Automated build for ${LSB_REL} using https://github.com/rraptorr/ # Change directory to the build directory cd ${WORK_PATH}/src +# Run upstream's preparing script if it exists +if [ -f prepare.sh ]; then + ncecho " [x] Inflating archives " + ./prepare.sh >> "$log" 2>&1 & + pid=$!;progress $pid +fi + # Update the changelog ncecho " [x] Updating the changelog " dch --distribution ${LSB_CODE} --force-distribution --newversion ${NEW_VERSION} --force-bad-version --urgency=${DEB_URGENCY} "${BUILD_MESSAGE}" >> "$log" 2>&1 & From 51a816a59c3ede7ab45eb40d3d14ec362e3ace32 Mon Sep 17 00:00:00 2001 From: Ladios Jonquil Date: Tue, 1 Apr 2014 02:30:51 +0800 Subject: [PATCH 3/3] Fix cookies; Add Java8 support --- oab-java.sh | 71 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 22 deletions(-) diff --git a/oab-java.sh b/oab-java.sh index 86b2391..d008edb 100755 --- a/oab-java.sh +++ b/oab-java.sh @@ -181,7 +181,7 @@ function copyright_msg() { if [ "${MODE}" == "build_docs" ]; then echo "# OAB-Java" fi - echo `basename ${0}`" v${VER} - Create a local 'apt' repository for Sun Java 6 and/or Oracle Java 7 packages." + echo `basename ${0}`" v${VER} - Create a local 'apt' repository for Sun Java 6 and/or Oracle Java 7 and/or Oracle Java 8 packages." echo echo "Copyright (c) Martin Wimpress, http://flexion.org. MIT License" echo @@ -220,6 +220,7 @@ function usage() { echo "Optional parameters" echo echo " * -7 : Build ``oracle-java7`` packages instead of ``sun-java6``" + echo " * -8 : Build ``oracle-java8`` packages instead of ``sun-java6``" echo " * -c : Remove pre-existing packages from ``${WORK_PATH}/deb`` and sources from ``${WORK_PATH}/src``." echo " * -k : Use the specified existing key instead of generating one" echo " * -s : Skip building if the packages already exist" @@ -254,6 +255,7 @@ function usage() { echo echo " * " echo " * " + echo " * " echo echo "The basic execution steps are:" echo @@ -282,6 +284,10 @@ function usage() { echo echo " sudo apt-get install oracle-java7-jre" echo + echo "Or if you ran the script with the ``-8`` option." + echo + echo " sudo apt-get install oracle-java8-jre" + echo echo "If you already have the *\"official\"* Ubuntu packages installed then you" echo "can upgrade by executing the following from a shell." echo @@ -297,7 +303,7 @@ function usage() { echo echo "## Known Issues" echo - echo " * Building Java 7 on Ubuntu Lucid 10.04 is no longer supported as the upstream scripts" + echo " * Building Java 7 or 8 on Ubuntu Lucid 10.04 is no longer supported as the upstream scripts" echo " require ``debhelper``>=8 which is not officially available for Lucid." echo " * The Oracle download servers can be horribly slow. My script caches the downloads" echo " so you only need download each file once." @@ -364,13 +370,13 @@ if [ -f $log ]; then fi # Parse the options -OPTSTRING=7bchk:st: +OPTSTRING=78bchk:st: while getopts ${OPTSTRING} OPT do case ${OPT} in - 7) + 7|8) JAVA_DEV="oracle-java" - JAVA_UPSTREAM="oracle-java7" + JAVA_UPSTREAM="oracle-java${OPT}" ;; b) build_docs;; c) BUILD_CLEAN=1;; @@ -383,8 +389,8 @@ do done shift "$(( $OPTIND - 1 ))" -if [ "${JAVA_UPSTREAM}" == "oracle-java7" ] && [ "${LSB_CODE}" == "lucid" ]; then - ncecho " [!] Building Java 7 on Ubuntu Lucid is no longer supported " +if [ "${JAVA_DEV}" == "oracle-java" ] && [ "${LSB_CODE}" == "lucid" ]; then + ncecho " [!] Building Java 7 or 8 on Ubuntu Lucid is no longer supported " cecho exitting exit 1 fi @@ -412,8 +418,12 @@ if [ "${LSB_ARCH}" == "amd64" ] && [ "${JAVA_UPSTREAM}" == "sun-java6" ]; then fi fi -if [ "${JAVA_UPSTREAM}" == "oracle-java7" ]; then - BUILD_DEPS="${BUILD_DEPS} libxrender1" +if [ "${JAVA_UPSTREAM}" == "oracle-java8" ]; then + BUILD_DEPS="${BUILD_DEPS} libx11-6 libxext6" +fi + +if [ "${JAVA_DEV}" == "oracle-java" ]; then + BUILD_DEPS="${BUILD_DEPS} libxrender1 curl" fi # Install the Java build requirements @@ -468,15 +478,24 @@ DEB_URGENCY=`head -n1 ${WORK_PATH}/src/debian/changelog | cut -d'=' -f2` JAVA_VER=`echo ${DEB_VERSION} | cut -d'.' -f1` JAVA_UPD=`echo ${DEB_VERSION} | cut -d'.' -f2 | cut -d'-' -f1` +# The first Java8 release doesn't have a u[0-9]* part +if [ "${JAVA_UPD}" == "0" ]; then + JAVA_UPD= +else + JAVA_UPD="u${JAVA_UPD}" +fi + ncecho " [x] Getting releases download page " if [ "${JAVA_UPSTREAM}" == "sun-java6" ]; then wget http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html -O /tmp/oab-download.html >> "$log" 2>&1 & -else +elif [ "${JAVA_UPSTREAM}" == "oracle-java7" ]; then wget http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html -O /tmp/oab-download.html >> "$log" 2>&1 & +else + wget http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html -O /tmp/oab-download.html >> "$log" 2>&1 & fi pid=$!;progress $pid -# Set the files we're downloading since sun-java6 and oracle-java7 differ. +# Set the files we're downloading since sun-java6 and oracle-java7/8 differ. if [ "${JAVA_UPSTREAM}" == "sun-java6" ]; then JAVA_EXT=.bin else @@ -484,16 +503,19 @@ else fi if grep -q 'srcdir.*:=.*$(arch)' ${WORK_PATH}/src/debian/rules; then # Upstream requires binary files for both architectures - JAVA_BINS="jdk-${JAVA_VER}u${JAVA_UPD}-linux-i586${JAVA_EXT} jdk-${JAVA_VER}u${JAVA_UPD}-linux-x64${JAVA_EXT}" + JAVA_BINS="jdk-${JAVA_VER}${JAVA_UPD}-linux-i586${JAVA_EXT} jdk-${JAVA_VER}${JAVA_UPD}-linux-x64${JAVA_EXT}" else # Upstream requires binary file of the machine's architecture only if [ "${LSB_ARCH}" == "amd64" ]; then - JAVA_BINS="jdk-${JAVA_VER}u${JAVA_UPD}-linux-x64${JAVA_EXT}" + JAVA_BINS="jdk-${JAVA_VER}${JAVA_UPD}-linux-x64${JAVA_EXT}" else - JAVA_BINS="jdk-${JAVA_VER}u${JAVA_UPD}-linux-i586${JAVA_EXT}" + JAVA_BINS="jdk-${JAVA_VER}${JAVA_UPD}-linux-i586${JAVA_EXT}" fi fi +# Cookies required for download +COOKIES="oraclelicense=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com" + for JAVA_BIN in ${JAVA_BINS} do # Get the download URL and size @@ -503,8 +525,6 @@ do DOWNLOAD_URL=`grep ${JAVA_BIN} /tmp/oab-download.html | cut -d'{' -f2 | cut -d',' -f3 | cut -d'"' -f4` fi DOWNLOAD_SIZE=`grep ${JAVA_BIN} /tmp/oab-download.html | cut -d'{' -f2 | cut -d',' -f2 | cut -d':' -f2 | sed 's/"//g'` - # Cookies required for download - COOKIES="oraclelicensejdk-${JAVA_VER}u${JAVA_UPD}-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com" ncecho " [x] Downloading ${JAVA_BIN} : ${DOWNLOAD_SIZE} " wget --no-check-certificate --header="Cookie: ${COOKIES}" -c "${DOWNLOAD_URL}" -O ${WORK_PATH}/pkg/${JAVA_BIN} >> "$log" 2>&1 & @@ -516,13 +536,18 @@ do done # Get JCE download index -if [ $JAVA_VER == "7" ]; then +if [ "${JAVA_VER}" == "8" ]; then + DOWNLOAD_INDEX_NO='2133166' + DOWNLOAD_INDEX_JCE='jce' +elif [ "${JAVA_VER}" == "7" ]; then DOWNLOAD_INDEX_NO='432124' + DOWNLOAD_INDEX_JCE='jce-' else DOWNLOAD_INDEX_NO='429243' + DOWNLOAD_INDEX_JCE='jce-' fi -DOWNLOAD_INDEX="technetwork/java/javase/downloads/jce-${JAVA_VER}-download-${DOWNLOAD_INDEX_NO}.html" +DOWNLOAD_INDEX="technetwork/java/javase/downloads/${DOWNLOAD_INDEX_JCE}${JAVA_VER}-download-${DOWNLOAD_INDEX_NO}.html" wget http://www.oracle.com/${DOWNLOAD_INDEX} -O /tmp/oab-download-jce.html >> "$log" 2>&1 & pid=$!;progress $pid @@ -531,11 +556,13 @@ if [ "${JAVA_UPSTREAM}" == "sun-java6" ]; then JCE_POLICY="jce_policy-6.zip" DOWNLOAD_PATH=`grep "jce[^']*-6-oth-JPR'\]\['path" /tmp/oab-download-jce.html | cut -d'=' -f2 | cut -d'"' -f2` DOWNLOAD_URL="${DOWNLOAD_PATH}${JCE_POLICY}" - COOKIES="oraclelicense=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com" -else - JCE_POLICY="UnlimitedJCEPolicyJDK7.zip" +elif [ "${JAVA_DEV}" == "oracle-java" ]; then + if [ "${JAVA_UPSTREAM}" == "oracle-java7" ]; then + JCE_POLICY="UnlimitedJCEPolicyJDK7.zip" + else + JCE_POLICY="jce_policy-8.zip" + fi DOWNLOAD_URL=`grep ${JCE_POLICY} /tmp/oab-download-jce.html | cut -d'{' -f2 | cut -d',' -f3 | cut -d'"' -f4` - COOKIES="oraclelicensejce-7-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com" fi DOWNLOAD_SIZE=`grep ${JCE_POLICY} /tmp/oab-download-jce.html | cut -d'{' -f2 | cut -d',' -f2 | cut -d'"' -f4`