cosmetic changes

- Move to -P<n> usage for patch macro which works on all RPM versions
- generate_source_tarball.sh: Add note on network usage of OPENJDK_LATEST
- generate_source_tarball.sh: Remove unneeded FIXME
- generate_source_tarball.sh: Add --sort=name to tar invocation for reproducibility
- 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: Remove REPO_NAME from FILE_NAME_ROOT
- generate_source_tarball.sh: Set compile-command in Emacs
- generate_source_tarball.sh: Reformat comment header
- generate_source_tarball.sh: Reformat and update help output
- generate_source_tarball.sh: Move PROJECT_NAME and REPO_NAME checks
- generate_source_tarball.sh: Do a shallow clone, for speed
- generate_source_tarball.sh: Append -ea designator when required
- 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: shellcheck: Remove x-prefixes since we use Bash
- generate_source_tarball.sh: shellcheck: Double-quote variable references
- generate_source_tarball.sh: shellcheck: Do not use -a
- generate_source_tarball.sh: shellcheck: Do not use $ in expression
- generate_source_tarball.sh: Remove temporary directory exit conditions
This commit is contained in:
Jiri Vanek 2024-01-24 18:17:12 +01:00
parent 242a78f54c
commit d3b6e4820b
3 changed files with 173 additions and 67 deletions

View File

@ -1,14 +1,16 @@
# java-latest-openjdk-portable
This package contains the latest rolling release of OpenJDK. OpenJDK
has a release cadence of six months, with a new release in March and
September each year.
The current release is OpenJDK 21. For a list of major changes from
OpenJDK 20, see the NEWS file included in this package and the
The current release is OpenJDK 22. For a list of major changes from
OpenJDK 21, see the NEWS file included in this package and the
upstream release page:
https://openjdk.java.net/projects/jdk/21/
https://openjdk.java.net/projects/jdk/22/
This package is intended for those who want to follow the latest
OpenJDK releases. Long term support versions of OpenJDK are available
in the java-1.8.0-openjdk, java-11-openjdk and java-17-openjdk
in the java-1.8.0-openjdk, java-11-openjdk, java-17-openjdk and java-21-openjdk
packages.

View File

@ -1,51 +1,99 @@
#!/bin/bash
# Generates the 'source tarball' for JDK projects.
#
# Example:
# 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
# Example 1:
# 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.
#
# 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
# REPO_NAME=jdk21u
# VERSION=jdk-22+32
# or to eg prepare systemtap:
# icedtea7's jstack and other tapsets
# REPO_NAME=jdk17u
# VERSION=jdk-17.0.10+7
#
# or to e.g., prepare systemtap, icedtea7's jstack and other tapsets:
#
# VERSION=6327cf1cea9e
# REPO_NAME=icedtea7-2.6
# PROJECT_NAME=release
# OPENJDK_URL=http://icedtea.classpath.org/hg/
# TO_COMPRESS="*/tapset"
#
# 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
# 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.
set -e
OPENJDK_URL_DEFAULT=https://github.com
COMPRESSION_DEFAULT=xz
if [ "x$1" = "xhelp" ] ; then
echo -e "Behaviour may be specified by setting the following variables:\n"
if [ "$1" = "help" ] ; then
echo "Behaviour may be specified by setting the following variables:"
echo
echo "VERSION - the version of the specified OpenJDK project"
echo "PROJECT_NAME -- the name of the OpenJDK project being archived (optional; only needed by defaults)"
echo "REPO_NAME - the name of the OpenJDK repository (optional; only needed by defaults)"
echo "OPENJDK_URL - the URL to retrieve code from (optional; defaults to ${OPENJDK_URL_DEFAULT})"
echo "COMPRESSION - the compression type to use (optional; defaults to ${COMPRESSION_DEFAULT})"
echo "FILE_NAME_ROOT - name of the archive, minus extensions (optional; defaults to PROJECT_NAME-REPO_NAME-VERSION)"
echo "REPO_ROOT - the location of the Git repository to archive (optional; defaults to OPENJDK_URL/PROJECT_NAME/REPO_NAME.git)"
echo "TO_COMPRESS - what part of clone to pack (default is ${VERSION})"
echo " (required unless OPENJDK_LATEST is set)"
echo "PROJECT_NAME - the name of the OpenJDK project being archived"
echo " (needed to compute REPO_ROOT and/or"
echo " FILE_NAME_ROOT automatically;"
echo " optional if they are set explicitly)"
echo "REPO_NAME - the name of the OpenJDK repository"
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 "TO_COMPRESS - what part of clone to pack"
echo " (defaults to ${VERSION})"
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;
fi
if [ "$OPENJDK_LATEST" != "" ] ; then
FEATURE_VERSION=$(echo '%featurever' \
| rpmspec --shell ./*.spec 2>/dev/null \
| grep --after-context 1 featurever \
| tail --lines 1)
PROJECT_NAME=openjdk
REPO_NAME=jdk"${FEATURE_VERSION}"u
VERSION=$(git ls-remote --tags --refs --sort=-version:refname \
"${OPENJDK_URL_DEFAULT}/${PROJECT_NAME}/${REPO_NAME}.git" \
"jdk-${FEATURE_VERSION}*" \
| head --lines 1 | cut --characters 52-)
FILE_NAME_ROOT=open${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"
exit 2
fi
@ -57,18 +105,18 @@ BUILD_VER=${NUM_VER##*+}
MAJOR_VER=${RELEASE_VER%%.*}
echo "Major version is ${MAJOR_VER}, release ${RELEASE_VER}, build ${BUILD_VER}"
if [ "x$BOOT_JDK" = "x" ] ; then
if [ "$BOOT_JDK" = "" ] ; then
echo "No boot JDK specified".
BOOT_JDK=/usr/lib/jvm/java-${MAJOR_VER}-openjdk;
echo -n "Checking for ${BOOT_JDK}...";
if [ -d ${BOOT_JDK} -a -x ${BOOT_JDK}/bin/java ] ; then
if [ -d "${BOOT_JDK}" ] && [ -x "${BOOT_JDK}"/bin/java ] ; then
echo "Boot JDK found at ${BOOT_JDK}";
else
echo "Not found";
PREV_VER=$((${MAJOR_VER} - 1));
PREV_VER=$((MAJOR_VER - 1));
BOOT_JDK=/usr/lib/jvm/java-${PREV_VER}-openjdk;
echo -n "Checking for ${BOOT_JDK}...";
if [ -d ${BOOT_JDK} -a -x ${BOOT_JDK}/bin/java ] ; then
if [ -d ${BOOT_JDK} ] && [ -x ${BOOT_JDK}/bin/java ] ; then
echo "Boot JDK found at ${BOOT_JDK}";
else
echo "Not found";
@ -79,43 +127,41 @@ else
echo "Boot JDK: ${BOOT_JDK}";
fi
# REPO_NAME is only needed when we default on REPO_ROOT and FILE_NAME_ROOT
if [ "x$FILE_NAME_ROOT" = "x" -o "x$REPO_ROOT" = "x" ] ; then
if [ "x$PROJECT_NAME" = "x" ] ; then
echo "No PROJECT_NAME specified"
exit 1
fi
echo "Project name: ${PROJECT_NAME}"
if [ "x$REPO_NAME" = "x" ] ; then
echo "No REPO_NAME specified"
exit 3
fi
echo "Repository name: ${REPO_NAME}"
fi
if [ "x$OPENJDK_URL" = "x" ] ; then
if [ "$OPENJDK_URL" = "" ] ; then
OPENJDK_URL=${OPENJDK_URL_DEFAULT}
echo "No OpenJDK URL specified; defaulting to ${OPENJDK_URL}"
else
echo "OpenJDK URL: ${OPENJDK_URL}"
fi
if [ "x$COMPRESSION" = "x" ] ; then
if [ "$COMPRESSION" = "" ] ; then
# rhel 5 needs tar.gz
COMPRESSION=${COMPRESSION_DEFAULT}
fi
echo "Creating a tar.${COMPRESSION} archive"
if [ "x$FILE_NAME_ROOT" = "x" ] ; then
FILE_NAME_ROOT=${PROJECT_NAME}-${REPO_NAME}-${VERSION}
if [ "$FILE_NAME_ROOT" = "" ] ; then
if [ "$PROJECT_NAME" = "" ] ; then
echo "No PROJECT_NAME specified, needed by FILE_NAME_ROOT"
exit 1
fi
FILE_NAME_ROOT=${PROJECT_NAME}-${VERSION}
echo "No file name root specified; default to ${FILE_NAME_ROOT}"
fi
if [ "x$REPO_ROOT" = "x" ] ; then
if [ "$REPO_ROOT" = "" ] ; then
if [ "$PROJECT_NAME" = "" ] ; then
echo "No PROJECT_NAME specified, needed by REPO_ROOT"
exit 1
fi
if [ "$REPO_NAME" = "" ] ; then
echo "No REPO_NAME specified, needed by REPO_ROOT"
exit 3
fi
REPO_ROOT="${OPENJDK_URL}/${PROJECT_NAME}/${REPO_NAME}.git"
echo "No repository root specified; default to ${REPO_ROOT}"
fi;
if [ "x$TO_COMPRESS" = "x" ] ; then
if [ "$TO_COMPRESS" = "" ] ; then
TO_COMPRESS="${VERSION}"
echo "No targets to be compressed specified ; default to ${TO_COMPRESS}"
fi;
@ -131,23 +177,31 @@ echo -e "\tREPO_ROOT: ${REPO_ROOT}"
echo -e "\tTO_COMPRESS: ${TO_COMPRESS}"
echo -e "\tBOOT_JDK: ${BOOT_JDK}"
if [ -d ${FILE_NAME_ROOT} ] ; then
if [ -d "${FILE_NAME_ROOT}" ] ; then
echo "exists exists exists exists exists exists exists "
echo "reusing reusing reusing reusing reusing reusing "
echo ${FILE_NAME_ROOT}
echo "${FILE_NAME_ROOT}"
STAT_TIME="$(stat --format=%Y "${FILE_NAME_ROOT}")"
TAR_TIME="$(date --date=@"${STAT_TIME}" --iso-8601=seconds)"
else
mkdir "${FILE_NAME_ROOT}"
pushd "${FILE_NAME_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}"
TAR_TIME="$(git log --max-count 1 --format=%cI)"
popd
popd
fi
pushd "${FILE_NAME_ROOT}"
EA_PART="$(git tag --contains "${VERSION}" \
| grep --quiet '\-ga$' || echo '-ea')"
# 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
pushd build
sh ${PWD}/../${VERSION}/configure --with-boot-jdk=${BOOT_JDK}
sh "${PWD}"/../"${VERSION}"/configure --with-boot-jdk="${BOOT_JDK}"
make store-source-revision
popd
rm -rf build
@ -171,13 +225,26 @@ pushd "${FILE_NAME_ROOT}"
find ${VERSION} -name '.github' -exec rm -rfv '{}' '+'
echo "Compressing remaining forest"
if [ "X$COMPRESSION" = "Xxz" ] ; then
if [ "$COMPRESSION" = "xz" ] ; then
SWITCH=cJf
else
SWITCH=czf
fi
TARBALL_NAME=${FILE_NAME_ROOT}.tar.${COMPRESSION}
tar --exclude-vcs -$SWITCH ${TARBALL_NAME} $TO_COMPRESS
mv ${TARBALL_NAME} ..
TARBALL_NAME=${FILE_NAME_ROOT}${EA_PART}.tar.${COMPRESSION}
XZ_OPT=${XZ_OPT-"-T0"} \
tar --mtime="${TAR_TIME}" --owner=root --group=root --sort=name \
--exclude-vcs -$SWITCH "${TARBALL_NAME}" "${TO_COMPRESS}"
mv "${TARBALL_NAME}" ..
popd
echo "Done. You may want to remove the uncompressed version - $FILE_NAME_ROOT."
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:
# compile-command: "shellcheck generate_source_tarball.sh"
# fill-column: 80
# End:

View File

@ -1,3 +1,8 @@
%if (0%{?rhel} > 0 && 0%{?rhel} < 8)
# portable jdk 17 specific bug, _jvmdir being missing
%define _jvmdir /usr/lib/jvm
%endif
# debug_package %%{nil} is portable-jdks specific
%define debug_package %{nil}
@ -313,9 +318,12 @@
%global stapinstall %{nil}
%endif
# always off for portable builds
%ifarch %{systemtap_arches}
%if (0%{?rhel} > 0)
%global with_systemtap 1
%else
%global with_systemtap 0
%endif
%else
%global with_systemtap 0
%endif
@ -388,7 +396,7 @@
%global top_level_dir_name %{vcstag}
%global top_level_dir_name_backup %{top_level_dir_name}-backup
%global buildver 32
%global rpmrelease 1
%global rpmrelease 2
#%%global tagsuffix %%{nil}
# Priority must be 8 digits in total; up to openjdk 1.8, we were using 18..... so when we moved to 11, we had to add another digit
%if %is_system_jdk
@ -637,6 +645,8 @@ Source18: TestTranslations.java
# Patch is generated from the fips-21u tree at https://github.com/rh-openjdk/jdk/tree/fips-21u
# as follows: git diff %%{vcstag} src make test > fips-21u-$(git show -s --format=%h HEAD).patch
# Diff is limited to src and make subdirectories to exclude .github changes
# The following list is generated by:
# git log %%{vcstag}.. --no-merges --format=%s --reverse:
# Fixes currently included:
# PR3183, RH1340845: Follow system wide crypto policy
# PR3695: Allow use of system crypto policy to be disabled by the user
@ -685,6 +695,8 @@ Source18: TestTranslations.java
#
#############################################
# Currently empty
#############################################
#
# Portable build specific patches
@ -987,7 +999,7 @@ sh %{SOURCE12} %{top_level_dir_name}
# Patch the JDK
pushd %{top_level_dir_name}
# Add crypto policy and FIPS support
# Skipping fips patch whil eit is not ready for jdk22 %%patch1001 -p1
# Skipping fips patch whil eit is not ready for jdk22 %%patch -P1001 -p1
# Patches in need of upstreaming
popd # openjdk
@ -1766,6 +1778,31 @@ done
%endif
%changelog
* Wed Jan 24 2024 Jiri Vanek <jvanek@redhat.com> - 1:22.0.0.0.32-2.rolling
- Move to -P<n> usage for patch macro which works on all RPM versions
- generate_source_tarball.sh: Add note on network usage of OPENJDK_LATEST
- generate_source_tarball.sh: Remove unneeded FIXME
- generate_source_tarball.sh: Add --sort=name to tar invocation for reproducibility
- 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: Remove REPO_NAME from FILE_NAME_ROOT
- generate_source_tarball.sh: Set compile-command in Emacs
- generate_source_tarball.sh: Reformat comment header
- generate_source_tarball.sh: Reformat and update help output
- generate_source_tarball.sh: Move PROJECT_NAME and REPO_NAME checks
- generate_source_tarball.sh: Do a shallow clone, for speed
- generate_source_tarball.sh: Append -ea designator when required
- 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: shellcheck: Remove x-prefixes since we use Bash
- generate_source_tarball.sh: shellcheck: Double-quote variable references
- generate_source_tarball.sh: shellcheck: Do not use -a
- generate_source_tarball.sh: shellcheck: Do not use $ in expression
- generate_source_tarball.sh: Remove temporary directory exit conditions
* Mon Jan 22 2024 Jiri Vanek <jvanek@redhat.com> - 1:22.0.0.0.32-1.rolling
- bumped to jdk22 (jdk-22+32)
- manually renamed generated sources openjdk-jdk22u-jdk-22+32.tar.xz -> openjdk-22+32-ea.tar.xz