From d0f2a0eda7180baccedaa07d602611f5417e0082 Mon Sep 17 00:00:00 2001 From: Andrew Hughes Date: Tue, 2 Apr 2024 19:36:19 +0100 Subject: [PATCH] icedtea_sync.sh: Update with a VCS mode that retrieves sources from a Mercurial repository Related: RHEL-30937 --- java-1.8.0-openjdk.spec | 1 + scripts/icedtea_sync.sh | 181 ++++++++++++++++++++++++++++++---------- 2 files changed, 139 insertions(+), 43 deletions(-) diff --git a/java-1.8.0-openjdk.spec b/java-1.8.0-openjdk.spec index ef631a6..7be4c57 100644 --- a/java-1.8.0-openjdk.spec +++ b/java-1.8.0-openjdk.spec @@ -2927,6 +2927,7 @@ cjc.mainProgram(args) - generate_source_tarball.sh: Create directory in TMPDIR when using WITH_TEMP - generate_source_tarball.sh: Only add --depth=1 on non-local repositories - Move maintenance scripts to a scripts subdirectory +- icedtea_sync.sh: Update with a VCS mode that retrieves sources from a Mercurial repository - Sync patch set with portable build - Related: RHEL-30937 diff --git a/scripts/icedtea_sync.sh b/scripts/icedtea_sync.sh index 061637b..f69db2c 100755 --- a/scripts/icedtea_sync.sh +++ b/scripts/icedtea_sync.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2019 Red Hat, Inc. +# Copyright (C) 2024 Red Hat, Inc. # Written by Andrew John Hughes . # # This program is free software: you can redistribute it and/or modify @@ -16,12 +16,31 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +ICEDTEA_USE_VCS=false + ICEDTEA_VERSION=3.15.0 ICEDTEA_URL=https://icedtea.classpath.org/download/source ICEDTEA_SIGNING_KEY=CFDA0F9B35964222 +ICEDTEA_HG_URL=https://icedtea.classpath.org/hg/icedtea8 + set -e +RPM_DIR=${PWD} +if [ ! -f ${RPM_DIR}/jconsole.desktop.in ] ; then + echo "Not in RPM source tree."; + exit 1; +fi + +if test "x${TMPDIR}" = "x"; then + TMPDIR=/tmp; +fi +WORKDIR=${TMPDIR}/it.sync + +echo "Using working directory ${WORKDIR}" +mkdir ${WORKDIR} +pushd ${WORKDIR} + if test "x${WGET}" = "x"; then WGET=$(which wget); if test "x${WGET}" = "x"; then @@ -30,70 +49,146 @@ if test "x${WGET}" = "x"; then fi fi -if test "x${CHECKSUM}" = "x"; then - CHECKSUM=$(which sha256sum) - if test "x${CHECKSUM}" = "x"; then - echo "sha256sum not found"; - exit 2; - fi -fi - -if test "x${PGP}" = "x"; then - PGP=$(which gpg) - if test "x${PGP}" = "x"; then - echo "gpg not found"; - exit 3; - fi -fi - if test "x${TAR}" = "x"; then TAR=$(which tar) if test "x${TAR}" = "x"; then echo "tar not found"; - exit 4; + exit 2; fi fi echo "Dependencies:"; echo -e "\tWGET: ${WGET}"; -echo -e "\tCHECKSUM: ${CHECKSUM}"; -echo -e "\tPGP: ${PGP}\n"; echo -e "\tTAR: ${TAR}\n"; -echo "Checking for IcedTea signing key ${ICEDTEA_SIGNING_KEY}..."; -if ! gpg --list-keys ${ICEDTEA_SIGNING_KEY}; then - echo "IcedTea signing key ${ICEDTEA_SIGNING_KEY} not installed."; - exit 5; -fi +if test "x${ICEDTEA_USE_VCS}" = "xtrue"; then + echo "Mode: Using VCS"; -echo "Downloading IcedTea release tarball..."; -${WGET} -v ${ICEDTEA_URL}/icedtea-${ICEDTEA_VERSION}.tar.xz -echo "Downloading IcedTea tarball signature..."; -${WGET} -v ${ICEDTEA_URL}/icedtea-${ICEDTEA_VERSION}.tar.xz.sig -echo "Downloading IcedTea tarball checksums..."; -${WGET} -v ${ICEDTEA_URL}/icedtea-${ICEDTEA_VERSION}.sha256 + if test "x${GREP}" = "x"; then + GREP=$(which grep); + if test "x${GREP}" = "x"; then + echo "grep not found"; + exit 3; + fi + fi -echo "Verifying checksums..."; -${CHECKSUM} --check --ignore-missing icedtea-${ICEDTEA_VERSION}.sha256 + if test "x${CUT}" = "x"; then + CUT=$(which cut); + if test "x${CUT}" = "x"; then + echo "cut not found"; + exit 4; + fi + fi -echo "Checking signature..."; -${PGP} --verify icedtea-${ICEDTEA_VERSION}.tar.xz.sig + if test "x${TR}" = "x"; then + TR=$(which tr); + if test "x${TR}" = "x"; then + echo "tr not found"; + exit 5; + fi + fi -echo "Extracting files..."; -${TAR} xJf icedtea-${ICEDTEA_VERSION}.tar.xz \ + if test "x${HG}" = "x"; then + HG=$(which hg); + if test "x${HG}" = "x"; then + echo "hg not found"; + exit 6; + fi + fi + + echo "Dependencies:"; + echo -e "\tGREP: ${GREP}"; + echo -e "\tCUT: ${CUT}"; + echo -e "\tTR: ${TR}"; + echo -e "\tHG: ${HG}"; + + echo "Checking out repository from VCS..."; + ${HG} clone ${ICEDTEA_HG_URL} icedtea + + echo "Obtaining version from configure.ac..."; + ROOT_VER=$(${GREP} '^AC_INIT' icedtea/configure.ac|${CUT} -d ',' -f 2|${TR} -d '[][:space:]') + echo "Root version from configure: ${ROOT_VER}"; + + VCS_REV=$(${HG} log -R icedtea --template '{node|short}' -r tip) + echo "VCS revision: ${VCS_REV}"; + + ICEDTEA_VERSION="${ROOT_VER}-${VCS_REV}" + echo "Creating icedtea-${ICEDTEA_VERSION}"; + mkdir icedtea-${ICEDTEA_VERSION} + echo "Copying required files from checkout to icedtea-${ICEDTEA_VERSION}"; + # Commented out for now as IcedTea 6's jconsole.desktop.in is outdated + #cp -a icedtea/jconsole.desktop.in ../icedtea-${ICEDTEA_VERSION} + cp -a ${RPM_DIR}/jconsole.desktop.in icedtea-${ICEDTEA_VERSION} + cp -a icedtea/tapset icedtea-${ICEDTEA_VERSION} + + rm -rf icedtea +else + echo "Mode: Using tarball"; + + if test "x${ICEDTEA_VERSION}" = "x"; then + echo "No IcedTea version specified for tarball download."; + exit 3; + fi + + if test "x${CHECKSUM}" = "x"; then + CHECKSUM=$(which sha256sum) + if test "x${CHECKSUM}" = "x"; then + echo "sha256sum not found"; + exit 4; + fi + fi + + if test "x${PGP}" = "x"; then + PGP=$(which gpg) + if test "x${PGP}" = "x"; then + echo "gpg not found"; + exit 5; + fi + fi + + echo "Dependencies:"; + echo -e "\tCHECKSUM: ${CHECKSUM}"; + echo -e "\tPGP: ${PGP}\n"; + + echo "Checking for IcedTea signing key ${ICEDTEA_SIGNING_KEY}..."; + if ! gpg --list-keys ${ICEDTEA_SIGNING_KEY}; then + echo "IcedTea signing key ${ICEDTEA_SIGNING_KEY} not installed."; + exit 6; + fi + + echo "Downloading IcedTea release tarball..."; + ${WGET} -v ${ICEDTEA_URL}/icedtea-${ICEDTEA_VERSION}.tar.xz + echo "Downloading IcedTea tarball signature..."; + ${WGET} -v ${ICEDTEA_URL}/icedtea-${ICEDTEA_VERSION}.tar.xz.sig + echo "Downloading IcedTea tarball checksums..."; + ${WGET} -v ${ICEDTEA_URL}/icedtea-${ICEDTEA_VERSION}.sha256 + + echo "Verifying checksums..."; + ${CHECKSUM} --check --ignore-missing icedtea-${ICEDTEA_VERSION}.sha256 + + echo "Checking signature..."; + ${PGP} --verify icedtea-${ICEDTEA_VERSION}.tar.xz.sig + + echo "Extracting files..."; + ${TAR} xJf icedtea-${ICEDTEA_VERSION}.tar.xz \ icedtea-${ICEDTEA_VERSION}/tapset \ icedtea-${ICEDTEA_VERSION}/jconsole.desktop.in \ icedtea-${ICEDTEA_VERSION}/policytool.desktop.in + rm -vf icedtea-${ICEDTEA_VERSION}.tar.xz + rm -vf icedtea-${ICEDTEA_VERSION}.tar.xz.sig + rm -vf icedtea-${ICEDTEA_VERSION}.sha256 +fi + echo "Replacing desktop files..."; -mv -v icedtea-${ICEDTEA_VERSION}/jconsole.desktop.in . -mv -v icedtea-${ICEDTEA_VERSION}/policytool.desktop.in . +mv -v icedtea-${ICEDTEA_VERSION}/jconsole.desktop.in ${RPM_DIR} +mv -v icedtea-${ICEDTEA_VERSION}/policytool.desktop.in ${RPM_DIR} echo "Creating new tapset tarball..."; mv -v icedtea-${ICEDTEA_VERSION} openjdk -${TAR} cJf tapsets-icedtea-${ICEDTEA_VERSION}.tar.xz openjdk +${TAR} cJf ${RPM_DIR}/tapsets-icedtea-${ICEDTEA_VERSION}.tar.xz openjdk rm -rvf openjdk -rm -vf icedtea-${ICEDTEA_VERSION}.tar.xz -rm -vf icedtea-${ICEDTEA_VERSION}.tar.xz.sig -rm -vf icedtea-${ICEDTEA_VERSION}.sha256 + +popd +rm -rf ${WORKDIR}