From f2ac8286c1f931090142e4bd6ee298fda5c5d63e Mon Sep 17 00:00:00 2001 From: George Adams Date: Fri, 1 Mar 2024 10:45:13 +0000 Subject: [PATCH 1/3] Allow branch to be overridden by an env var This is required for the jdk11u risc-v port mirror which doesn't use the master branch --- skaraMirror.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skaraMirror.sh b/skaraMirror.sh index 5f859bc..790440d 100755 --- a/skaraMirror.sh +++ b/skaraMirror.sh @@ -273,7 +273,7 @@ checkArgs $# SKARA_REPO="https://github.com/openjdk/$1" GITHUB_REPO="$1" REPO=${2:-"git@github.com:adoptium/$GITHUB_REPO"} -BRANCH="master" +: ${BRANCH:="master"} GITHUB_REPO_REMOVE_aarch32=${GITHUB_REPO#"aarch32"} VERSION=${GITHUB_REPO_REMOVE_aarch32//[!0-9]/} From 4e2f4e09f86c78ab340e355aad588868e0f63430 Mon Sep 17 00:00:00 2001 From: George Adams Date: Sun, 7 Apr 2024 09:36:54 +0100 Subject: [PATCH 2/3] cleanup redundant mercurial scripts --- CODE_OF_CONDUCT.md | 79 ----- common.sh | 57 ---- diff-without-getsource.sh | 89 ----- diff.sh | 116 ------- freebsdRepoSync.sh | 97 ------ import-common.sh | 50 --- jdk8u/buildAarch64Repo.sh | 95 ------ jdk8u/buildRepo.sh | 110 ------ jdk8u/constants.sh | 24 -- jdk8u/createNextTag.sh | 48 --- jdk8u/merge.sh | 320 ------------------ jdk8u/updateRepo.sh | 36 -- mercurialToGit.sh | 265 --------------- .../jdk8u}/0001-Backport-8073139.patch | 0 .../jdk8u}/0001-Set-vendor-information.patch | 0 .../jdk8u}/company_name.patch | 0 .../patches => patches/jdk8u}/ppc64le_1.patch | 0 .../patches => patches/jdk8u}/ppc64le_2.patch | 0 update.sh | 82 ----- 19 files changed, 1468 deletions(-) delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 common.sh delete mode 100755 diff-without-getsource.sh delete mode 100755 diff.sh delete mode 100755 freebsdRepoSync.sh delete mode 100755 import-common.sh delete mode 100755 jdk8u/buildAarch64Repo.sh delete mode 100755 jdk8u/buildRepo.sh delete mode 100755 jdk8u/constants.sh delete mode 100755 jdk8u/createNextTag.sh delete mode 100755 jdk8u/merge.sh delete mode 100755 jdk8u/updateRepo.sh delete mode 100755 mercurialToGit.sh rename {jdk8u/patches => patches/jdk8u}/0001-Backport-8073139.patch (100%) rename {jdk8u/patches => patches/jdk8u}/0001-Set-vendor-information.patch (100%) rename {jdk8u/patches => patches/jdk8u}/company_name.patch (100%) rename {jdk8u/patches => patches/jdk8u}/ppc64le_1.patch (100%) rename {jdk8u/patches => patches/jdk8u}/ppc64le_2.patch (100%) delete mode 100755 update.sh diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 7b998c1..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,79 +0,0 @@ -# Community Code of Conduct - -**Version 1.1 -October 21, 2019** - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to make participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, sex characteristics, gender identity and expression, -level of experience, education, socio-economic status, nationality, personal -appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies within all project spaces, and it also applies when -an individual is representing the project or its community in public spaces. -Examples of representing a project or community include using an official -project e-mail address, posting via an official social media account, or acting -as an appointed representative at an online or offline event. Representation of -a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at codeofconduct@eclipse.org. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see -https://www.contributor-covenant.org/faq diff --git a/common.sh b/common.sh deleted file mode 100644 index 224380f..0000000 --- a/common.sh +++ /dev/null @@ -1,57 +0,0 @@ -# TODO generalise this for the non adoptium build farm case -function checkArgs() { - if [ "$1" -lt 1 ]; then - echo Usage: "$0" '[jdk8u|jdk11u|jdk17u|jdk19u|...]' - echo "Skara Repo supplied should match a repository in https://github.com/openjdk/" - echo "For example, to mirror https://github.com/openjdk/jdk17u" - echo "e.g. $0 jdk17u" - exit 1 - fi -} - -function cloneGitHubRepo() { - cd "$WORKSPACE" || exit 1 - GITHUB_REPO=$1 # https://github.com/adoptium/adoptium/jdk17u.git - if [ ! -d "$JDKVERSION" ] ; then - echo "First time clone repo $GITHUB_REPO" - git clone -q "$GITHUB_REPO" || exit 1 - else - cd "$JDKVERSION" && git clean -fd && git fetch --all --tags - fi -} - -function readExpectedGATag() { - source ${SCRIPT_DIR}/releasePlan.cfg - jdkVersion=$1 # e.g jdk17u - gaTagVariable="${jdkVersion}GA" # set gaTagVariable=jdk17uGA match releasePlan.cfg - expectedTag=${!gaTagVariable} # get value, e.g: expectedTag=jdk-17.0.6 - echo ${expectedTag} -} - -# this function is not in use, due to agent does not have "jq" to parse json payload -function queryGHAPI(){ - repo=$1 # adoptium/jdk8u, openjdk/jdk8u - tag=$2 # jdk8u362-b05_adopt, jdk8u362-ga - exist="$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/${repo}/git/refs/tags/${tag}")" - if [ $exist == "200" ]; then - echo "Found tag: ${tag} in ${repo}" - else - echo "Cannot find tag: ${tag} in ${repo}" - fi - echo ${exist} -} - -# to check if the same _adopt scmReference tag has been used to trigger a release pipeline in the past -# if yes, wont trigger; if not, do the first time trigger -function checkPrevious() { - if [ -f ${WORKSPACE}/tracking ]; then # already have tracking from previous - local scmRef=$1 # _adopt scmReference tag we have found - local trackerTag="$(cut -d '=' -f 2 ${WORKSPACE}/tracking)" # previousSCM=jdk-17.0.5+8_adopt - - if [[ "${scmRef}" == "${trackerTag}" ]]; then - echo "Release tag ${trackerTag} has triggered a release pipeline build already in the current release" - echo "Will not continue job" - exit 0 - fi - fi -} diff --git a/diff-without-getsource.sh b/diff-without-getsource.sh deleted file mode 100755 index 1cc73c4..0000000 --- a/diff-without-getsource.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -################################################################################ -# diff-without-getsource -# -# For finding the diff between an AdoptOpenJDK Git repo and the OpenJDK Mercurial -# Repo for Java versions >= jdk10 -# -# 1. Clones the AdoptOpenJDK Git repo for a particular version -# 2. Clones the OpenJDK Mercurial repo for that same version -# 3. Runs a diff between the two -# -########################### - -set -euo pipefail - -function checkArgs() { - if [ $# -lt 3 ]; then - echo Usage: "$0" '[Adoptium Git Repo Version] [OpenJDK Mercurial Root Forest] [OpenJDK Mercurial Version]' - echo "" - echo "e.g. ./diff-without-getsource.sh jdk10u jdk-updates jdk10u" - echo "" - exit 1 - fi -} - -checkArgs $@ - -git_repo_version=$1 -hg_root_forest=$2 -hg_repo_version=$3 - -function cleanUp() { - rm -rf openjdk-git openjdk-hg || true -} - -function cloneRepos() { - echo "Adoptium Git Repo Version: ${git_repo_version}" - echo "OpenJDK Mercurial Repo Version: ${hg_root_forest}/${hg_repo_version}" - - git clone -b master "https://github.com/adoptium/${git_repo_version}.git" openjdk-git || exit 1 - hg clone "https://hg.openjdk.java.net/${hg_root_forest}/${hg_repo_version}" openjdk-hg || exit 1 -} - -function runDiff() { - diffNum=$(diff -rq openjdk-git openjdk-hg -x '.git' -x '.hg' -x '.hgtags' | wc -l) - - if [ "$diffNum" -gt 0 ]; then - echo "ERROR - THE DIFF HAS DETECTED UNKNOWN FILES" - diff -rq openjdk-git openjdk-hg -x '.git' -x '.hg' -x '.hgtags' | grep 'only in' || exit 1 - exit 1 - fi -} - -function checkTags() { - - cd openjdk-git || exit 1 - gitTag=$(git describe --tags "$(git rev-list --tags --max-count=1)") || exit 1 - cd - || exit 1 - - cd openjdk-hg || exit 1 - hgTag=$(hg log -r "." --template "{latesttag}\n") || exit 1 - cd - || exit 1 - - if [ "$gitTag" == "$hgTag" ]; then - echo "Tags are in sync" - else - echo "ERROR - THE TAGS ARE NOT IN SYNC" - exit 1 - fi -} - -cleanUp -cloneRepos -runDiff -checkTags \ No newline at end of file diff --git a/diff.sh b/diff.sh deleted file mode 100755 index 70ae9ae..0000000 --- a/diff.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -################################################################################ -# diff -# -# For finding the diff between an Adoptium Git repo and the OpenJDK Mercurial -# Repo for Java versions <= jdk9u -# -# 1. Clones the Adoptium Git repo for a particular version -# 2. Clones the OpenJDK Mercurial repo for that same version -# 3. Runs a diff between the two -# -################################################################################ - -set -euxo pipefail - -function checkArgs() { - if [ $# -lt 2 ]; then - echo Usage: "$0" '[AdoptOpenJDK Git Repo Version] [OpenJDK Mercurial Root Forest Name] [OpenJDK Mercurial Root Forest Version] [Tag Name] [Allowed Change Size]' - echo "" - echo "e.g. ./diff.sh jdk8u jdk8u jdk8u or ./diff.sh jdk9u jdk-updates jdk9u" - echo "" - exit 1 - fi -} - -checkArgs $@ - -git_repo_version=$1 -hg_root_forest=${2:-${1}} # for backwards compatibility -hg_repo_version=${3:-${hg_root_forest}} # for backwards compatibility -tag=${4:-} # tag to check -expectedDiffLimit=${5:-0} # Number of lines that the full-diff file can be before an error is reported - -function cleanUp() { - rm -rf openjdk-git openjdk-hg || true -} - -function cloneRepos() { - echo "Adoptium Git Repo Version: ${git_repo_version}" - echo "OpenJDK Mercurial Repo Version: ${hg_root_forest}/${hg_repo_version}" - - git clone -b master "https://github.com/adoptium/${git_repo_version}.git" openjdk-git || exit 1 - hg clone "https://hg.openjdk.java.net/${hg_root_forest}/${hg_repo_version}" openjdk-hg || exit 1 - - if [ -n "${tag}" ]; then - cd openjdk-hg - hg update $tag - cd ../openjdk-git - git fetch --all - git checkout $tag - cd .. - else - # By default compare the dev branch - cd ./openjdk-git - git fetch --all - git checkout dev - cd .. - fi -} - -function updateMercurialClone() { - local rootDir=$(pwd) - - cd "${rootDir}/openjdk-hg" || exit 1 - if [ -f get_source.sh ]; then - chmod u+x get_source.sh - ./get_source.sh - - if [ -n "${tag}" ]; then - MODULES=(corba langtools jaxp jaxws nashorn jdk hotspot) - - hg update $tag - for module in "${MODULES[@]}" ; do - cd "${rootDir}/openjdk-hg/${module}" - hg update $tag - done - fi - fi - - cd $rootDir || exit 1 -} - -function runDiff() { - - local diffArgs="openjdk-git openjdk-hg -x '.git' -x '.hg' -x '.hgtags' -x '.hgignore' -x 'get_source.sh' -x 'README.md'" - set +e - diff -r $diffArgs > full-changes.diff - diff -rq $diffArgs > changes.diff - set -e - - diffNum=$(wc -l < full-changes.diff) - - if [ "$diffNum" -gt ${expectedDiffLimit} ]; then - echo "ERROR - THE DIFF IS TOO LARGE, EXAMINE full-changes.diff" - exit 1 - fi -} - -cleanUp -cloneRepos -updateMercurialClone -runDiff diff --git a/freebsdRepoSync.sh b/freebsdRepoSync.sh deleted file mode 100755 index 8746cb8..0000000 --- a/freebsdRepoSync.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env bash - -# Script to facilitate automatic merging of changes from the AdoptOpenJDK -# repos into child repos - -# The reference AdoptOpenJDK repos -export ADOPT_REPO_PATH=git@github.com:AdoptOpenJDK -# This script could be made to sync any child by passing this in as an arg -export CHILD_REPO_PATH=git@github.com:freebsd -# Branch to be synchronised -# Note: the dev branch is the branch that AdoptOpenJDK builds from -export SYNC_BRANCH=dev - -# How to use this script -usage() { - echo "Usage: sync " 1>&2 - echo "Where is a valid Java version, e.g. 8, 11" 1>&2 -} - -# Initialise the repo to be sync'ed -initRepo() { - if [ -d ${REPO} ]; then - cd ${REPO} - # Some local changes may prevent a pull from succeeding - # To avoid that, reset the repo here - git reset --hard origin/${SYNC_BRANCH} || exit 1 - git pull || exit 1 - else - git clone ${CHILD_REPO_PATH}/${REPO}.git || exit 1 - cd ${REPO} - git checkout ${SYNC_BRANCH} || exit 1 - fi -} - -# Verify that we have a parent -verifyParent() { - if ! git config remote.upstream.url > /dev/null; then - git remote add upstream ${ADOPT_REPO_PATH}/${REPO}.git || exit 1 - fi - - if [ "x$(git config remote.upstream.url)" != "x${ADOPT_REPO_PATH}/${REPO}.git" ]; then - echo "WARNING: 'upstream' doesn't point to AdoptOpenJDK parent" 1>&2 - fi -} - -# Fetch all parent changes, including tags -fetchParent() { - git fetch --all || exit 1 - git fetch upstream --tags || exit 1 -} - -# Merge in changes from the parent -mergeRepo() { - git merge -m "Merge from Adoptium ${SYNC_BRANCH}" upstream/${SYNC_BRANCH} || exit 1 -} - -# Push -pushMerge() { - git push || exit 1 - git push --tags || exit 1 -} - -export REPO= -case $1 in - 8|9|1[0-9]) - export REPO=openjdk-jdk${1}u - ;; - *) - usage - exit 1 -esac - -echo "Common defs" - -. import-common.sh - -checkGitVersion - -echo "Initialising repo" - -initRepo - -echo "Verifying parent" - -verifyParent - -echo "Fetching parent" - -fetchParent - -echo "Merge changes" - -mergeRepo - -echo "Push" - -pushMerge diff --git a/import-common.sh b/import-common.sh deleted file mode 100755 index 3497f01..0000000 --- a/import-common.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -################################################################################ -# import-common -# -# common functionality for the git-hg scripts -# -################################################################################ - -export modules=(corba langtools jaxp jaxws hotspot nashorn jdk) - -function checkGitVersion() { - git --version || exit 1 - GIT_VERSION=$(git --version | awk '{print$NF}') - GIT_MAJOR_VERSION=$(echo "$GIT_VERSION" | cut -d. -f1) - GIT_MINOR_VERSION=$(echo "$GIT_VERSION" | cut -d. -f2) - [ "$GIT_MAJOR_VERSION" -eq 1 ] && echo I need git version 2.16 or later and you have "$GIT_VERSION" && exit 1 - if [ "$GIT_MAJOR_VERSION" -eq 2 ] && [ "$GIT_MINOR_VERSION" -lt 16 ] ; then - echo I need git version 2.16 or later and you have "$GIT_VERSION" - exit 1 - fi -} - -function installGitRemoteHg() { - if ! which git-remote-hg 2>/dev/null; then - echo "I need git-remote-hg and could not find it" - echo "Getting it from https://raw.githubusercontent.com/felipec/git-remote-hg/master/git-remote-hg" - mkdir -p "$WORKSPACE/bin" - PATH="$PATH:$WORKSPACE/bin" - wget -O "$WORKSPACE/bin/git-remote-hg" "https://raw.githubusercontent.com/felipec/git-remote-hg/master/git-remote-hg" - chmod ugo+x "$WORKSPACE/bin/git-remote-hg" - if ! which git-remote-hg 2>/dev/null; then - echo "Still cannot find it, exiting.." - exit 1 - fi - fi -} diff --git a/jdk8u/buildAarch64Repo.sh b/jdk8u/buildAarch64Repo.sh deleted file mode 100755 index e0064d6..0000000 --- a/jdk8u/buildAarch64Repo.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash - -set -eux - -HG_REPO="https://hg.openjdk.java.net/aarch64-port/jdk8u-shenandoah" - -source constants.sh - -function createTag() { - tag=$1 - - cd $REPO - git tag -d "$tag" || true - git tag -f "$tag" - git branch -D "$tag" || true - git branch "$tag" -} - -cd "$REPO" - -if [ -d ".git" ];then - git reset --hard - git checkout master - git merge --abort || true - git am --abort || true -fi - -cd "$SCRIPT_DIR" - -# update mirrors -./merge.sh -u -s "${HG_REPO}" - -################################################ -## Build master -## Init master to be synced at aarch64-shenandoah-jdk8u191-b12 -./merge.sh -r -T "aarch64-shenandoah-jdk8u191-b12" -s "${HG_REPO}" -################################################ - -################################################ -## Build dev -## dev branch is HEAD track with our patches -cd "$REPO" - -# as repo has just been inited to aarch64-shenandoah-jdk8u191-b12 dev will be at aarch64-shenandoah-jdk8u191-b12 -git checkout -b dev - -# Apply our patches -git am $PATCHES/company_name.patch -git am $PATCHES/0001-Set-vendor-information.patch - -# Update dev to head -cd $SCRIPT_DIR -./merge.sh -T "HEAD" -b "dev" -s "${HG_REPO}" -################################################ - -################################################ -## Push master up to head -cd "$REPO" -git checkout master - -cd $SCRIPT_DIR - -# Update dev to HEAD -./merge.sh -T "HEAD" -b "master" -s "${HG_REPO}" -################################################ - -################################################ -## Build release -## release moves from tag to tag with our patches -cd "$SCRIPT_DIR" - -# sync and tag the release branch as some key milestones -./merge.sh -t -i -T "jdk8u172-b11" -b "release" -s "${HG_REPO}" -./merge.sh -t -T "aarch64-jdk8u181-b13" -b "release" -s "${HG_REPO}" - -# Apply the company patches -cd $REPO -git checkout release -git am --exclude common/autoconf/generated-configure.sh $PATCHES/company_name.patch -git am $PATCHES/0001-Set-vendor-information.patch - -chmod +x ./common/autoconf/autogen.sh -./common/autoconf/autogen.sh -git commit -a -m "autogen" - -# Create a saner looking tag -createTag "jdk8u181-b13" - -cd "$SCRIPT_DIR" -./merge.sh -t -T "aarch64-shenandoah-jdk8u191-b12" -b "release" -s "${HG_REPO}" - -# Create a saner looking tag -createTag "jdk8u191-b12" - -################################################ diff --git a/jdk8u/buildRepo.sh b/jdk8u/buildRepo.sh deleted file mode 100755 index 9c5e268..0000000 --- a/jdk8u/buildRepo.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash - -set -eux - -source constants.sh - -function createTag() { - tag=$1 - git tag -d "$tag" || true - git tag -f "$tag" - git branch -D "$tag" - git branch "$tag" -} - -cd "$REPO" - -if [ -d ".git" ];then - git reset --hard - git checkout master - git merge --abort || true - git am --abort || true -fi - -cd "$SCRIPT_DIR" - -# update mirrors -./merge.sh -u - -################################################ -## Build master -## Init master to be synced at jdk8u181-b13 -./merge.sh -r -T "jdk8u181-b13" -################################################ - -################################################ -## Build dev -## dev branch is HEAD track with our patches -cd "$REPO" - -# as repo has just been inited to jdk8u181-b13 dev will be at jdk8u181-b13 -git checkout -b dev - -# Apply our patches -git am $PATCHES/company_name.patch - -# Update dev to jdk8u192-b12 -cd "$SCRIPT_DIR" -./merge.sh -T "jdk8u192-b12" -b "dev" - -# Apply vendor patch -cd "$REPO" -git am $PATCHES/0001-Set-vendor-information.patch - -# Update dev to head -cd $SCRIPT_DIR -./merge.sh -T "HEAD" -b "dev" -################################################ - -################################################ -## Push master up to head -cd "$REPO" -git checkout master - -cd $SCRIPT_DIR - -# Update dev to HEAD -./merge.sh -T "HEAD" -b "master" -################################################ - -################################################ -## Build release -## release moves from tag to tag with our patches -cd "$SCRIPT_DIR" - -# sync and tag the release branch as some key milestones -./merge.sh -t -i -T "jdk8u144-b34" -b "release" -./merge.sh -t -T "jdk8u162-b12" -b "release" -./merge.sh -t -T "jdk8u172-b11" -b "release" -./merge.sh -t -T "jdk8u181-b13" -b "release" - -cd $REPO -git checkout release -git am $PATCHES/company_name.patch -git am $PATCHES/ppc64le_1.patch -git am $PATCHES/ppc64le_2.patch - -createTag "jdk8u181-b13" - -cd $SCRIPT_DIR -./merge.sh -t -T "jdk8u192-b12" -b "release" - -############################################### -# Fix jdk8u192-b12 for ppc64le -cd $REPO -git checkout release -git am $PATCHES/0001-Backport-8073139.patch -chmod +x ./common/autoconf/autogen.sh -./common/autoconf/autogen.sh -git commit -a -m "autogen" - -createTag "jdk8u192-b12" -############################################### - -cd $REPO -git checkout release -git am $PATCHES/0001-Set-vendor-information.patch - -################################################ - - diff --git a/jdk8u/constants.sh b/jdk8u/constants.sh deleted file mode 100755 index 6ec9a84..0000000 --- a/jdk8u/constants.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -eu - -# Set up the workspace to work from -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -mkdir -p "$SCRIPT_DIR/workspace" - -export WORKSPACE="$SCRIPT_DIR/workspace" -export MIRROR="$WORKSPACE/openjdk-clean-mirror" -export MODULE_MIRROR="$WORKSPACE/module-mirrors/" -export REWRITE_WORKSPACE="$WORKSPACE/openjdk-rewritten-mirror/" -export REPO_LOCATION="$WORKSPACE/adoptopenjdk-clone/" -export REPO="$WORKSPACE/repo/" -export PATCHES="$SCRIPT_DIR/patches/" - -mkdir -p "$REPO" -mkdir -p "$MODULE_MIRROR" - -chmod +x "$SCRIPT_DIR/merge.sh" - -# These the the modules in the mercurial forest that we'll have to iterate over -export MODULES=(corba langtools jaxp jaxws nashorn jdk hotspot) -export MODULES_WITH_ROOT=(root corba langtools jaxp jaxws nashorn jdk hotspot) diff --git a/jdk8u/createNextTag.sh b/jdk8u/createNextTag.sh deleted file mode 100755 index 83409ec..0000000 --- a/jdk8u/createNextTag.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -set -eux - -source constants.sh - -MERGE_ARGS="" - -while getopts "a" opt; do - case "${opt}" in - a) - MERGE_ARGS="-a" - ;; - esac -done -shift $((OPTIND-1)) - -if [ "$#" -gt 0 ]; then - TAG="$1" -else - echo "need tag arg" - exit 1 -fi - - -cd "$SCRIPT_DIR" - -# Update mirrors -./merge.sh -u - -cd "$REPO" -git reset --hard -git merge --abort || true -git am --abort || true - -if git show-ref refs/heads/release; then - git checkout release -else - git checkout -b release upstream/release || git checkout -b release -fi -git reset --hard - - -cd $SCRIPT_DIR -# move release branch on i.e move from jdk8u181-b13 to jdk8u192-b12 -./merge.sh -t -T "$TAG" -b "release" $MERGE_ARGS - - diff --git a/jdk8u/merge.sh b/jdk8u/merge.sh deleted file mode 100755 index bad221b..0000000 --- a/jdk8u/merge.sh +++ /dev/null @@ -1,320 +0,0 @@ -#!/usr/bin/env bash - -set -exu - -source constants.sh - -acceptUpstream="false" -doRebuildLocalRepo="false" -doInit="false" -doReset="false" -doTagging="false" -doUpdate="false" -if [ -z ${HG_REPO} ]; then - hgRepo="https://hg.openjdk.java.net/jdk8u/jdk8u" -else - hgRepo="$HG_REPO" -fi -tag="jdk8u172-b08" -workingBranch="master" - -function initRepo() { - tag=$1 - - rm -rf "$REPO" - mkdir -p "$REPO" - cd "$REPO" - git clone $MIRROR/root/ . - git checkout master - git reset --hard "$tag" - addRemotes - - for module in "${MODULES[@]}" ; do - cd "$MIRROR/$module/"; - git checkout master - git reset --hard - done - git fetch --all - - cd "$REPO" - git tag | while read tag - do - git tag -d $tag || true - done - - git fetch upstream --tags -} - -function addRemotes() { - - cd "$REPO" - if ! git config remote.upstream.url > /dev/null; then - git remote add "upstream" $UPSTREAM_GIT_REPO - fi - - if ! git config remote.root.url > /dev/null; then - git remote add "root" "$MIRROR/root/" - fi - - git fetch --all - git fetch upstream --tags -} - -function inititialCheckin() { - tag=$1 - cd "$REPO" - if [ "$workingBranch" != "master" ]; then - git branch -D "$workingBranch" || true - git checkout --orphan "$workingBranch" - git rm -rf . - else - git checkout master - fi - - if [ "$tag" != "HEAD" ]; then - git fetch root --no-tags +refs/tags/$tag:refs/tags/$tag-root - git merge "$tag-root" - else - git fetch root --no-tags HEAD - git merge HEAD - fi - - if [ "$doTagging" == "true" ]; then - git tag -d $tag || true - fi - - for module in "${MODULES[@]}" ; do - cd "$REPO" - git subtree add --prefix=$module "$MIRROR/$module/" $tag - done - - cd "$REPO" - git tag | while read tag - do - git tag -d $tag || true - done - git fetch upstream --tags -} - -function updateRepo() { - repoName=$1 - repoLocation=$2 - - if [ ! -d "$MIRROR/$repoName/.git" ]; then - rm -rf "$MIRROR/$repoName" || exit 1 - mkdir -p "$MIRROR/$repoName" || exit 1 - cd "$MIRROR/$repoName" - git clone "hg::${repoLocation}" . - fi - - addRemotes - - cd "$MIRROR/$repoName" - git fetch origin - git pull origin - git reset --hard origin/master - git fetch --all - git fetch --tags - -} - -# Builds a local repo on a new machine by pulling down the existing remote repo -function rebuildLocalRepo() { - hgRepo=$1 - - # Steps required to build a new host - # - # 1. Clone upstream mirrors (done by updateMirrors function) - # - # 2. Pull adopt repo down into $REPO - # - # 3. Set up remotes on $REPO - # Remotes should look as follows: - # upstream: git@github.com:adoptium/jdk8u.git (or aarch) - # root: "$MIRROR/root/" - # origin: "$MIRROR/root/" - # - - # Step 1 Clone mirrors - updateMirrors $hgRepo - - # Step 2, Reclone upstream repo - rm -rf "$REPO" || true - mkdir -p "$REPO" - cd "$REPO" - git clone $UPSTREAM_GIT_REPO . - git checkout master || git checkout -b master - - # Step 3 Setup remotes - addRemotes - - # Remove any incorrect local tags we have - git tag -l | xargs git tag -d - git fetch --tags - - # Ensure origin is correct - cd "$REPO" - git remote set-url origin "$UPSTREAM_GIT_REPO" - - # Repoint origin from the upstream repo to root module - cd "$REPO" - git remote set-url origin "$MIRROR/root/" -} - -# We pass in the repo we want to mirror as the first arg -function updateMirrors() { - - HG_REPO=$1 - - mkdir -p "$MIRROR" - cd "$MIRROR" || exit 1 - - updateRepo "root" "${HG_REPO}" - - for module in "${MODULES[@]}" ; do - updateRepo "$module" "${HG_REPO}/$module" - done -} - -function fixAutoConfigure() { - chmod +x ./common/autoconf/autogen.sh - ./common/autoconf/autogen.sh - git commit -a --no-edit -} - -while getopts "ab:irtls:T:u" opt; do - case "${opt}" in - a) - acceptUpstream="true" - ;; - b) - workingBranch=${OPTARG} - ;; - i) - doInit="true" - ;; - r) - doReset="true" - doInit="true" - ;; - l) - doRebuildLocalRepo="true" - ;; - s) - hgRepo=${OPTARG} - ;; - t) - doTagging="true" - ;; - T) - tag=${OPTARG} - ;; - u) - doUpdate="true" - ;; - *) - usage - exit - ;; - esac -done -shift $((OPTIND-1)) - -if [ "$doRebuildLocalRepo" == "true" ]; then - rebuildLocalRepo $hgRepo - exit -fi - -if [ "$doUpdate" == "true" ]; then - updateMirrors $hgRepo - exit -fi - -if [ "$doReset" == "true" ]; then - initRepo $tag -fi - -if [ "$doInit" == "true" ]; then - inititialCheckin $tag - exit -fi - -echo "$tag" >> $WORKSPACE/mergedTags - -cd "$MIRROR/root/"; -commitId=$(git rev-list -n 1 $tag) - -cd "$REPO" -git merge --abort || true -git rebase --abort || true -if git rev-parse -q --verify "$workingBranch" ; then - git checkout $workingBranch -else - git checkout -b $workingBranch upstream/$workingBranch || git checkout -b $workingBranch -fi - -# Get rid of existing tag that we are about to create -if [ "$doTagging" == "true" ]; then - git tag -d $tag || true -fi - -if [ "$tag" != "HEAD" ]; then - git fetch --no-tags root +refs/tags/$tag:refs/tags/$tag-root -else - git fetch --no-tags root HEAD -fi - -set +e -git merge -q -m "Merge root at $tag" $commitId -returnCode=$? -set -e - -if [[ "$returnCode" -ne "0" ]]; then - if [ "$(git diff --name-only --diff-filter=U | wc -l)" == "1" ] && [ "$(git diff --name-only --diff-filter=U)" == "common/autoconf/generated-configure.sh" ]; - then - fixAutoConfigure - else - echo "Conflicts" - exit 1 - fi -fi - -cd "$REPO" -for module in "${MODULES[@]}" ; do - set +e - git subtree pull -q -m "Merge $module at $tag" --prefix=$module "$MIRROR/$module/" $tag || git subtree add --prefix=$module "$MIRROR/$module/" $tag - - if [ $? != 0 ]; then - if [ "$acceptUpstream" == "true" ]; then - git diff --name-only --diff-filter=U | xargs git checkout --theirs - git commit -a -m "Resolve conflicts on module $module when merging tag $tag" - else - echo "Failed to merge in module $module" - exit 1 - fi - fi - - set -e -done - -echo "Success $tag" >> $WORKSPACE/mergedTags - -if [ "$doTagging" == "true" ]; then - cd "$REPO" - git tag -d "$tag" || true - git branch -D "$tag" || true - git branch "$tag" - git tag -f "$tag" -fi - -cd "$REPO" - -# Remove temporary tags -git tag | grep ".*\-root" | while read tag -do - git tag -d $tag || true -done - -git prune -git gc - diff --git a/jdk8u/updateRepo.sh b/jdk8u/updateRepo.sh deleted file mode 100755 index 4584fa5..0000000 --- a/jdk8u/updateRepo.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -set -eux - -source constants.sh - -# Update mirrors -./merge.sh -u - -cd "$REPO" -if [ -d ".git" ];then - git reset --hard - git checkout master || git checkout -b master - git merge --abort || true - git am --abort || true -fi - -# Update dev branch -cd "$REPO" -git fetch --all --no-tags - -if git rev-parse -q --verify "dev" ; then - git checkout dev -else - git checkout -b dev upstream/dev || git checkout -b dev -fi - -cd $SCRIPT_DIR -./merge.sh -T "HEAD" -b "dev" - -# Update master branch -cd "$REPO" -git checkout master -cd $SCRIPT_DIR -./merge.sh -T "HEAD" -b "master" -cd "$REPO" diff --git a/mercurialToGit.sh b/mercurialToGit.sh deleted file mode 100755 index 353ad09..0000000 --- a/mercurialToGit.sh +++ /dev/null @@ -1,265 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -################################################################################ -# mirrorMercurialIntoGit -# -# Local setup of the Git clone of a OpenJDK mercurial repository -# -# Initial repo will be pushed to git@github.com:adoptium/$GITHUB_REPO.git -# -# TODO Make the location of the git push a parameter -# -################################################################################ - -set -euxo pipefail - -echo "Import common functionality" -# shellcheck disable=SC1091 -source import-common.sh - -# Make sure we're in a valid dir as a workspace -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -mkdir -p $SCRIPT_DIR/workspace -WORKSPACE=$SCRIPT_DIR/workspace - -# TODO generalise this for the non adopt build farm case -function checkArgs() { - if [ "$1" -lt 1 ]; then - echo Usage: "$0" '[jdk-updates/jdk10u|jdk/jdk] (branch)' - echo "Hg Repo supplied should match a repository in https://hg.openjdk.java.net/" - echo "For example, to get the latest jdk development repo:" - echo "$0 jdk/jdk" - echo "For example, to get the raw-string-literals branch from the amber repo:" - echo "e.g. $0 amber/jdk raw-string-literals" - exit 1 - fi -} - -# Read in the mandatory Mercurial repo, e.g. jdk-updates/jdk10u -# Default to a master branch if one is not given -HG_REPO=$1 -GITHUB_REPO=$(echo "$HG_REPO" | cut -d/ -f2) -BRANCH=${2:-master} - -# Determine latest build TAG_SEARCH, finding tags beginning with "jdk-" followed by ... "+" ... -if [ "$HG_REPO" == "jdk/jdk" ] -then - TAG_SEARCH="jdk-*+*" -elif [ "$HG_REPO" == "jdk-updates/jdk13u" ] -then - TAG_SEARCH="jdk-13*+*" -elif [ "$HG_REPO" == "jdk-updates/jdk12u" ] -then - TAG_SEARCH="jdk-12*+*" -elif [ "$HG_REPO" == "jdk-updates/jdk11u" ] -then - TAG_SEARCH="jdk-11*+*" -else - echo "Unable to determine latest build tag TAG_SEARCH for repo: $HG_REPO" - exit 1 -fi - -# JDK11+ tag sorting: -# We use sort and tail to choose the latest tag in case more than one refers the same commit. -# Versions tags are formatted: jdk-V[.W[.X[.P]]]+B; with V, W, X, P, B being numeric. -# Transform "-" to "." in tag so we can sort as: "jdk.V[.W[.X[.P]]]+B" -# Transform "+" to ".0.+" during the sort so that .P (patch) is defaulted to "0" for those -# that don't have one, and the trailing "." to terminate the 5th field from the + -# -# Example: jdk-11.0.2+2, jdk-11.0.1+3, jdk-11.0.2+1, jdk-11.0.2.1+2 -# Sort by "B": jdk-11.0.2+1, jdk-11.0.2+2, jdk-11.0.2.1+2, jdk-11.0.1+3, -# Then, "Stable" sort by V.W.X.P: jdk-11.0.1+3, jdk-11.0.2+1, jdk-11.0.2+2, jdk-11.0.2.1+2 -# Latest = jdk-11.0.2.1+2 -# -# First, sort on build number (B): -jdk11plus_tag_sort1="sort -t+ -k2,2n" -# Second, (stable) sort on (V), (W), (X), (P): P(Patch) is optional and defaulted to "0" -jdk11plus_tag_sort2="sort -t. -k2,2n -k3,3n -k4,4n -k5,5n" -jdk11plus_sort_tags_cmd="grep -v _openj9 | grep -v _adopt | sed 's/jdk-/jdk./g' | sed 's/+/.0.+/g' | $jdk11plus_tag_sort1 | nl -n rz | $jdk11plus_tag_sort2 | sed 's/\.0\.+/+/g' | cut -f2- | sed 's/jdk./jdk-/g'" - - -function cloneGitHubRepo() { - cd "$WORKSPACE" || exit 1 - # If we don't have a $GITHUB_REPO locally then clone it from adoptium/$GITHUB_REPO.git - if [ ! -d "$GITHUB_REPO" ] ; then - git clone git@github.com:adoptium/"$GITHUB_REPO".git "$GITHUB_REPO" || exit 1 - fi -} - -function addMercurialUpstream() { - cd "$WORKSPACE/$GITHUB_REPO" || exit 1 - - git fetch --all - if ! git checkout -f "$BRANCH" ; then - if ! git rev-parse -q --verify "origin/$BRANCH" ; then - git checkout -b "$BRANCH" || exit 1 - else - git checkout -b "$BRANCH" origin/"$BRANCH" || exit 1 - fi - else - git reset --hard origin/"$BRANCH" || echo "Not resetting as no upstream exists" - fi - - # shellcheck disable=SC2143 - if [ -z "$(git remote -v | grep 'hg')" ] ; then - echo "Initial setup of hg::https://hg.openjdk.java.net/$HG_REPO" - git remote add hg hg::https://hg.openjdk.java.net/"$HG_REPO" - fi -} - -function performMergeFromMercurialIntoGit() { - git fetch hg --tags - - git merge hg/"$BRANCH" -m "Merge $BRANCH" || (echo "The automatic update failed, time for manual intervention!" && exit 1) - - if git rev-parse -q --verify "origin/$BRANCH"; then - echo "====Commit diff for branch $BRANCH====" - git --no-pager log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative $BRANCH..origin/$BRANCH - echo "======================================" - else - # In the case this is a new repo, chunk uploads into 5000 commit chunks - git log --reverse --pretty=format:"%H" | split -l 5000 --filter="tail -n1" | while read sha; do - echo "Pushing $sha"; - git push origin $sha:refs/heads/master - done - fi - - git push -u origin "$BRANCH" || exit 1 - git push origin "$BRANCH" --tags || exit 1 -} - -# Merge master(HEAD) into dev as we build off dev at the AdoptOpenJDK Build farm for Nightlies -# dev contains patches that AdoptOpenJDK has beyond upstream OpenJDK -function performMergeIntoDevFromMaster() { - - # Abort existing merge - git merge --abort || true - git reset --hard || true - - # Fetch latest and get latest master build tag - git fetch --all --tags - - if ! git checkout -f dev ; then - if ! git rev-parse -q --verify "origin/dev" ; then - git checkout -b dev || exit 1 - else - git checkout -b dev origin/dev || exit 1 - fi - else - git reset --hard origin/dev || echo "Not resetting as no upstream exists" - fi - - devTags=$(git tag --merged dev $TAG_SEARCH || exit 1) - currentDevTag=$(echo "$devTags" | eval "$jdk11plus_sort_tags_cmd" | tail -1 || exit 1) - echo "Current dev build tag: $currentDevTag" - - # Merge master "HEAD" - echo "Merging origin/$BRANCH HEAD into dev branch" - git merge -m"Merging origin/$BRANCH HEAD into dev" origin/"$BRANCH" || exit 1 - - # Merge latest patches from "release" branch - git merge -m"Merging latest patches from release branch" origin/release || exit 1 - - if git rev-parse -q --verify "origin/dev" ; then - git --no-pager log --oneline origin/dev..dev - fi - - devTags=$(git tag --merged dev $TAG_SEARCH || exit 1) - currentDevTag=$(echo "$devTags" | eval "$jdk11plus_sort_tags_cmd" | tail -1 || exit 1) - echo "New dev build tag: $currentDevTag" - - git push origin dev || exit 1 -} - - -# Merge master(New tagged builds only) into release branch as we build -# off release branch at the AdoptOpenJDK Build farm for release builds -# release branch contains patches that AdoptOpenJDK has beyond upstream OpenJDK tagged builds -function performMergeIntoReleaseFromMaster() { - - # Abort existing merge - git merge --abort || true - git reset --hard || true - - # Fetch latest and get latest master build tag - git fetch --all --tags - - buildTags=$(git tag --merged origin/"$BRANCH" $TAG_SEARCH || exit 1) - sortedBuildTags=$(echo "$buildTags" | eval "$jdk11plus_sort_tags_cmd" || exit 1) - - if ! git checkout -f release ; then - if ! git rev-parse -q --verify "origin/release" ; then - currentBuildTag=$(echo "$buildTags" | eval "$jdk11plus_sort_tags_cmd" | tail -1 || exit 1) - git checkout -b release $currentBuildTag || exit 1 - else - git checkout -b release origin/release || exit 1 - fi - else - git reset --hard origin/release || echo "Not resetting as no upstream exists" - fi - - releaseTags=$(git tag --merged release $TAG_SEARCH || exit 1) - currentReleaseTag=$(echo "$releaseTags" | eval "$jdk11plus_sort_tags_cmd" | tail -1 || exit 1) - echo "Current release build tag: $currentReleaseTag" - - # Merge any new builds since current release build tag - foundCurrentReleaseTag=false - for tag in $sortedBuildTags; do - if [[ "$foundCurrentReleaseTag" == false ]]; then - if [ "x$tag" == "x$currentReleaseTag" ]; then - foundCurrentReleaseTag=true - fi - else - mergeTag=true - # Check if tag is in the releaseTagExcludeList, if so do not bring it into the release branch - # and do not create an _adopt tag - if [ -n "${releaseTagExcludeList-}" ] ; then - for skipTag in $releaseTagExcludeList; do - if [ "x$tag" == "x$skipTag" ]; then - mergeTag=false - echo "Skipping merge of excluded tag $tag" - fi - done - fi - if [[ "$mergeTag" == true ]]; then - echo "Merging build tag $tag into release branch" - git merge -m"Merging $tag into release" $tag || exit 1 - git tag -a "${tag}_adopt" -m "Merged $tag into release" || exit 1 - fi - fi - done - - if git rev-parse -q --verify "origin/release" ; then - git --no-pager log --oneline origin/release..release - fi - - releaseTags=$(git tag --merged release $TAG_SEARCH || exit 1) - currentReleaseTag=$(echo "$releaseTags" | eval "$jdk11plus_sort_tags_cmd" | tail -1 || exit 1) - echo "New release build tag: $currentReleaseTag" - - git push origin release || exit 1 -} - -checkArgs $# -#checkGitVersion -installGitRemoteHg -cloneGitHubRepo -addMercurialUpstream -performMergeFromMercurialIntoGit -performMergeIntoReleaseFromMaster -performMergeIntoDevFromMaster - -git push --tags origin diff --git a/jdk8u/patches/0001-Backport-8073139.patch b/patches/jdk8u/0001-Backport-8073139.patch similarity index 100% rename from jdk8u/patches/0001-Backport-8073139.patch rename to patches/jdk8u/0001-Backport-8073139.patch diff --git a/jdk8u/patches/0001-Set-vendor-information.patch b/patches/jdk8u/0001-Set-vendor-information.patch similarity index 100% rename from jdk8u/patches/0001-Set-vendor-information.patch rename to patches/jdk8u/0001-Set-vendor-information.patch diff --git a/jdk8u/patches/company_name.patch b/patches/jdk8u/company_name.patch similarity index 100% rename from jdk8u/patches/company_name.patch rename to patches/jdk8u/company_name.patch diff --git a/jdk8u/patches/ppc64le_1.patch b/patches/jdk8u/ppc64le_1.patch similarity index 100% rename from jdk8u/patches/ppc64le_1.patch rename to patches/jdk8u/ppc64le_1.patch diff --git a/jdk8u/patches/ppc64le_2.patch b/patches/jdk8u/ppc64le_2.patch similarity index 100% rename from jdk8u/patches/ppc64le_2.patch rename to patches/jdk8u/ppc64le_2.patch diff --git a/update.sh b/update.sh deleted file mode 100755 index 8e0000b..0000000 --- a/update.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -echo "Common defs" - -# shellcheck disable=SC1091 -source import-common.sh - -echo "Enter hg" - -cd hg || exit 1 - -# shellcheck disable=SC2035 -bpaths=${1:-$(ls -d -1 */*)} # maintain backward compatibility - -for bpath in $bpaths -do - bpathAsArray=(${bpath//\// }) # for e.g. jdk10/jdk10 or jdk/jdk, becomes: - hg_root_forest=${bpathAsArray[0]} # jdk10 or jdk - hg_repo=${bpathAsArray[1]} # jdk10 or jdk - - pushd "$hg_root_forest/$hg_repo/root" - echo "Update $hg_root_forest/$hg_repo -> (root)" - git hg fetch "https://hg.openjdk.java.net/$hg_root_forest/$hg_repo" - git hg pull "https://hg.openjdk.java.net/$hg_root_forest/$hg_repo" - popd - - # shellcheck disable=SC2154 - for module in "${modules[@]}" - do - pushd "$hg_root_forest/$hg_repo/$module" - echo "Update $hg_root_forest/$hg_repo -> $module" - git hg fetch "https://hg.openjdk.java.net/$hg_root_forest/$hg_repo/$module" - git hg pull "https://hg.openjdk.java.net/$hg_root_forest/$hg_repo/$module" - popd - done - - echo "Exit hg" - echo "Enter combined" - - cd ../combined || exit 1 - - echo "Check out master" - - git checkout master || exit 1 - - echo "Fetch (root)" - - git fetch "imports/$hg_root_forest/$hg_repo/root" || exit 1 - - echo "Merge (root)" - - git merge "imports/$hg_root_forest/$hg_repo/root/master" -m "Merge from (root)" --no-ff || exit 1 - - # shellcheck disable=SC2154 - for module in "${modules[@]}" - do - echo "Fetch '$module'" - git fetch "imports/$hg_root_forest/$hg_repo/$module" || exit 1 - - echo "Merge '$module'" - git subtree merge --prefix="$module" "imports/$hg_root_forest/$hg_repo/$module/master" -m "Merge from '$module'" || exit 1 - done - - echo "Push" - - git push github master --tags || exit 1 - - cd ../hg || exit 1 -done From 0241afca5c39e80dbb41e4fce895438b4b0e8ebd Mon Sep 17 00:00:00 2001 From: George Adams Date: Mon, 8 Apr 2024 10:43:14 +0100 Subject: [PATCH 3/3] add common.sh script back --- common.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 common.sh diff --git a/common.sh b/common.sh new file mode 100644 index 0000000..224380f --- /dev/null +++ b/common.sh @@ -0,0 +1,57 @@ +# TODO generalise this for the non adoptium build farm case +function checkArgs() { + if [ "$1" -lt 1 ]; then + echo Usage: "$0" '[jdk8u|jdk11u|jdk17u|jdk19u|...]' + echo "Skara Repo supplied should match a repository in https://github.com/openjdk/" + echo "For example, to mirror https://github.com/openjdk/jdk17u" + echo "e.g. $0 jdk17u" + exit 1 + fi +} + +function cloneGitHubRepo() { + cd "$WORKSPACE" || exit 1 + GITHUB_REPO=$1 # https://github.com/adoptium/adoptium/jdk17u.git + if [ ! -d "$JDKVERSION" ] ; then + echo "First time clone repo $GITHUB_REPO" + git clone -q "$GITHUB_REPO" || exit 1 + else + cd "$JDKVERSION" && git clean -fd && git fetch --all --tags + fi +} + +function readExpectedGATag() { + source ${SCRIPT_DIR}/releasePlan.cfg + jdkVersion=$1 # e.g jdk17u + gaTagVariable="${jdkVersion}GA" # set gaTagVariable=jdk17uGA match releasePlan.cfg + expectedTag=${!gaTagVariable} # get value, e.g: expectedTag=jdk-17.0.6 + echo ${expectedTag} +} + +# this function is not in use, due to agent does not have "jq" to parse json payload +function queryGHAPI(){ + repo=$1 # adoptium/jdk8u, openjdk/jdk8u + tag=$2 # jdk8u362-b05_adopt, jdk8u362-ga + exist="$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/${repo}/git/refs/tags/${tag}")" + if [ $exist == "200" ]; then + echo "Found tag: ${tag} in ${repo}" + else + echo "Cannot find tag: ${tag} in ${repo}" + fi + echo ${exist} +} + +# to check if the same _adopt scmReference tag has been used to trigger a release pipeline in the past +# if yes, wont trigger; if not, do the first time trigger +function checkPrevious() { + if [ -f ${WORKSPACE}/tracking ]; then # already have tracking from previous + local scmRef=$1 # _adopt scmReference tag we have found + local trackerTag="$(cut -d '=' -f 2 ${WORKSPACE}/tracking)" # previousSCM=jdk-17.0.5+8_adopt + + if [[ "${scmRef}" == "${trackerTag}" ]]; then + echo "Release tag ${trackerTag} has triggered a release pipeline build already in the current release" + echo "Will not continue job" + exit 0 + fi + fi +}