|
Alex Kashchenko |
af80df1 |
#!/bin/bash
|
|
Alex Kashchenko |
af80df1 |
# Generates the 'source tarball' for JDK projects.
|
|
Alex Kashchenko |
af80df1 |
#
|
|
Alex Kashchenko |
af80df1 |
# Example:
|
|
Alex Kashchenko |
af80df1 |
# When used from local repo set REPO_ROOT pointing to file:// with your repo
|
|
Alex Kashchenko |
af80df1 |
# if your local repo follows upstream forests conventions, you may be enough by setting OPENJDK_URL
|
|
Alex Kashchenko |
af80df1 |
# if you wont to use local copy of patch PR2126 set path to it to PR2126 variable
|
|
Alex Kashchenko |
af80df1 |
#
|
|
Alex Kashchenko |
af80df1 |
# In any case you have to set PROJECT_NAME REPO_NAME and VERSION. eg:
|
|
Alex Kashchenko |
af80df1 |
# PROJECT_NAME=jdk
|
|
Alex Kashchenko |
af80df1 |
# REPO_NAME=jdk
|
|
Alex Kashchenko |
af80df1 |
# VERSION=tip
|
|
Alex Kashchenko |
af80df1 |
# or to eg prepare systemtap:
|
|
Alex Kashchenko |
af80df1 |
# icedtea7's jstack and other tapsets
|
|
Alex Kashchenko |
af80df1 |
# VERSION=6327cf1cea9e
|
|
Alex Kashchenko |
af80df1 |
# REPO_NAME=icedtea7-2.6
|
|
Alex Kashchenko |
af80df1 |
# PROJECT_NAME=release
|
|
Alex Kashchenko |
af80df1 |
# OPENJDK_URL=http://icedtea.classpath.org/hg/
|
|
Alex Kashchenko |
af80df1 |
# TO_COMPRESS="*/tapset"
|
|
Alex Kashchenko |
af80df1 |
#
|
|
Alex Kashchenko |
af80df1 |
# They are used to create correct name and are used in construction of sources url (unless REPO_ROOT is set)
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
# This script creates a single source tarball out of the repository
|
|
Alex Kashchenko |
af80df1 |
# based on the given tag and removes code not allowed in fedora/rhel. For
|
|
Alex Kashchenko |
af80df1 |
# consistency, the source tarball will always contain 'openjdk' as the top
|
|
Alex Kashchenko |
af80df1 |
# level folder, name is created, based on parameter
|
|
Alex Kashchenko |
af80df1 |
#
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
if [ ! "x$PR2126" = "x" ] ; then
|
|
Alex Kashchenko |
af80df1 |
if [ ! -f "$PR2126" ] ; then
|
|
Alex Kashchenko |
af80df1 |
echo "You have specified PR2126 as $PR2126 but it does not exists. exiting"
|
|
Alex Kashchenko |
af80df1 |
exit 1
|
|
Alex Kashchenko |
af80df1 |
fi
|
|
Alex Kashchenko |
af80df1 |
fi
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
set -e
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
OPENJDK_URL_DEFAULT=http://hg.openjdk.java.net
|
|
Alex Kashchenko |
af80df1 |
COMPRESSION_DEFAULT=xz
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
if [ "x$1" = "xhelp" ] ; then
|
|
Alex Kashchenko |
af80df1 |
echo -e "Behaviour may be specified by setting the following variables:\n"
|
|
Alex Kashchenko |
af80df1 |
echo "VERSION - the version of the specified OpenJDK project"
|
|
Alex Kashchenko |
af80df1 |
echo "PROJECT_NAME -- the name of the OpenJDK project being archived (optional; only needed by defaults)"
|
|
Alex Kashchenko |
af80df1 |
echo "REPO_NAME - the name of the OpenJDK repository (optional; only needed by defaults)"
|
|
Alex Kashchenko |
af80df1 |
echo "OPENJDK_URL - the URL to retrieve code from (optional; defaults to ${OPENJDK_URL_DEFAULT})"
|
|
Alex Kashchenko |
af80df1 |
echo "COMPRESSION - the compression type to use (optional; defaults to ${COMPRESSION_DEFAULT})"
|
|
Alex Kashchenko |
af80df1 |
echo "FILE_NAME_ROOT - name of the archive, minus extensions (optional; defaults to PROJECT_NAME-REPO_NAME-VERSION)"
|
|
Alex Kashchenko |
af80df1 |
echo "REPO_ROOT - the location of the Mercurial repository to archive (optional; defaults to OPENJDK_URL/PROJECT_NAME/REPO_NAME)"
|
|
Alex Kashchenko |
af80df1 |
echo "TO_COMPRESS - what part of clone to pack (default is openjdk)"
|
|
Alex Kashchenko |
af80df1 |
echo "PR2126 - the path to the PR2126 patch to apply (optional; downloaded if unavailable)"
|
|
Alex Kashchenko |
af80df1 |
exit 1;
|
|
Alex Kashchenko |
af80df1 |
fi
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
if [ "x$VERSION" = "x" ] ; then
|
|
Alex Kashchenko |
af80df1 |
echo "No VERSION specified"
|
|
Alex Kashchenko |
af80df1 |
exit -2
|
|
Alex Kashchenko |
af80df1 |
fi
|
|
Alex Kashchenko |
af80df1 |
echo "Version: ${VERSION}"
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
# REPO_NAME is only needed when we default on REPO_ROOT and FILE_NAME_ROOT
|
|
Alex Kashchenko |
af80df1 |
if [ "x$FILE_NAME_ROOT" = "x" -o "x$REPO_ROOT" = "x" ] ; then
|
|
Alex Kashchenko |
af80df1 |
if [ "x$PROJECT_NAME" = "x" ] ; then
|
|
Alex Kashchenko |
af80df1 |
echo "No PROJECT_NAME specified"
|
|
Alex Kashchenko |
af80df1 |
exit -1
|
|
Alex Kashchenko |
af80df1 |
fi
|
|
Alex Kashchenko |
af80df1 |
echo "Project name: ${PROJECT_NAME}"
|
|
Alex Kashchenko |
af80df1 |
if [ "x$REPO_NAME" = "x" ] ; then
|
|
Alex Kashchenko |
af80df1 |
echo "No REPO_NAME specified"
|
|
Alex Kashchenko |
af80df1 |
exit -3
|
|
Alex Kashchenko |
af80df1 |
fi
|
|
Alex Kashchenko |
af80df1 |
echo "Repository name: ${REPO_NAME}"
|
|
Alex Kashchenko |
af80df1 |
fi
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
if [ "x$OPENJDK_URL" = "x" ] ; then
|
|
Alex Kashchenko |
af80df1 |
OPENJDK_URL=${OPENJDK_URL_DEFAULT}
|
|
Alex Kashchenko |
af80df1 |
echo "No OpenJDK URL specified; defaulting to ${OPENJDK_URL}"
|
|
Alex Kashchenko |
af80df1 |
else
|
|
Alex Kashchenko |
af80df1 |
echo "OpenJDK URL: ${OPENJDK_URL}"
|
|
Alex Kashchenko |
af80df1 |
fi
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
if [ "x$COMPRESSION" = "x" ] ; then
|
|
Alex Kashchenko |
af80df1 |
# rhel 5 needs tar.gz
|
|
Alex Kashchenko |
af80df1 |
COMPRESSION=${COMPRESSION_DEFAULT}
|
|
Alex Kashchenko |
af80df1 |
fi
|
|
Alex Kashchenko |
af80df1 |
echo "Creating a tar.${COMPRESSION} archive"
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
if [ "x$FILE_NAME_ROOT" = "x" ] ; then
|
|
Alex Kashchenko |
af80df1 |
FILE_NAME_ROOT=${PROJECT_NAME}-${REPO_NAME}-${VERSION}
|
|
Alex Kashchenko |
af80df1 |
echo "No file name root specified; default to ${FILE_NAME_ROOT}"
|
|
Alex Kashchenko |
af80df1 |
fi
|
|
Alex Kashchenko |
af80df1 |
if [ "x$REPO_ROOT" = "x" ] ; then
|
|
Alex Kashchenko |
af80df1 |
REPO_ROOT="${OPENJDK_URL}/${PROJECT_NAME}/${REPO_NAME}"
|
|
Alex Kashchenko |
af80df1 |
echo "No repository root specified; default to ${REPO_ROOT}"
|
|
Alex Kashchenko |
af80df1 |
fi;
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
if [ "x$TO_COMPRESS" = "x" ] ; then
|
|
Alex Kashchenko |
af80df1 |
TO_COMPRESS="openjdk"
|
|
Alex Kashchenko |
af80df1 |
echo "No to be compressed targets specified, ; default to ${TO_COMPRESS}"
|
|
Alex Kashchenko |
af80df1 |
fi;
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
if [ -d ${FILE_NAME_ROOT} ] ; then
|
|
Alex Kashchenko |
af80df1 |
echo "exists exists exists exists exists exists exists "
|
|
Alex Kashchenko |
af80df1 |
echo "reusing reusing reusing reusing reusing reusing "
|
|
Alex Kashchenko |
af80df1 |
echo ${FILE_NAME_ROOT}
|
|
Alex Kashchenko |
af80df1 |
else
|
|
Alex Kashchenko |
af80df1 |
mkdir "${FILE_NAME_ROOT}"
|
|
Alex Kashchenko |
af80df1 |
pushd "${FILE_NAME_ROOT}"
|
|
Alex Kashchenko |
af80df1 |
echo "Cloning ${VERSION} root repository from ${REPO_ROOT}"
|
|
Alex Kashchenko |
af80df1 |
hg clone ${REPO_ROOT} openjdk -r ${VERSION}
|
|
Alex Kashchenko |
af80df1 |
popd
|
|
Alex Kashchenko |
af80df1 |
fi
|
|
Alex Kashchenko |
af80df1 |
pushd "${FILE_NAME_ROOT}"
|
|
Alex Kashchenko |
af80df1 |
if [ -d openjdk/src ]; then
|
|
Alex Kashchenko |
af80df1 |
pushd openjdk
|
|
Alex Kashchenko |
af80df1 |
echo "Removing EC source code we don't build"
|
|
Alex Kashchenko |
af80df1 |
CRYPTO_PATH=src/jdk.crypto.ec/share/native/libsunec/impl
|
|
Alex Kashchenko |
af80df1 |
rm -vrf $CRYPTO_PATH
|
|
Alex Kashchenko |
af80df1 |
echo "Syncing EC list with NSS"
|
|
Alex Kashchenko |
af80df1 |
if [ "x$PR2126" = "x" ] ; then
|
|
Alex Kashchenko |
af80df1 |
# orriginally for 8:
|
|
Alex Kashchenko |
af80df1 |
# get pr2126.patch (from http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=8d2c9a898f50) from most correct tag
|
|
Alex Kashchenko |
af80df1 |
# Do not push it or publish it (see http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2126)
|
|
Alex Kashchenko |
af80df1 |
# there is currnetly no "upstram version of this patch, hardcoding custom version
|
|
Alex Kashchenko |
af80df1 |
PR2126="../../pr2126-11.patch"
|
|
Alex Kashchenko |
af80df1 |
fi;
|
|
Alex Kashchenko |
af80df1 |
echo "Applying ${PR2126}"
|
|
Alex Kashchenko |
af80df1 |
patch -Np1 < $PR2126
|
|
Alex Kashchenko |
af80df1 |
find . -name '*.orig' -exec rm -vf '{}' ';'
|
|
Alex Kashchenko |
af80df1 |
popd
|
|
Alex Kashchenko |
af80df1 |
fi
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
echo "Compressing remaining forest"
|
|
Alex Kashchenko |
af80df1 |
if [ "X$COMPRESSION" = "Xxz" ] ; then
|
|
Alex Kashchenko |
af80df1 |
SWITCH=cJf
|
|
Alex Kashchenko |
af80df1 |
else
|
|
Alex Kashchenko |
af80df1 |
SWITCH=czf
|
|
Alex Kashchenko |
af80df1 |
fi
|
|
Alex Kashchenko |
af80df1 |
tar --exclude-vcs -$SWITCH ${FILE_NAME_ROOT}.tar.${COMPRESSION} $TO_COMPRESS
|
|
Alex Kashchenko |
af80df1 |
mv ${FILE_NAME_ROOT}.tar.${COMPRESSION} ..
|
|
Alex Kashchenko |
af80df1 |
popd
|
|
Alex Kashchenko |
af80df1 |
echo "Done. You may want to remove the uncompressed version - $FILE_NAME_ROOT."
|
|
Alex Kashchenko |
af80df1 |
|
|
Alex Kashchenko |
af80df1 |
|