openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From houshen...@apache.org
Subject [incubator-openwhisk-release] branch master updated: Generate Release Notes of OpenWhisk Auto generated change logs
Date Wed, 14 Mar 2018 13:36:44 GMT
This is an automated email from the ASF dual-hosted git repository.

houshengbo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-release.git


The following commit(s) were added to refs/heads/master by this push:
     new 5bac4a1  Generate Release Notes of OpenWhisk Auto generated change logs
5bac4a1 is described below

commit 5bac4a1a5cb7545e6b37ef50b580a9e972bcd918
Author: Daisy Guo <guoyingc@cn.ibm.com>
AuthorDate: Tue Mar 13 15:59:09 2018 +0800

    Generate Release Notes of OpenWhisk
    Auto generated change logs
---
 tools/download_source_code.sh                      |  2 +-
 ...ad_source_code.sh => generate_release_notes.sh} | 51 +++++++++++-----------
 tools/lib/release_template.md                      | 23 ++++++++++
 tools/package_source_code.sh                       |  4 +-
 4 files changed, 52 insertions(+), 28 deletions(-)

diff --git a/tools/download_source_code.sh b/tools/download_source_code.sh
index 7a403bb..f019e4e 100755
--- a/tools/download_source_code.sh
+++ b/tools/download_source_code.sh
@@ -33,7 +33,7 @@ function git_clone_repo() {
     git clone --depth $clone_depth -b $BRANCH $REPO $OPENWHISK_SOURCE_DIR/$PROJECT_NAME
     cd $OPENWHISK_SOURCE_DIR/$PROJECT_NAME
     git reset --hard $HASH
-    rm -rf .git
+    #rm -rf .git
 }
 
 rm -rf $OPENWHISK_SOURCE_DIR/*
diff --git a/tools/download_source_code.sh b/tools/generate_release_notes.sh
similarity index 53%
copy from tools/download_source_code.sh
copy to tools/generate_release_notes.sh
index 7a403bb..feaf037 100755
--- a/tools/download_source_code.sh
+++ b/tools/generate_release_notes.sh
@@ -16,42 +16,41 @@
 # limitations under the License.
 #
 
-set -e
+echo "Generate release notes and collect change logs of all projects."
 
 WORK_DIR=${1:-"$HOME"}
 
 SCRIPTDIR="$(cd $(dirname "$0")/ && pwd)"
 source "$SCRIPTDIR/load_config.sh" $1
+PARENTDIR="$(dirname "$SCRIPTDIR")"
 
-clone_depth=${2:-"100"}
+FILE="$WORK_DIR/releaseNotes.md"
+TEMPLATE="$SCRIPTDIR/lib/release_template.md"
 
-function git_clone_repo() {
-    PROJECT_NAME=$1
-    HASH=$2
-    REPO=$3
-    BRANCH=$4
-    git clone --depth $clone_depth -b $BRANCH $REPO $OPENWHISK_SOURCE_DIR/$PROJECT_NAME
-    cd $OPENWHISK_SOURCE_DIR/$PROJECT_NAME
-    git reset --hard $HASH
-    rm -rf .git
-}
+# Remove file if exists
+if [ -f "$FILE" ] ; then
+  rm $FILE
+fi
 
-rm -rf $OPENWHISK_SOURCE_DIR/*
-
-CONFIG=$(read_file $SCRIPTDIR/config.json)
-repos=$(echo $(json_by_key "$CONFIG" "RepoList") | sed 's/[][]//g')
+# Read the template
+while IFS= read -r aline; do
+  printf "%s\n" "$aline" >> $FILE
+done <$TEMPLATE
 
+# Print change logs
 for repo in $(echo $repos | sed "s/,/ /g")
 do
     repo_name=$(echo "$repo" | sed -e 's/^"//' -e 's/"$//')
-    HASH_KEY=${repo_name//-/_}.hash
-    REPO_KEY=${repo_name//-/_}.repository
-    REPO_BRANCH=${repo_name//-/_}.branch
-    HASH=$(json_by_key "$CONFIG" $HASH_KEY)
-    REPO=$(json_by_key "$CONFIG" $REPO_KEY)
-    BRANCH=$(json_by_key "$CONFIG" $REPO_BRANCH)
-    if [ "$HASH" != "null" ]; then
-        echo "The hash for $repo_name is $HASH"
-        git_clone_repo $repo_name $HASH $REPO $BRANCH
-    fi
+    echo "Collect logs in the repository $repo_name"
+    cd $OPENWHISK_SOURCE_DIR/$repo_name
+
+    printf "\n%s\n\n" "## $repo_name" >> $FILE
+    git log --pretty=format:"- %s" --date=short | while read line
+    do
+      PRNUMBER=$(echo $line | egrep -o '\(#[[:digit:]]+\)') # format like (#1234)
+      PRN=$(echo $PRNUMBER | egrep -o '[[:digit:]]+') # format like 1234
+      PRLINK="([#$PRN](https://github.com/apache/incubator-$repo_name/pull/$PRN))"
+      line=${line/$PRNUMBER/$PRLINK}
+      printf "%s\n" "$line" >> $FILE
+    done
 done
diff --git a/tools/lib/release_template.md b/tools/lib/release_template.md
new file mode 100644
index 0000000..d0aeeea
--- /dev/null
+++ b/tools/lib/release_template.md
@@ -0,0 +1,23 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor
+# license agreements.  See the NOTICE file distributed with this work for additional
+# information regarding copyright ownership.  The ASF licenses this file to you
+# 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:
+#
+# http://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.
+#
+-->
+
+# OpenWhisk Release Notes
+
+This is OpenWhisk Release.
+
+# Change logs
diff --git a/tools/package_source_code.sh b/tools/package_source_code.sh
index ed74a8c..d04307a 100755
--- a/tools/package_source_code.sh
+++ b/tools/package_source_code.sh
@@ -33,5 +33,7 @@ rsync -rtp --exclude .*\* --exclude bin\* --exclude build\* $OPENWHISK_SOURCE_DI
 for repo in $(echo $repos | sed "s/,/ /g")
 do
     repo_name=$(echo "$repo" | sed -e 's/^"//' -e 's/"$//')
-    cd $OPENWHISK_CLEANED_SOURCE_DIR/$repo_name && tar czf ${CURRENT_VERSION_DIR}/${repo_name}-${version}-sources.tar.gz
.
+    cd $OPENWHISK_CLEANED_SOURCE_DIR/$repo_name
+    rm -rf .git
+    tar czf ${CURRENT_VERSION_DIR}/${repo_name}-${version}-sources.tar.gz .
 done

-- 
To stop receiving notification emails like this one, please contact
houshengbo@apache.org.

Mime
View raw message