From ca2a20d6f959c110ad24ced8b699ad3334bb988f Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Tue, 4 Sep 2018 19:15:31 +0200 Subject: [PATCH] Changed handling of systemtap sources --- .gitignore | 1 + generate_singlerepo_source_tarball.sh | 145 ++++++++++++++++++++ generate_tarballs.sh | 25 ---- java-1.8.0-openjdk.spec | 12 +- sources | 2 +- update_package.sh => update_main_sources.sh | 0 update_systemtap.sh | 32 +++++ 7 files changed, 184 insertions(+), 33 deletions(-) create mode 100644 generate_singlerepo_source_tarball.sh delete mode 100755 generate_tarballs.sh rename update_package.sh => update_main_sources.sh (100%) create mode 100644 update_systemtap.sh diff --git a/.gitignore b/.gitignore index 3bc325a..d8923d4 100644 --- a/.gitignore +++ b/.gitignore @@ -119,3 +119,4 @@ /aarch64-port-jdk8u-shenandoah-aarch64-shenandoah-jdk8u181-b04.tar.xz /aarch64-port-jdk8u-aarch64-jdk8u181-b13.tar.xz /aarch64-port-jdk8u-shenandoah-aarch64-shenandoah-jdk8u181-b13.tar.xz +/systemtap_3.2_tapsets_hg-icedtea8-9d464368e06d.tar.xz diff --git a/generate_singlerepo_source_tarball.sh b/generate_singlerepo_source_tarball.sh new file mode 100644 index 0000000..62218ba --- /dev/null +++ b/generate_singlerepo_source_tarball.sh @@ -0,0 +1,145 @@ +#!/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, you may be enough by setting OPENJDK_URL +# if you wont to use local copy of patch PR2126 set path to it to PR2126 variable +# +# In any case you have to set PROJECT_NAME REPO_NAME and VERSION. eg: +# PROJECT_NAME=jdk +# REPO_NAME=jdk +# VERSION=tip +# or to eg 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 +# + +if [ ! "x$PR2126" = "x" ] ; then + if [ ! -f "$PR2126" ] ; then + echo "You have specified PR2126 as $PR2126 but it does not exists. exiting" + exit 1 + fi +fi + +set -e + +OPENJDK_URL_DEFAULT=http://hg.openjdk.java.net +COMPRESSION_DEFAULT=xz + +if [ "x$1" = "xhelp" ] ; then + echo -e "Behaviour may be specified by setting the following variables:\n" + 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 Mercurial repository to archive (optional; defaults to OPENJDK_URL/PROJECT_NAME/REPO_NAME)" + echo "TO_COMPRESS - what part of clone to pack (default is openjdk)" + echo "PR2126 - the path to the PR2126 patch to apply (optional; downloaded if unavailable)" + exit 1; +fi + + +if [ "x$VERSION" = "x" ] ; then + echo "No VERSION specified" + exit -2 +fi +echo "Version: ${VERSION}" + +# 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 + 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 + # 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} + echo "No file name root specified; default to ${FILE_NAME_ROOT}" +fi +if [ "x$REPO_ROOT" = "x" ] ; then + REPO_ROOT="${OPENJDK_URL}/${PROJECT_NAME}/${REPO_NAME}" + echo "No repository root specified; default to ${REPO_ROOT}" +fi; + +if [ "x$TO_COMPRESS" = "x" ] ; then + TO_COMPRESS="openjdk" + echo "No to be compressed targets specified, ; default to ${TO_COMPRESS}" +fi; + +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} +else + mkdir "${FILE_NAME_ROOT}" + pushd "${FILE_NAME_ROOT}" + echo "Cloning ${VERSION} root repository from ${REPO_ROOT}" + hg clone ${REPO_ROOT} openjdk -r ${VERSION} + popd +fi +pushd "${FILE_NAME_ROOT}" + if [ -d openjdk/src ]; then + pushd openjdk + echo "Removing EC source code we don't build" + CRYPTO_PATH=src/jdk.crypto.ec/share/native/libsunec/impl + rm -vrf $CRYPTO_PATH + echo "Syncing EC list with NSS" + if [ "x$PR2126" = "x" ] ; then + # orriginally for 8: + # get pr2126.patch (from http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=8d2c9a898f50) from most correct tag + # Do not push it or publish it (see http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2126) + # there is currnetly no "upstram version of this patch, hardcoding custom version + PR2126="../../pr2126-11.patch" + fi; + echo "Applying ${PR2126}" + patch -Np1 < $PR2126 + find . -name '*.orig' -exec rm -vf '{}' ';' + popd + fi + + echo "Compressing remaining forest" + if [ "X$COMPRESSION" = "Xxz" ] ; then + SWITCH=cJf + else + SWITCH=czf + fi + tar --exclude-vcs -$SWITCH ${FILE_NAME_ROOT}.tar.${COMPRESSION} $TO_COMPRESS + mv ${FILE_NAME_ROOT}.tar.${COMPRESSION} .. +popd +echo "Done. You may want to remove the uncompressed version - $FILE_NAME_ROOT." + + diff --git a/generate_tarballs.sh b/generate_tarballs.sh deleted file mode 100755 index 0c5930d..0000000 --- a/generate_tarballs.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -VERSION=3506c375241e -ICEDTEA_URL=http://icedtea.classpath.org/hg/icedtea7/ - -wget -O icedtea7.tar.gz ${ICEDTEA_URL}/archive/${VERSION}.tar.gz -tar xzf icedtea7.tar.gz -rm -f icedtea7.tar.gz -pushd icedtea7-${VERSION} - -# desktop files -#mv jconsole.desktop ../jconsole.desktop.in -#mv policytool.desktop ../policytool.desktop.in -# Icons were generally cloned fromicedtea, but now are mucvh more specific - -# tapsets -mv tapset/hotspot{,-1.8.0}.stp.in || exit 1 -mv tapset/hotspot_gc{,-1.8.0}.stp.in || exit 1 -mv tapset/hotspot_jni{,-1.8.0}.stp.in || exit 1 -mv tapset/jstack{,-1.8.0}.stp.in || exit 1 -tar cvzf systemtap-tapset.tar.gz tapset -mv systemtap-tapset.tar.gz ../ - -popd -rm -rf icedtea7-${VERSION} diff --git a/java-1.8.0-openjdk.spec b/java-1.8.0-openjdk.spec index 3e3e9a0..e86860b 100644 --- a/java-1.8.0-openjdk.spec +++ b/java-1.8.0-openjdk.spec @@ -236,7 +236,6 @@ %global priority %(TIP=1800%{updatever}; echo ${TIP/tip/999}) %global javaver 1.%{majorver}.0 -%global systemtap_javaver 9 # parametrized macros are order-sensitive %global compatiblename %{name} @@ -1009,11 +1008,10 @@ Source1: %{shenandoah_project}-%{shenandoah_repo}-%{shenandoah_revision}.tar.xz # Custom README for -src subpackage Source2: README.md -# Use 'generate_tarballs.sh' to generate the following tarballs -# They are based on code contained in the IcedTea project (3.x) -# Systemtap tapsets. Zipped up to keep it small -Source8: systemtap-tapset-3.6.0pre02.tar.xz +# run update_systemtap.sh to regenerate or update systemtap sources +# update_package.sh contains hard-coded repos, revisions, tags, and projects to regenerate the source archives +Source8: systemtap_3.2_tapsets_hg-icedtea8-9d464368e06d.tar.xz # Desktop files. Adapted from IcedTea Source9: jconsole.desktop.in @@ -1657,7 +1655,7 @@ popd # Extract systemtap tapsets %if %{with_systemtap} -tar -x -I xz -f %{SOURCE8} +tar --strip-components=1 -x -I xz -f %{SOURCE8} %if %{include_debug_build} cp -r tapset tapset%{debug_suffix} %endif @@ -1665,7 +1663,7 @@ cp -r tapset tapset%{debug_suffix} for suffix in %{build_loop} ; do for file in "tapset"$suffix/*.in; do - OUTPUT_FILE=`echo $file | sed -e "s:%{systemtap_javaver}\.stp\.in$:%{version}-%{release}.%{_arch}.stp:g"` + OUTPUT_FILE=`echo $file | sed -e "s:\.stp\.in$:%{version}-%{release}.%{_arch}.stp:g"` sed -e "s:@ABS_SERVER_LIBJVM_SO@:%{_jvmdir}/%{sdkdir -- $suffix}/jre/lib/%{archinstall}/server/libjvm.so:g" $file > $file.1 # TODO find out which architectures other than i686 have a client vm %ifarch %{ix86} diff --git a/sources b/sources index c3c111b..a9a9f44 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (systemtap-tapset-3.6.0pre02.tar.xz) = 848f42ef7ca751e723fd50e3a6da14c0965ad4da37ea3331568658e27497b7a7e4b9aad3dedd264ad0bb5566c37a92302b905f10258a4e2c89dc4ba609e55481 +SHA512 (systemtap_3.2_tapsets_hg-icedtea8-9d464368e06d.tar.xz) = cf578221b77d8c7e019f69909bc86c419c5fb5e10bceba9592ff6e7f96887b0a7f07c9cefe90800975247a078785ca190fdec5c2d0f841bb447cee784b570f7d SHA512 (aarch64-port-jdk8u-aarch64-jdk8u181-b13.tar.xz) = d22ddb8b0b76faa18067fe383a147345be5fe1bad77b50940ff2993f3356166143e5ac9e14d9ead4437c13b00c6b2a5c62093ad57645da15a3419238990a74ac SHA512 (aarch64-port-jdk8u-shenandoah-aarch64-shenandoah-jdk8u181-b13.tar.xz) = b5611a5b13a8aa3c0e07e015e39b11241f96124bb9454d4151c54d4e9af004ea038cc3a27e3b9099b3061bb9225cb298551e0e726f79bc9bc9837aa912f1586c diff --git a/update_package.sh b/update_main_sources.sh similarity index 100% rename from update_package.sh rename to update_main_sources.sh diff --git a/update_systemtap.sh b/update_systemtap.sh new file mode 100644 index 0000000..1a3e3c8 --- /dev/null +++ b/update_systemtap.sh @@ -0,0 +1,32 @@ +#!/bin/bash -x +# this file contains defaults for currently generated source tarball of systemtap + +set -e + +# TAPSET +export PROJECT_NAME="hg" +export REPO_NAME="icedtea8" +export VERSION="9d464368e06d" +export COMPRESSION=xz +export OPENJDK_URL=http://icedtea.classpath.org +export FILE_NAME_ROOT=${PROJECT_NAME}-${REPO_NAME}-${VERSION} +export TO_COMPRESS="*/tapset" +# warning, filename and filenameroot creation is duplicated here from generate_source_tarball.sh +CLONED_FILENAME=${FILE_NAME_ROOT}.tar.${COMPRESSION} +TAPSET_VERSION=3.2 +TAPSET=systemtap_"$TAPSET_VERSION"_tapsets_$CLONED_FILENAME +if [ ! -f ${TAPSET} ] ; then + if [ ! -f ${CLONED_FILENAME} ] ; then + echo "Generating ${CLONED_FILENAME}" + sh ./generate_singlerepo_source_tarball.sh + else + echo "exists exists exists exists exists exists exists " + echo "reusing reusing reusing reusing reusing reusing " + echo ${CLONED_FILENAME} + fi + mv -v $CLONED_FILENAME $TAPSET +else + echo "exists exists exists exists exists exists exists " + echo "reusing reusing reusing reusing reusing reusing " + echo ${TAPSET} +fi