Sync generate_source_tarball.sh
- Related: RHEL-30941
This commit is contained in:
parent
1352b94b11
commit
9fd8c9faff
@ -1,4 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (C) 2024 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Generates the 'source tarball' for JDK projects.
|
# Generates the 'source tarball' for JDK projects.
|
||||||
#
|
#
|
||||||
# Example 1:
|
# Example 1:
|
||||||
@ -20,7 +36,7 @@
|
|||||||
#
|
#
|
||||||
# PROJECT_NAME=openjdk
|
# PROJECT_NAME=openjdk
|
||||||
# REPO_NAME=jdk17u
|
# REPO_NAME=jdk17u
|
||||||
# VERSION=jdk-17.0.3+5
|
# VERSION=jdk-17.0.10+7
|
||||||
#
|
#
|
||||||
# or to e.g., prepare systemtap, icedtea7's jstack and other tapsets:
|
# or to e.g., prepare systemtap, icedtea7's jstack and other tapsets:
|
||||||
#
|
#
|
||||||
@ -81,9 +97,17 @@ if [ "$OPENJDK_LATEST" != "" ] ; then
|
|||||||
| tail --lines 1)
|
| tail --lines 1)
|
||||||
PROJECT_NAME=openjdk
|
PROJECT_NAME=openjdk
|
||||||
REPO_NAME=jdk"${FEATURE_VERSION}"u
|
REPO_NAME=jdk"${FEATURE_VERSION}"u
|
||||||
|
# Skip -ga tags since those are the same as the most recent non-ga tag, and
|
||||||
|
# the non-ga tag is the one that is used to generated the official source
|
||||||
|
# tarball. For example:
|
||||||
|
# ca760c86642aa2e0d9b571aaabac054c0239fbdc refs/tags/jdk-17.0.10-ga^{}
|
||||||
|
# 25a2e6c20c9a96853714284cabc6b456eb095070 refs/tags/jdk-17.0.10-ga
|
||||||
|
# ca760c86642aa2e0d9b571aaabac054c0239fbdc refs/tags/jdk-17.0.10+7^{}
|
||||||
|
# e49c5749b10f3e90274b72e9279f794fdd191d27 refs/tags/jdk-17.0.10+7
|
||||||
VERSION=$(git ls-remote --tags --refs --sort=-version:refname \
|
VERSION=$(git ls-remote --tags --refs --sort=-version:refname \
|
||||||
"${OPENJDK_URL_DEFAULT}/${PROJECT_NAME}/${REPO_NAME}.git" \
|
"${OPENJDK_URL_DEFAULT}/${PROJECT_NAME}/${REPO_NAME}.git" \
|
||||||
"jdk-${FEATURE_VERSION}*" \
|
"jdk-${FEATURE_VERSION}*" \
|
||||||
|
| grep --invert-match '\-ga$' \
|
||||||
| head --lines 1 | cut --characters 52-)
|
| head --lines 1 | cut --characters 52-)
|
||||||
FILE_NAME_ROOT=open${VERSION}
|
FILE_NAME_ROOT=open${VERSION}
|
||||||
WITH_TEMP=1
|
WITH_TEMP=1
|
||||||
@ -178,65 +202,60 @@ echo -e "\tTO_COMPRESS: ${TO_COMPRESS}"
|
|||||||
echo -e "\tBOOT_JDK: ${BOOT_JDK}"
|
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 "exists exists exists exists exists exists exists "
|
||||||
echo "reusing reusing reusing reusing reusing reusing "
|
echo "reusing reusing reusing reusing reusing reusing "
|
||||||
echo "${FILE_NAME_ROOT}"
|
echo "${FILE_NAME_ROOT}"
|
||||||
STAT_TIME="$(stat --format=%Y "${FILE_NAME_ROOT}")"
|
STAT_TIME="$(stat --format=%Y "${FILE_NAME_ROOT}")"
|
||||||
TAR_TIME="$(date --date=@"${STAT_TIME}" --iso-8601=seconds)"
|
TAR_TIME="$(date --date=@"${STAT_TIME}" --iso-8601=seconds)"
|
||||||
else
|
else
|
||||||
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 --depth=1 -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)"
|
TAR_TIME="$(git log --max-count 1 --format=%cI)"
|
||||||
|
popd
|
||||||
popd
|
popd
|
||||||
popd
|
|
||||||
fi
|
fi
|
||||||
pushd "${FILE_NAME_ROOT}"
|
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
|
# Generate .src-rev so build has knowledge of the revision the tarball was
|
||||||
# created from
|
# 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
|
EA_PART="$(awk -F= \
|
||||||
echo "Removing $(find "${VERSION}" -name '.jcheck' -print)"
|
'/^DEFAULT_PROMOTED_VERSION_PRE/ { if ($2) print "-"$2 }' \
|
||||||
find "${VERSION}" -name '.jcheck' -print0 | xargs -0 rm -r
|
"${VERSION}"/make/conf/version-numbers.conf)"
|
||||||
|
TARBALL_BASE=${FILE_NAME_ROOT}${EA_PART}.tar
|
||||||
# Remove history and GHA
|
pushd "${VERSION}"
|
||||||
echo "find ${VERSION} -name '.hgtags'"
|
# Omit commit checks, history, and GHA from archive.
|
||||||
find "${VERSION}" -name '.hgtags' -exec rm -v '{}' '+'
|
for skip in .jcheck .hgtags .hgignore .gitattributes .gitignore .github
|
||||||
echo "find ${VERSION} -name '.hgignore'"
|
do
|
||||||
find "${VERSION}" -name '.hgignore' -exec rm -v '{}' '+'
|
echo "${skip}"" export-ignore" >> .git/info/attributes
|
||||||
echo "find ${VERSION} -name '.gitattributes'"
|
done
|
||||||
find "${VERSION}" -name '.gitattributes' -exec rm -v '{}' '+'
|
# Do not bother with --mtime here; specify it to tar below.
|
||||||
echo "find ${VERSION} -name '.gitignore'"
|
# Unforunately, git-archive sorts added files like .src-rev at the end;
|
||||||
find "${VERSION}" -name '.gitignore' -exec rm -v '{}' '+'
|
# retar below to use GNU tar --sort=name ordering which sorts .src-rev
|
||||||
# Work around some Git objects not having write permissions.
|
# at the start.
|
||||||
echo "chmod --recursive u+w ${VERSION}/.git"
|
git archive --output "${TARBALL_BASE}" --prefix="${VERSION}"/ \
|
||||||
chmod --recursive u+w "${VERSION}"/.git
|
--add-file=.src-rev --format=tar "${VERSION}"
|
||||||
echo "find ${VERSION} -name '.git'"
|
popd
|
||||||
find "${VERSION}" -name '.git' -exec rm -rv '{}' '+'
|
mv "${VERSION}" "${VERSION}".git
|
||||||
echo "find ${VERSION} -name '.github'"
|
tar xf "${VERSION}".git/"${TARBALL_BASE}"
|
||||||
find "${VERSION}" -name '.github' -exec rm -rv '{}' '+'
|
|
||||||
|
|
||||||
echo "Compressing remaining forest"
|
echo "Compressing remaining forest"
|
||||||
if [ "$COMPRESSION" = "xz" ] ; then
|
if [ "$COMPRESSION" = "xz" ] ; then
|
||||||
SWITCH=cJf
|
SWITCH=cJf
|
||||||
else
|
else
|
||||||
SWITCH=czf
|
SWITCH=czf
|
||||||
fi
|
fi
|
||||||
TARBALL_NAME=${FILE_NAME_ROOT}${EA_PART}.tar.${COMPRESSION}
|
TARBALL_NAME=${TARBALL_BASE}.${COMPRESSION}
|
||||||
XZ_OPT=${XZ_OPT-"-T0"} \
|
XZ_OPT=${XZ_OPT-"-T0"} \
|
||||||
tar --mtime="${TAR_TIME}" --owner=root --group=root --sort=name \
|
tar --mtime="${TAR_TIME}" --owner=root --group=root --sort=name \
|
||||||
--exclude-vcs -$SWITCH "${TARBALL_NAME}" "${TO_COMPRESS}"
|
-$SWITCH "${TARBALL_NAME}" "${TO_COMPRESS}"
|
||||||
mv "${TARBALL_NAME}" ..
|
mv "${TARBALL_NAME}" ..
|
||||||
popd
|
popd
|
||||||
if [ "$WITH_TEMP" != "" ] ; then
|
if [ "$WITH_TEMP" != "" ] ; then
|
||||||
@ -244,10 +263,12 @@ if [ "$WITH_TEMP" != "" ] ; then
|
|||||||
popd
|
popd
|
||||||
else
|
else
|
||||||
echo -n "Done. You may want to remove the uncompressed version"
|
echo -n "Done. You may want to remove the uncompressed version"
|
||||||
echo " - $FILE_NAME_ROOT."
|
echo " - $FILE_NAME_ROOT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
# compile-command: "shellcheck generate_source_tarball.sh"
|
# compile-command: "shellcheck generate_source_tarball.sh"
|
||||||
# fill-column: 80
|
# fill-column: 80
|
||||||
|
# indent-tabs-mode: nil
|
||||||
|
# sh-basic-offset: 4
|
||||||
# End:
|
# End:
|
||||||
|
@ -2490,6 +2490,7 @@ cjc.mainProgram(args)
|
|||||||
- Update buildjdkver to match the featurever
|
- Update buildjdkver to match the featurever
|
||||||
- Use featurever macro to specify fips patch
|
- Use featurever macro to specify fips patch
|
||||||
- Explain patchN syntax situation in a comment
|
- Explain patchN syntax situation in a comment
|
||||||
|
- Sync generate_source_tarball.sh
|
||||||
- Related: RHEL-30941
|
- Related: RHEL-30941
|
||||||
|
|
||||||
* Thu Jan 11 2024 Andrew Hughes <gnu.andrew@redhat.com> - 1:17.0.10.0.7-1
|
* Thu Jan 11 2024 Andrew Hughes <gnu.andrew@redhat.com> - 1:17.0.10.0.7-1
|
||||||
|
Loading…
Reference in New Issue
Block a user