From 5ddc1621e2e66c0ffb5c27b9ffea2828850734c3 Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Dec 08 2015 11:55:18 +0000 Subject: changed way of generating the sources --- diff --git a/.gitignore b/.gitignore index 64328db..ec0ea22 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ /jdk8-aarch64-jdk8u60-b24.2.tar.xz /jdk8u60-aarch64-jdk8u60-b28.tar.xz /jdk8u60-aarch64-jdk8u65-b17.tar.xz +/aarch64-port-jdk8u60-aarch64-jdk8u65-b17.tar.xz diff --git a/generate_source_tarball.sh b/generate_source_tarball.sh index 8330365..7b67da2 100755 --- a/generate_source_tarball.sh +++ b/generate_source_tarball.sh @@ -1,82 +1,91 @@ -#!/bin/bash +#!/bin/bash -x # Generates the 'source tarball' for JDK 8 projects. # -# Usage: generate_source_tarball.sh project_name repo_name tag +# Example: +# When used from local repo set REPO_ROOT pointing to file:// wth 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 # -# Examples: -# sh generate_source_tarball.sh jdk8u jdk8u40 jdk8u40-b25 -# ./generate_source_tarball.sh jdk8 jdk8 jdk8-b79 -# ./generate_source_tarball.sh jdk8u jdk8u jdk8u5-b13 -# ./generate_source_tarball.sh aarch64-port jdk8 aarch64-${DATE} -# ./generate_source_tarball.sh aarch64-port jdk8 aarch64-jdk8u60-b24.2 -# ./generate_source_tarball.sh jdk8u jdk8u60 jdk8u60-b27 +# In any case you have to set PROJECT_NAME REPO_NAME and VERSION. eg: +# PROJECT_NAME=jdk8u OR aarch64-port +# REPO_NAME=jdk8u60 OR jdk8u60 +# VERSION=jdk8u60-b27 OR aarch64-jdk8u65-b17 OR for head, keyword 'tip' should do the job there +# +# 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. For +# 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. +# level folder, name is created, based on parameter +# set -e -PROJECT_NAME="$1" -REPO_NAME="$2" -VERSION="$3" -OPENJDK_URL=http://hg.openjdk.java.net - -if [[ "${PROJECT_NAME}" = "" ]] ; then - echo "No repository specified." - exit -1 +if [ "x$PROJECT_NAME" = "x" ] ; then + echo "no PROJECT_NAME" + exit 1 fi -if [[ "${REPO_NAME}" = "" ]] ; then - echo "No repository specified." - exit -1 +if [ "x$REPO_NAME" = "x" ] ; then + echo "no REPO_NAME" + exit 2 fi -if [[ "${VERSION}" = "" ]]; then - echo "No version/tag specified." - exit -1; +if [ "x$VERSION" = "x" ] ; then + echo "no VERSION" + exit 3 +fi +if [ "x$OPENJDK_URL" = "x" ] ; then + OPENJDK_URL=http://hg.openjdk.java.net fi -mkdir "${REPO_NAME}" -pushd "${REPO_NAME}" - -REPO_ROOT="${OPENJDK_URL}/${PROJECT_NAME}/${REPO_NAME}" +if [ "x$COMPRESSION" = "x" ] ; then +# rhel 5 needs tar.gz + COMPRESSION=xz +fi +if [ "x$FILE_NAME_ROOT" = "x" ] ; then + FILE_NAME_ROOT=${PROJECT_NAME}-${REPO_NAME}-${VERSION} +fi +if [ "x$REPO_ROOT" = "x" ] ; then + REPO_ROOT="${OPENJDK_URL}/${PROJECT_NAME}/${REPO_NAME}" +fi; -wget "${REPO_ROOT}/archive/${VERSION}.tar.gz" -tar xf "${VERSION}.tar.gz" -rm "${VERSION}.tar.gz" +mkdir "${FILE_NAME_ROOT}" +pushd "${FILE_NAME_ROOT}" -mv "${REPO_NAME}-${VERSION}" openjdk +hg clone ${REPO_ROOT} openjdk -r ${VERSION} pushd openjdk - -repos="corba hotspot jdk jaxws jaxp langtools nashorn" -if [ aarch64-port = $PROJECT_NAME ] ; then -#tmp disable because of jdk8-aarch64-jdk8u60-b24.2 -echo NOT -#repos="hotspot" -fi; + +#jdk is last for its size +repos="hotspot corba jaxws jaxp langtools nashorn jdk" for subrepo in $repos do - wget "${REPO_ROOT}/${subrepo}/archive/${VERSION}.tar.gz" - tar xf "${VERSION}.tar.gz" - rm "${VERSION}.tar.gz" - mv "${subrepo}-${VERSION}" "${subrepo}" + hg clone ${REPO_ROOT}/${subrepo} -r ${VERSION} done + echo "Removing EC source code we don't build" rm -vrf jdk/src/share/native/sun/security/ec/impl -#get this file http://icedtea.classpath.org/hg/icedtea/raw-file/tip/patches/pr2126.patch (from http://icedtea.classpath.org//hg/icedtea?cmd=changeset;node=8d2c9a898f50) -#from most correct tag -#and use it like below. Do not push it or publish it (see http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2126) -pwd echo "Syncing EC list with NSS" -patch -Np1 < ../../pr2126.patch +if [ "x$PR2126" = "x" ] ; then +# 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) + wget http://icedtea.classpath.org/hg/icedtea/raw-file/tip/patches/pr2126.patch + patch -Np1 < pr2126.patch + rm pr2126.patch +else + patch -Np1 < $PR2126 +fi; popd -tar cJf ${REPO_NAME}-${VERSION}.tar.xz openjdk +if [ "X$COMPRESSION" = "Xxz" ] ; then + tar --exclude-vcs -cJf ${FILE_NAME_ROOT}.tar.${COMPRESSION} openjdk +else + tar --exclude-vcs -czf ${FILE_NAME_ROOT}.tar.${COMPRESSION} openjdk +fi +mv ${FILE_NAME_ROOT}.tar.${COMPRESSION} .. popd -mv "${REPO_NAME}/${REPO_NAME}-${VERSION}.tar.xz" . + diff --git a/java-1.8.0-openjdk.spec b/java-1.8.0-openjdk.spec index 7c8cbdb..6f0e44a 100644 --- a/java-1.8.0-openjdk.spec +++ b/java-1.8.0-openjdk.spec @@ -116,12 +116,19 @@ # Standard JPackage naming and versioning defines. %global origin openjdk -%global updatever 65 -%global buildver b17 -%global aarch64_updatever %{updatever} -%global aarch64_buildver %{buildver} -# priority must be 7 digits in total -%global priority 18000%{updatever} +# note, following three variables are sedded from update_sources if used correctly. Hardcode them rather there. +%global project aarch64-port +%global repo jdk8u60 +%global revision aarch64-jdk8u65-b17 +# eg # jdk8u60-b27 -> jdk8u60 or # aarch64-jdk8u60-b27 -> aarch64-jdk8u60 (dont forget spec escape % by %%) +%global whole_update %(VERSION=%{revision}; echo ${VERSION%%-*}) +# eg jdk8u60 -> 60 or aarch64-jdk8u60 -> 60 +%global updatever %(VERSION=%{whole_update}; echo ${VERSION##*u}) +# eg jdk8u60-b27 -> b27 +%global buildver %(VERSION=%{revision}; echo ${VERSION##*-}) +# priority must be 7 digits in total. The expression is workarounding tip +%global priority %(TIP=18000%{updatever}; echo ${TIP/tip/99}) + %global javaver 1.8.0 # parametrized macros are order-sensitive @@ -690,7 +697,7 @@ Obsoletes: java-1.7.0-openjdk-accessibility%1 Name: java-%{javaver}-%{origin} Version: %{javaver}.%{updatever} -Release: 5.%{buildver}%{?dist} +Release: 7.%{buildver}%{?dist} # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons, # and this change was brought into RHEL-4. java-1.5.0-ibm packages # also included the epoch in their virtual provides. This created a @@ -711,7 +718,7 @@ URL: http://openjdk.java.net/ # Source from upstrem OpenJDK8 project. To regenerate, use # aarch64-port now contains integration forest of both aarch64 and normal jdk # ./generate_source_tarball.sh aarch64-port jdk8u60 aarch64-jdk8u65-b17 -Source0: jdk8u60-aarch64-jdk8u%{updatever}-%{buildver}.tar.xz +Source0: %{project}-%{repo}-%{revision}.tar.xz # Custom README for -src subpackage Source2: README.src @@ -1151,7 +1158,7 @@ bash ../../configure \ --with-update-version=%{updatever} \ --with-build-number=%{buildver} \ %ifarch %{aarch64} - --with-user-release-suffix="aarch64-%{aarch64_updatever}-%{aarch64_buildver}" \ + --with-user-release-suffix="aarch64-%{updatever}-%{buildver}" \ %endif --with-boot-jdk=/usr/lib/jvm/java-openjdk \ --with-debug-level=$debugbuild \ @@ -1740,6 +1747,11 @@ end %endif %changelog +Tue Dec 08 2015 Jiri Vanek - 1:1.8.0.65-7.b17 +- changed way of generating the sources. As result: +- "updated" to aarch64-jdk8u65-b17 (from aarch64-port/jdk8u60) +- used aarch64-port-jdk8u60-aarch64-jdk8u65-b17.tar.xz as new sources + * Fri Nov 27 2015 Jiri Vanek - 1:1.8.0.65-5.b17 - added missing md5sums - moved to bundeld lcms diff --git a/sources b/sources index 719a609..0dd43a7 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ 94ca5a45c3cb3b85c4577d0891166007 systemtap-tapset.tar.gz -bfed7e2cf1b9a6718a2d91421c47e43b jdk8u60-aarch64-jdk8u65-b17.tar.xz +f6ee06389f8ac0890ce5d003b2c0fb0a aarch64-port-jdk8u60-aarch64-jdk8u65-b17.tar.xz diff --git a/update_package.sh b/update_package.sh new file mode 100755 index 0000000..d453e48 --- /dev/null +++ b/update_package.sh @@ -0,0 +1,136 @@ +#!/bin/bash -x +# Generates the 'source tarball' for JDK 8 projects and update spec infrastructure +# By default, this script regenerate source as they are currently used. +# so if the version of sources change, this file changes and is pushed +# +# In any case you have to set PROJECT_NAME REPO_NAME and VERSION. eg: +# PROJECT_NAME=jdk8u OR aarch64-port +# REPO_NAME=jdk8u60 OR jdk8u60 +# VERSION=jdk8u60-b27 OR aarch64-jdk8u65-b17 OR for head, keyword 'tip' should do the job there +# +# If you don't, default are used and so already uploaded tarball regenerated +# They are used to create correct name and are used in construction of sources url (unless REPO_ROOT is set) +# +# For other useful variables see generate_source_tarball.sh +# +# the used values are then substituted to spec and sources + +set -e + +if [ "x$PROJECT_NAME" = "x" ] ; then + PROJECT_NAME="aarch64-port" +fi +if [ "x$REPO_NAME" = "x" ] ; then + REPO_NAME="jdk8u60" +fi +if [ "x$VERSION" = "x" ] ; then + VERSION="aarch64-jdk8u65-b17" +fi + +if [ "x$COMPRESSION" = "x" ] ; then +# rhel 5 needs tar.gz + COMPRESSION=xz +fi +if [ "x$FILE_NAME_ROOT" = "x" ] ; then + FILE_NAME_ROOT=${PROJECT_NAME}-${REPO_NAME}-${VERSION} +fi +if [ "x$PKG" = "x" ] ; then + URL=`cat .git/config | grep url` + PKG=${URL##*/} +fi +if [ "x$SPEC" = "x" ] ; then + SPEC=${PKG}.spec +fi +if [ "x$RELEASE" = "x" ] ; then + RELEASE=1 +fi + +FILENAME=${FILE_NAME_ROOT}.tar.${COMPRESSION} + +if [ ! -f ${FILENAME} ] ; then +echo "Generating ${FILENAME}" +. ./generate_source_tarball.sh +else +echo "${FILENAME} already exists, using" +fi + + +echo "Touching spec: $SPEC" +sed -i "s/^%global\s\+project.*/%global project ${PROJECT_NAME}/" $SPEC +sed -i "s/^%global\s\+repo.*/%global repo ${REPO_NAME}/" $SPEC +sed -i "s/^%global\s\+revision.*/%global revision ${VERSION}/" $SPEC +# updated sources, resetting release +sed -i "s/^Release:.*/Release: $RELEASE.%{buildver}%{?dist}/" $SPEC + +git --no-pager diff $SPEC + +#https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#Bash +function levenshtein { + if [ "$#" -ne "2" ]; then + echo "Usage: $0 word1 word2" >&2 + elif [ "${#1}" -lt "${#2}" ]; then + levenshtein "$2" "$1" + else + local str1len=$((${#1})) + local str2len=$((${#2})) + local d i j + for i in $(seq 0 $(((str1len+1)*(str2len+1)))); do + d[i]=0 + done + for i in $(seq 0 $((str1len))); do + d[$((i+0*str1len))]=$i + done + for j in $(seq 0 $((str2len))); do + d[$((0+j*(str1len+1)))]=$j + done + + for j in $(seq 1 $((str2len))); do + for i in $(seq 1 $((str1len))); do + [ "${1:i-1:1}" = "${2:j-1:1}" ] && local cost=0 || local cost=1 + local del=$((d[(i-1)+str1len*j]+1)) + local ins=$((d[i+str1len*(j-1)]+1)) + local alt=$((d[(i-1)+str1len*(j-1)]+cost)) + d[i+str1len*j]=$(echo -e "$del\n$ins\n$alt" | sort -n | head -1) + done + done + echo ${d[str1len+str1len*(str2len)]} + fi +} + +# find the most similar sources name and replace it by newly generated one. +echo "Old sources" +cat sources +a_sources=`cat sources | sed "s/.*\s\+//g"` +winner="" +winnerDistance=999999 +for x in $a_sources ; do + distance=`levenshtein $x ${FILENAME}` + if [ $distance -lt $winnerDistance ] ; then + winner=$x + winnerDistance=$distance + fi +done +sum=`md5sum ${FILENAME}` +sed -i "s;.*$winner;$sum;" sources +echo "New sources" +cat sources +a_sources=`cat sources | sed "s/.*\s\+//g"` +echo " you can get inspired by following %changelog template:" +user_name=`whoami` +user_record=$(getent passwd $user_name) +user_gecos_field=$(echo "$user_record" | cut -d ':' -f 5) +user_full_name=$(echo "$user_gecos_field" | cut -d ',' -f 1) +spec_date=`date +"%a %b %d %Y"` +# See spec: +revision_helper=`echo ${VERSION%-*}` +updatever=`echo ${revision_helper##*u}` +buildver=`echo ${VERSION##*-}` +echo "$spec_date $user_full_name <$user_name@redhat.com> - 1:1.8.0.$updatever-$RELEASE.$buildver" +echo "- updated to $VERSION (from $PROJECT_NAME/$REPO_NAME)" +echo "- used $FILENAME as new sources" + +echo " execute:" +echo "fedpkg/rhpkg new-sources "$a_sources +echo " to upload sources" +echo "you can verify by fedpkg/rhpkg prep --arch XXXX on all architectures: x86_64 i386 i586 i686 ppc ppc64 ppc64le s390 s390x aarch64 armv7hl" +