Make source tarballs reproducible and support construction in a temporary directory.

Move to upstream tag style (shenandoah8ux-by) in preparation for eventually moving back to official sources

- generate_source_tarball.sh: Add WITH_TEMP environment variable
- generate_source_tarball.sh: Multithread xz on all available cores
- generate_source_tarball.sh: Add OPENJDK_LATEST environment variable
- generate_source_tarball.sh: Update comment about tarball naming
- generate_source_tarball.sh: Reformat comment header
- generate_source_tarball.sh: Reformat and update help output
- generate_source_tarball.sh: Do a shallow clone, for speed
- generate_source_tarball.sh: Eliminate some removal prompting
- generate_source_tarball.sh: Make tarball reproducible
- generate_source_tarball.sh: Prefix temporary directory with temp-
- generate_source_tarball.sh: Remove temporary directory exit conditions
- generate_source_tarball.sh: Rename JCONSOLE_JS_PATCH{,_DEFAULT} to JCONSOLE_PATCH{,_DEFAULT} for brevity
- generate_source_tarball.sh: Adapt OPENJDK_LATEST logic to work with 8u Shenandoah fork
- generate_source_tarball.sh: Adapt version logic to work with 8u

Related: RHEL-30925
This commit is contained in:
Andrew Hughes 2024-03-29 17:02:54 +00:00
parent a3b430bfb5
commit dcb5dc7a21
4 changed files with 140 additions and 58 deletions

1
.gitignore vendored
View File

@ -300,3 +300,4 @@
/openjdk-shenandoah-jdk8u-shenandoah-jdk8u402-b05.tar.xz /openjdk-shenandoah-jdk8u-shenandoah-jdk8u402-b05.tar.xz
/openjdk-shenandoah-jdk8u-shenandoah-jdk8u402-b06.tar.xz /openjdk-shenandoah-jdk8u-shenandoah-jdk8u402-b06.tar.xz
/openjdk-shenandoah-jdk8u-shenandoah-jdk8u412-b01.tar.xz /openjdk-shenandoah-jdk8u-shenandoah-jdk8u412-b01.tar.xz
/shenandoah8u412-b01.tar.xz

View File

@ -1,33 +1,43 @@
#!/bin/bash #!/bin/bash
# Generates the 'source tarball' for JDK 8 projects. # Generates the 'source tarball' for JDK 8 projects.
# #
# Example: # Example 1:
# When used from local repo set REPO_ROOT pointing to file:// with your repo # When used from local repo set REPO_ROOT pointing to file:// with your repo.
# If your local repo follows upstream forests conventions, it may be enough to set OPENJDK_URL # If your local repo follows upstream forests conventions, it may be enough to
# set OPENJDK_URL.
#
# Example 2:
# This will read the OpenJDK feature version from the spec file, then create a
# tarball from the most recent tag for that version in the upstream Git
# repository.
#
# $ OPENJDK_LATEST=1 ./generate_source_tarball.sh
# [...]
# Tarball is: temp-generated-source-tarball-ujD/openjdk-17.0.10+6-ea.tar.xz
#
# Unless you use OPENJDK_LATEST, you have to set PROJECT_NAME, REPO_NAME and
# VERSION, e.g.:
# #
# In any case you have to set PROJECT_NAME REPO_NAME and VERSION. eg:
# PROJECT_NAME=openjdk # PROJECT_NAME=openjdk
# REPO_NAME=shenandoah-jdk8u # REPO_NAME=shenandoah-jdk8u
# VERSION=HEAD # VERSION=HEAD
# #
# They are used to create correct name and are used in construction of sources url (unless REPO_ROOT is set) # They are used to create correct name and are used in construction of sources
# URL (unless REPO_ROOT is set).
# This script creates a single source tarball out of the repository
# based on the given tag and removes code not allowed in fedora/rhel. For
# consistency, the source tarball will always contain 'openjdk' as the top
# level folder, name is created, based on parameter
# #
# This script creates a single source tarball out of the repository based on the
# given tag and removes code not allowed in Fedora/RHEL.
SCRIPT_DIR=$(dirname $0) SCRIPT_DIR=$(dirname $0)
JCONSOLE_JS_PATCH_DEFAULT=${SCRIPT_DIR}/jconsole-plugin.patch JCONSOLE_PATCH_DEFAULT=${SCRIPT_DIR}/jconsole-plugin.patch
if [ "x${JCONSOLE_JS_PATCH}" != "x" ] ; then if [ "x${JCONSOLE_PATCH}" != "x" ] ; then
if [ ! -f "${JCONSOLE_JS_PATCH}" ] ; then if [ ! -f "${JCONSOLE_PATCH}" ] ; then
echo "You have specified the jconsole.js patch as ${JCONSOLE_JS_PATCH} but it does not exist. Exiting."; echo "You have specified the jconsole.js patch as ${JCONSOLE_PATCH} but it does not exist. Exiting.";
exit 2; exit 2;
fi fi
else else
JCONSOLE_JS_PATCH=${JCONSOLE_JS_PATCH_DEFAULT} JCONSOLE_PATCH=${JCONSOLE_PATCH_DEFAULT}
fi fi
set -e set -e
@ -35,43 +45,81 @@ set -e
OPENJDK_URL_DEFAULT=https://github.com OPENJDK_URL_DEFAULT=https://github.com
COMPRESSION_DEFAULT=xz COMPRESSION_DEFAULT=xz
if [ "x$1" = "xhelp" ] ; then if [ "$1" = "help" ] ; then
echo -e "Behaviour may be specified by setting the following variables:\n" echo "Behaviour may be specified by setting the following variables:"
echo "VERSION - the version of the specified OpenJDK project" echo
echo "PROJECT_NAME -- the name of the OpenJDK project being archived (optional; only needed by defaults)" echo "VERSION - the version of the specified OpenJDK project"
echo "REPO_NAME - the name of the OpenJDK repository (optional; only needed by defaults)" echo " (required unless OPENJDK_LATEST is set)"
echo "OPENJDK_URL - the URL to retrieve code from (optional; defaults to ${OPENJDK_URL_DEFAULT})" echo "PROJECT_NAME - the name of the OpenJDK project being archived"
echo "COMPRESSION - the compression type to use (optional; defaults to ${COMPRESSION_DEFAULT})" echo " (needed to compute REPO_ROOT and/or"
echo "FILE_NAME_ROOT - name of the archive, minus extensions (optional; defaults to PROJECT_NAME-REPO_NAME-VERSION)" echo " FILE_NAME_ROOT automatically;"
echo "REPO_ROOT - the location of the Git repository to archive (optional; defaults to OPENJDK_URL/PROJECT_NAME/REPO_NAME)" echo " optional if they are set explicitly)"
echo "JCONSOLE_JS_PATCH - the path to a patch to fix non-availiability of jconsole.js (optional; defaults to ${JCONSOLE_JS_PATCH_DEFAULT})" echo "REPO_NAME - the name of the OpenJDK repository"
echo "BOOT_JDK - the bootstrap JDK to satisfy the configure run" echo " (needed to compute REPO_ROOT automatically;"
echo " optional if REPO_ROOT is set explicitly)"
echo "OPENJDK_URL - the URL to retrieve code from"
echo " (defaults to ${OPENJDK_URL_DEFAULT})"
echo "COMPRESSION - the compression type to use"
echo " (defaults to ${COMPRESSION_DEFAULT})"
echo "FILE_NAME_ROOT - name of the archive, minus extensions"
echo " (defaults to PROJECT_NAME-VERSION)"
echo "REPO_ROOT - the location of the Git repository to archive"
echo " (defaults to OPENJDK_URL/PROJECT_NAME/REPO_NAME.git)"
echo "JCONSOLE_PATCH - the path to a patch to fix non-availiability of"
echo " jconsole.js (optional; defaults to ${JCONSOLE_PATCH_DEFAULT})"
echo "BOOT_JDK - the bootstrap JDK to satisfy the configure run"
echo " (defaults to packaged JDK version)"
echo "WITH_TEMP - run in a temporary directory"
echo " (defaults to disabled)"
echo "OPENJDK_LATEST - deduce VERSION from most recent upstream tag"
echo " (implies WITH_TEMP, computes everything else"
echo " automatically; Note: accesses network to read"
echo " tag list from remote Git repository)"
exit 1; exit 1;
fi fi
if [ "$OPENJDK_LATEST" != "" ] ; then
FEATURE_VERSION=$(echo '%majorver' \
| rpmspec --shell ./*.spec 2>/dev/null \
| grep --after-context 1 majorver \
| tail --lines 1)
PROJECT_NAME=openjdk
REPO_NAME=shenandoah-jdk"${FEATURE_VERSION}"u
# FIXME: Temporarily use private fork until main repository is in sync
VERSION=$(git ls-remote --tags --refs --sort=-version:refname \
"${OPENJDK_URL_DEFAULT}/gnu-andrew/${REPO_NAME}.git" \
"shenandoah${FEATURE_VERSION}u*" \
| head --lines 1 | cut --characters 52-)
FILE_NAME_ROOT=${VERSION}
WITH_TEMP=1
fi
if [ "x$VERSION" = "x" ] ; then if [ "$WITH_TEMP" != "" ] ; then
pushd "$(mktemp --directory temp-generated-source-tarball-XXX)"
fi
if [ "$VERSION" = "" ] ; then
echo "No VERSION specified" echo "No VERSION specified"
exit 2 exit 2
fi fi
echo "Version: ${VERSION}" echo "Version: ${VERSION}"
NUM_VER=${VERSION##jdk-} NUM_VER=${VERSION##shenandoah}
RELEASE_VER=${NUM_VER%%+*} RELEASE_VER=${NUM_VER%%-b*}
BUILD_VER=${NUM_VER##*+} BUILD_VER=${NUM_VER##*-}
MAJOR_VER=${RELEASE_VER%%.*} MAJOR_VER=${RELEASE_VER%%u*}
echo "Major version is ${MAJOR_VER}, release ${RELEASE_VER}, build ${BUILD_VER}" echo "Major version is ${MAJOR_VER}, release ${RELEASE_VER}, build ${BUILD_VER}"
if [ "x$BOOT_JDK" = "x" ] ; then if [ "x$BOOT_JDK" = "x" ] ; then
echo "No boot JDK specified". echo "No boot JDK specified".
BOOT_JDK=/usr/lib/jvm/java-${MAJOR_VER}-openjdk; BOOT_JDK=/usr/lib/jvm/java-1.${MAJOR_VER}.0-openjdk;
echo -n "Checking for ${BOOT_JDK}..."; echo -n "Checking for ${BOOT_JDK}...";
if [ -d ${BOOT_JDK} -a -x ${BOOT_JDK}/bin/java ] ; then if [ -d ${BOOT_JDK} -a -x ${BOOT_JDK}/bin/java ] ; then
echo "Boot JDK found at ${BOOT_JDK}"; echo "Boot JDK found at ${BOOT_JDK}";
else else
echo "Not found"; echo "Not found";
PREV_VER=$((${MAJOR_VER} - 1)); PREV_VER=$((${MAJOR_VER} - 1));
BOOT_JDK=/usr/lib/jvm/java-${PREV_VER}-openjdk; BOOT_JDK=/usr/lib/jvm/java-1.${PREV_VER}.0-openjdk;
echo -n "Checking for ${BOOT_JDK}..."; echo -n "Checking for ${BOOT_JDK}...";
if [ -d ${BOOT_JDK} -a -x ${BOOT_JDK}/bin/java ] ; then if [ -d ${BOOT_JDK} -a -x ${BOOT_JDK}/bin/java ] ; then
echo "Boot JDK found at ${BOOT_JDK}"; echo "Boot JDK found at ${BOOT_JDK}";
@ -128,16 +176,18 @@ echo -e "\tOPENJDK_URL: ${OPENJDK_URL}"
echo -e "\tCOMPRESSION: ${COMPRESSION}" echo -e "\tCOMPRESSION: ${COMPRESSION}"
echo -e "\tFILE_NAME_ROOT: ${FILE_NAME_ROOT}" echo -e "\tFILE_NAME_ROOT: ${FILE_NAME_ROOT}"
echo -e "\tREPO_ROOT: ${REPO_ROOT}" echo -e "\tREPO_ROOT: ${REPO_ROOT}"
echo -e "\tJCONSOLE_JS_PATCH: ${JCONSOLE_JS_PATCH}" echo -e "\tJCONSOLE_PATCH: ${JCONSOLE_PATCH}"
echo -e "\tBOOT_JDK: ${BOOT_JDK}" echo -e "\tBOOT_JDK: ${BOOT_JDK}"
mkdir "${FILE_NAME_ROOT}" mkdir "${FILE_NAME_ROOT}"
pushd "${FILE_NAME_ROOT}" pushd "${FILE_NAME_ROOT}"
echo "Cloning ${VERSION} root repository from ${REPO_ROOT}" echo "Cloning ${VERSION} root repository from ${REPO_ROOT}"
git clone -b ${VERSION} ${REPO_ROOT} ${VERSION} git clone --depth=1 -b "${VERSION}" "${REPO_ROOT}" "${VERSION}"
pushd ${VERSION} pushd "${VERSION}"
TAR_TIME="$(git log --max-count 1 --format=%cI)"
# UnderlineTaglet.java has a BSD license with a field-of-use restriction, making it non-Free # UnderlineTaglet.java has a BSD license with a field-of-use restriction, making it non-Free
if [ -d langtools ] ; then if [ -d langtools ] ; then
@ -153,47 +203,63 @@ if [ -d jdk ]; then
fi fi
echo "Patching out use of jconsole.js" echo "Patching out use of jconsole.js"
git apply --stat --apply -v -p1 ${JCONSOLE_JS_PATCH} git apply --stat --apply -v -p1 ${JCONSOLE_PATCH}
find . -name '*.orig' -exec rm -vf '{}' ';' find . -name '*.orig' -exec rm -vf '{}' ';'
popd popd
# Generate .src-rev so build has knowledge of the revision the tarball was created from # Generate .src-rev so build has knowledge of the revision the tarball was
# created from
mkdir build mkdir build
pushd build pushd build
sh ${PWD}/../${VERSION}/configure --with-boot-jdk=${BOOT_JDK} sh "${PWD}"/../"${VERSION}"/configure --with-boot-jdk="${BOOT_JDK}"
make store-source-revision make store-source-revision
popd popd
rm -rf build rm -rf build
# Remove commit checks # Remove commit checks
echo "Removing $(find ${VERSION} -name '.jcheck' -print)" echo "Removing $(find "${VERSION}" -name '.jcheck' -print)"
find ${VERSION} -name '.jcheck' -print0 | xargs -0 rm -r find "${VERSION}" -name '.jcheck' -print0 | xargs -0 rm -r
# Remove history and GHA # Remove history and GHA
echo "find ${VERSION} -name '.hgtags'" echo "find ${VERSION} -name '.hgtags'"
find ${VERSION} -name '.hgtags' -exec rm -v '{}' '+' find "${VERSION}" -name '.hgtags' -exec rm -v '{}' '+'
echo "find ${VERSION} -name '.hgignore'" echo "find ${VERSION} -name '.hgignore'"
find ${VERSION} -name '.hgignore' -exec rm -v '{}' '+' find "${VERSION}" -name '.hgignore' -exec rm -v '{}' '+'
echo "find ${VERSION} -name '.gitattributes'" echo "find ${VERSION} -name '.gitattributes'"
find ${VERSION} -name '.gitattributes' -exec rm -v '{}' '+' find "${VERSION}" -name '.gitattributes' -exec rm -v '{}' '+'
echo "find ${VERSION} -name '.gitignore'" echo "find ${VERSION} -name '.gitignore'"
find ${VERSION} -name '.gitignore' -exec rm -v '{}' '+' find "${VERSION}" -name '.gitignore' -exec rm -v '{}' '+'
# Work around some Git objects not having write permissions.
echo "chmod --recursive u+w ${VERSION}/.git"
chmod --recursive u+w "${VERSION}"/.git
echo "find ${VERSION} -name '.git'" echo "find ${VERSION} -name '.git'"
find ${VERSION} -name '.git' -exec rm -rv '{}' '+' find "${VERSION}" -name '.git' -exec rm -rv '{}' '+'
echo "find ${VERSION} -name '.github'" echo "find ${VERSION} -name '.github'"
find ${VERSION} -name '.github' -exec rm -rv '{}' '+' find "${VERSION}" -name '.github' -exec rm -rv '{}' '+'
echo "Compressing remaining forest" echo "Compressing remaining forest"
if [ "X$COMPRESSION" = "Xxz" ] ; then if [ "$COMPRESSION" = "xz" ] ; then
SWITCH=cJf SWITCH=cJf
else else
SWITCH=czf SWITCH=czf
fi fi
TARBALL_NAME=${FILE_NAME_ROOT}.tar.${COMPRESSION} TARBALL_NAME=${FILE_NAME_ROOT}.tar.${COMPRESSION}
tar --exclude-vcs -$SWITCH ${TARBALL_NAME} ${VERSION} XZ_OPT=${XZ_OPT-"-T0"} \
mv ${TARBALL_NAME} .. tar --mtime="${TAR_TIME}" --owner=root --group=root --sort=name \
--exclude-vcs -$SWITCH "${TARBALL_NAME}" "${VERSION}"
mv "${TARBALL_NAME}" ..
popd popd
echo "Done. You may want to remove the uncompressed version." if [ "$WITH_TEMP" != "" ] ; then
echo "Tarball is: $(realpath --relative-to=.. .)/${TARBALL_NAME}"
popd
else
echo -n "Done. You may want to remove the uncompressed version"
echo " - $FILE_NAME_ROOT."
fi
# Local Variables:
# fill-column: 80
# End:

View File

@ -297,8 +297,8 @@
# Define version of OpenJDK 8 used # Define version of OpenJDK 8 used
%global project openjdk %global project openjdk
%global repo shenandoah-jdk8u %global repo shenandoah-jdk8u
%global openjdk_revision jdk8u412-b01 %global openjdk_revision 8u412-b01
%global shenandoah_revision shenandoah-%{openjdk_revision} %global shenandoah_revision shenandoah%{openjdk_revision}
# Define IcedTea version used for SystemTap tapsets and desktop files # Define IcedTea version used for SystemTap tapsets and desktop files
%global icedteaver 3.15.0 %global icedteaver 3.15.0
# Define current Git revision for the FIPS support patches # Define current Git revision for the FIPS support patches
@ -1314,14 +1314,14 @@ License: ASL 1.1 and ASL 2.0 and BSD and BSD with advertising and GPL+ and GPLv
URL: http://openjdk.java.net/ URL: http://openjdk.java.net/
# Shenandoah HotSpot # Shenandoah HotSpot
# aarch64-port/jdk8u-shenandoah contains an integration forest of # openjdk/shenandoah-jdk8u contains an integration forest of
# OpenJDK 8u, the aarch64 port and Shenandoah # OpenJDK 8u and the Shenandoah garbage collector
# To regenerate, use: # To regenerate, use:
# VERSION=%%{shenandoah_revision} # VERSION=%%{shenandoah_revision}
# FILE_NAME_ROOT=%%{project}-%%{repo}-${VERSION} # FILE_NAME_ROOT=${VERSION}
# REPO_ROOT=<path to checked-out repository> generate_source_tarball.sh # REPO_ROOT=<path to checked-out repository> generate_source_tarball.sh
# where the source is obtained from http://github.com/%%{project}/%%{repo} # where the source is obtained from http://github.com/%%{project}/%%{repo}
Source0: %{project}-%{repo}-%{shenandoah_revision}.tar.xz Source0: %{shenandoah_revision}.tar.xz
# Use 'icedtea_sync.sh' to update the following # Use 'icedtea_sync.sh' to update the following
# They are based on code contained in the IcedTea project (3.x). # They are based on code contained in the IcedTea project (3.x).
@ -2648,10 +2648,25 @@ cjc.mainProgram(args)
%changelog %changelog
* Fri Mar 22 2024 Andrew Hughes <gnu.andrew@redhat.com> - 1:1.8.0.412.b01-0.2.ea * Fri Mar 22 2024 Andrew Hughes <gnu.andrew@redhat.com> - 1:1.8.0.412.b01-0.2.ea
- Turn off xz multi-threading on i686 as it fails with an out of memory error - Turn off xz multi-threading on i686 as it fails with an out of memory error
- Move to upstream tag style (shenandoah8ux-by) in preparation for eventually moving back to official sources
- generate_source_tarball.sh: Rename JCONSOLE_JS_PATCH{,_DEFAULT} to JCONSOLE_PATCH{,_DEFAULT} for brevity
- generate_source_tarball.sh: Adapt OPENJDK_LATEST logic to work with 8u Shenandoah fork
- generate_source_tarball.sh: Adapt version logic to work with 8u
- Related: RHEL-30925 - Related: RHEL-30925
* Fri Mar 22 2024 Thomas Fitzsimmons <fitzsim@redhat.com> - 1:1.8.0.412.b01-0.2.ea * Fri Mar 22 2024 Thomas Fitzsimmons <fitzsim@redhat.com> - 1:1.8.0.412.b01-0.2.ea
- Invoke xz in multi-threaded mode - Invoke xz in multi-threaded mode
- generate_source_tarball.sh: Add WITH_TEMP environment variable
- generate_source_tarball.sh: Multithread xz on all available cores
- generate_source_tarball.sh: Add OPENJDK_LATEST environment variable
- generate_source_tarball.sh: Update comment about tarball naming
- generate_source_tarball.sh: Reformat comment header
- generate_source_tarball.sh: Reformat and update help output
- generate_source_tarball.sh: Do a shallow clone, for speed
- generate_source_tarball.sh: Eliminate some removal prompting
- generate_source_tarball.sh: Make tarball reproducible
- generate_source_tarball.sh: Prefix temporary directory with temp-
- generate_source_tarball.sh: Remove temporary directory exit conditions
- Related: RHEL-30925 - Related: RHEL-30925
* Thu Mar 21 2024 Andrew Hughes <gnu.andrew@redhat.com> - 1:1.8.0.412.b01-0.2.ea * Thu Mar 21 2024 Andrew Hughes <gnu.andrew@redhat.com> - 1:1.8.0.412.b01-0.2.ea

View File

@ -1,2 +1,2 @@
SHA512 (tapsets-icedtea-3.15.0.tar.xz) = c752a197cb3d812d50c35e11e4722772be40096c81d2a57933e0d9b8a3c708b9c157b8108a4e33a06ca7bb81648170994408c75d6f69d5ff12785d0c31009671 SHA512 (tapsets-icedtea-3.15.0.tar.xz) = c752a197cb3d812d50c35e11e4722772be40096c81d2a57933e0d9b8a3c708b9c157b8108a4e33a06ca7bb81648170994408c75d6f69d5ff12785d0c31009671
SHA512 (openjdk-shenandoah-jdk8u-shenandoah-jdk8u412-b01.tar.xz) = 558a47280e157084be15795f65a3fd3a8a04b9a623735d711d6425ab3ff2ee2111e563c003553111eaf98022aa8bbcd908a8a1937c3630f96bca1ab487173d94 SHA512 (shenandoah8u412-b01.tar.xz) = 31b27506ced6f1dddbbe6ace81ff8a4a22b60347c763c5bcef5cd5805c335a64bbfde238c97f97b5b079845668cb93ff0f054c3c76c07ee3cbd3ca9c3bebfc3e