Thursday, March 22, 2018

Get Release Notes

#!/bin/sh -x

export SVNROOT=svn+ssh://svn.xxx.com/svn

if [ $1 == "--help" ]
then
   echo -e "This script fetches the NEWS file updates between two release tags \n";
   echo -e "Checkout the release workspace with make-toad-x.y.x-workspace.sh script";
   echo -e "Execute release_notes.sh script in the directory";
   echo -e "Usage: release_notes.sh TAG1 TAG2 \n";
   echo -e "Example:\n mkdir temp_dir1 \n cd temp_dir1 \n ./make-toad-3.12.2-workspace.sh\n release_notes.sh  3.12.2.6 3.12.2.0 \n NEWS_update.log has the NEWS file updates \n";
   exit;
fi

if [ $# == 0 ]  || [ $# -ne 2 ]
then
   echo -e "Please input the valid release tags as arguments.";
   exit;
fi

build_version1=`echo $1 | awk -F. '{print $4}' `;
build_version2=`echo $2 | awk -F. '{print $4}' `;

if [ -f NEWS_update.log ]
then
   rm -f NEWS_update.log
fi

for i in `find . -maxdepth 1 -type d | sed 's/\.\///g' | sed 's/\.//g'`
do
  cd $i;
  rel_branch=`svn info | head -2 | tail -1 | awk -F/ '{print $8}' | sed -e 's/VERSION_//g' | sed -s 's/_/./g'`;
  TAG1=$rel_branch.$build_version1;
  TAG2=$rel_branch.$build_version2;
  echo -e "$i:" >> ../NEWS_update.log;
  echo -e "---------------- \n" >> ../NEWS_update.log;
  sed -n '/Shipped in '$TAG1'/,/Shipped in '$TAG2'/{ /Shipped in '$TAG1'/d; /Shipped in '$TAG2'/d; p; }' NEWS >> ../NEWS_update.log;
  echo -e "\n" >> ../NEWS_update.log;
  cd ../;
done
echo -e "NEWS_update.log has release notes";

No comments:

Post a Comment