petersomogyi commented on a change in pull request #671: HBASE-23092 Make the 
RM tooling in dev-tools/create-release generic
URL: https://github.com/apache/hbase/pull/671#discussion_r329959552
 
 

 ##########
 File path: dev-support/create-release/release-util.sh
 ##########
 @@ -269,43 +275,115 @@ function init_mvn {
 
 # Writes report into cwd!
 function generate_api_report {
-  local hbase=$1
+  local project="$1"
   local previous_tag="$2"
   local release_tag="$3"
   # Generate api report.
-  ${hbase}/dev-support/checkcompatibility.py --annotation \
+  ${project}/dev-support/checkcompatibility.py --annotation \
     org.apache.yetus.audience.InterfaceAudience.Public  \
     $previous_tag $release_tag
   local previous_version=$(echo ${previous_tag} | sed -e 's/rel\///')
-  cp ${hbase}/target/compat-check/report.html 
"./api_compare_${previous_version}_to_${release_tag}.html"
+  cp ${project}/target/compat-check/report.html 
"./api_compare_${previous_version}_to_${release_tag}.html"
 }
 
 # Update the CHANGES.md
 # DOES NOT DO COMMITS! Caller should do that.
 # yetus requires python2 to be on the path.
 function update_releasenotes {
-  local hbase="$1"
+  local project="$1"
   local release_version="$2"
   local yetus="apache-yetus-${YETUS_VERSION}"
   wget -qO- 
"https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=/yetus/${YETUS_VERSION}/${yetus}-bin.tar.gz";
 | \
     tar xvz -C .
-  cd ./${yetus}
+  cd ./${yetus} || exit
   ./bin/releasedocmaker -p HBASE --fileversions -v ${release_version} -l 
--sortorder=newer --skip-credits
   # First clear out the changes written by previous RCs.
   sed -i -e "/^## Release ${release_version}/,/^## Release/ {//!d; /^## 
Release ${release_version}/d;}" \
-    ${hbase}/CHANGES.md
-  sed -i -e "/^# HBASE  ${release_version} Release Notes/,/^# HBASE/{//!d; /^# 
HBASE  ${release_version} Release Notes/d;}" \
-    ${hbase}/RELEASENOTES.md
+    ${project}/CHANGES.md || true
+  sed -i -e "/^# ${project} ${release_version} Release Notes/,/^# 
${project}/{//!d; /^# ${project} ${release_version} Release Notes/d;}" \
+    ${project}/RELEASENOTES.md || true
 
   # The above generates RELEASENOTES.X.X.X.md and CHANGELOG.X.X.X.md.
-  # To insert into hbase CHANGES.me...need to cut the top off the
+  # To insert into project CHANGES.me...need to cut the top off the
   # CHANGELOG.X.X.X.md file removing license and first line and then
   # insert it after the license comment closing where we have a
   # DO NOT REMOVE marker text!
   sed -i -e '/## Release/,$!d' CHANGELOG.${release_version}.md
-  sed -i -e "/DO NOT REMOVE/r CHANGELOG.${release_version}.md" 
${hbase}/CHANGES.md
+  sed -i -e "/DO NOT REMOVE/r CHANGELOG.${release_version}.md" 
${project}/CHANGES.md
   # Similar for RELEASENOTES but slightly different.
   sed -i -e '/Release Notes/,$!d' RELEASENOTES.${release_version}.md
-  sed -i -e "/DO NOT REMOVE/r RELEASENOTES.${release_version}.md" 
${hbase}/RELEASENOTES.md
-  cd ..
+  sed -i -e "/DO NOT REMOVE/r RELEASENOTES.${release_version}.md" 
${project}/RELEASENOTES.md
+  cd .. || exit
+}
+
+# Make src release.
+# Takes as arguments first the project name -- e.g. hbase or 
hbase-operator-tools
+# -- and then the version string. Expects to find checkout adjacent to this 
script
+# named for 'project', the first arg passed.
+# Expects the following three defines in the environment:
+# - GPG needs to be defined, with the path to GPG: defaults 'gpg'.
+# - The passphrase in the GPG_PASSPHRASE variable: no default (we don't make 
.asc file).
+# - GIT_REF which is the tag to create the tgz from: defaults to 'master'.
+# For example:
+# $ GPG_PASSPHRASE="XYZ" GIT_REF="master" make_src_release 
hbase-operator-tools 1.0.0
+make_src_release() {
+  # Tar up the src and sign and hash it.
+  project="${1}"
+  version="${2}"
+  basename="${project}-${version}"
+  rm -rf "${basename}-src*"
+  tgz="${basename}-src.tar.gz"
+  cd "${project}" || exit
+  git clean -d -f -x
+  git archive --format=tar.gz --output="../${tgz}" --prefix="${basename}/" 
"${GIT_REF:-master}"
+  cd .. || exit
+  echo "$GPG_PASSPHRASE" | "$GPG" --passphrase-fd 0 --armour --output 
"${tgz}.asc" \
+    --detach-sig "${tgz}"
+  echo "$GPG_PASSPHRASE" | "$GPG" --passphrase-fd 0 --print-md SHA512 "${tgz}" 
> "${tgz}.sha512"
+}
+
+# Make binary release.
+# Takes as arguments first the project name -- e.g. hbase or 
hbase-operator-tools
+# -- and then the version string. Expects to find checkout adjacent to this 
script
+# named for 'project', the first arg passed.
+# Expects the following three defines in the environment:
+# - GPG needs to be defined, with the path to GPG: defaults 'gpg'.
+# - The passphrase in the GPG_PASSPHRASE variable: no default (we don't make 
.asc file).
+# - GIT_REF which is the tag to create the tgz from: defaults to 'master'.
+# - MVN Default is 'mvn'.
+# For example:
+# $ GPG_PASSPHRASE="XYZ" GIT_REF="master" make_src_release 
hbase-operator-tools 1.0.0
+make_binary_release() {
+  project="${1}"
+  version="${2}"
+  basename="${project}-${version}"
+  rm -rf "${basename}-bin*"
+  cd $project || exit
+
+  git clean -d -f -x
+  # Three invocations of maven. This seems to work. One to
+  # populate the repo, another to build the site, and then
+  # a third to assemble the binary artifact. Trying to do
+  # all in the one invocation fails; a problem in our
+  # assembly spec to in maven. TODO. Meantime, three invocations.
+  MAVEN_OPTS="${MAVEN_OPTS}" ${MVN} --settings $tmp_settings clean install 
-DskipTests \
+    -Dmaven.repo.local="${tmp_repo}"
+  MAVEN_OPTS="${MAVEN_OPTS}" ${MVN} --settings $tmp_settings site -DskipTests \
+    -Dmaven.repo.local="${tmp_repo}"
+  MAVEN_OPTS="${MAVEN_OPTS}" ${MVN} --settings $tmp_settings install 
assembly:single -DskipTests \
+    -Dcheckstyle.skip=true "${PUBLISH_PROFILES}" 
-Dmaven.repo.local="${tmp_repo}"
+
+  # Check there is a bin gz output. The build may not produce one: e.g. 
hbase-thirdparty.
+  f_bin_tgz="./${PROJECT}-assembly/target/${basename}*-bin.tar.gz"
+  if test -f "${f_bin_tgz}"; then
+    cp "${f_bin_tgz}" ..
+    cd .. || exit
+    for i in "${basename}"*-bin.tar.gz; do
+      echo "$GPG_PASSPHRASE" | "$GPG" --passphrase-fd 0 --armour --output 
"$i.asc" --detach-sig "$i"
 
 Review comment:
   Do not quote GPG

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to