ff9254e
#!/bin/bash
ff9254e
f05b6fe
# Generates the 'source tarball' for JDK 8 projects.
f05b6fe
#
485496c
# Usage: generate_source_tarball.sh project_name repo_name tag
f05b6fe
#
f05b6fe
# Examples:
d9f8049
#  sh generate_source_tarball.sh jdk8u jdk8u40 jdk8u40-b25
485496c
#   ./generate_source_tarball.sh jdk8 jdk8 jdk8-b79
485496c
#   ./generate_source_tarball.sh jdk8u jdk8u jdk8u5-b13
485496c
#   ./generate_source_tarball.sh aarch64-port jdk8 aarch64-${DATE}
f05b6fe
#
f05b6fe
# This script creates a single source tarball out of the repository
485496c
# based on the given tag and removes code not allowed in fedora. For
dcacce5
# consistency, the source tarball will always contain 'openjdk' as the top
485496c
# level folder.
f05b6fe
Jiri Vanek e19dada
set -e
Jiri Vanek e19dada
485496c
PROJECT_NAME="$1"
485496c
REPO_NAME="$2"
485496c
VERSION="$3"
485496c
OPENJDK_URL=http://hg.openjdk.java.net
ff9254e
485496c
if [[ "${PROJECT_NAME}" = "" ]] ; then
485496c
    echo "No repository specified."
485496c
    exit -1
485496c
fi
f05b6fe
if [[ "${REPO_NAME}" = "" ]] ; then
f05b6fe
    echo "No repository specified."
f05b6fe
    exit -1
f05b6fe
fi
f05b6fe
if [[ "${VERSION}" = "" ]]; then
f05b6fe
    echo "No version/tag specified."
ff9254e
    exit -1;
ff9254e
fi
ff9254e
f05b6fe
mkdir "${REPO_NAME}"
f05b6fe
pushd "${REPO_NAME}"
f05b6fe
485496c
REPO_ROOT="${OPENJDK_URL}/${PROJECT_NAME}/${REPO_NAME}"
f05b6fe
f05b6fe
wget "${REPO_ROOT}/archive/${VERSION}.tar.gz"
f05b6fe
tar xf "${VERSION}.tar.gz"
f05b6fe
rm  "${VERSION}.tar.gz"
f05b6fe
15a93de
mv "${REPO_NAME}-${VERSION}" openjdk
15a93de
pushd openjdk
f05b6fe
26b1c68
repos="corba hotspot jdk jaxws jaxp langtools nashorn"
26b1c68
if [ aarch64-port = $PROJECT_NAME ] ; then
26b1c68
repos="hotspot"
26b1c68
fi;
26b1c68
26b1c68
for subrepo in $repos
Jiri Vanek e19dada
do
f05b6fe
    wget "${REPO_ROOT}/${subrepo}/archive/${VERSION}.tar.gz"
f05b6fe
    tar xf "${VERSION}.tar.gz"
f05b6fe
    rm "${VERSION}.tar.gz"
f05b6fe
    mv "${subrepo}-${VERSION}" "${subrepo}"
Jiri Vanek work 2acb4a2
done
f05b6fe
15a93de
echo "Removing EC source code we don't build"
15a93de
rm -vrf jdk/src/share/native/sun/security/ec/impl
15a93de
15a93de
echo "Syncing EC list with NSS"
15a93de
patch -Np0 < ../../pr2126.patch
15a93de
f05b6fe
popd
f05b6fe
15a93de
tar cJf ${REPO_NAME}-${VERSION}.tar.xz openjdk
f05b6fe
f05b6fe
popd
f05b6fe
f05b6fe
mv "${REPO_NAME}/${REPO_NAME}-${VERSION}.tar.xz" .