From 5a4f897d101bc17b86258c1327681c02bbe11c56 Mon Sep 17 00:00:00 2001 From: Trevor Batley Date: Tue, 30 May 2023 12:44:27 +1000 Subject: [PATCH] add in changelog script --- changelog | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 changelog diff --git a/changelog b/changelog new file mode 100755 index 0000000..7dce9b6 --- /dev/null +++ b/changelog @@ -0,0 +1,74 @@ +#!/bin/bash + + +#echo $1 +#exit 0 + + +LANG="en_us_8859_1"; +dateJ=`date "+%Y-%m-%d"`; +dateH=`date "+%a %b %d %Y"`; + + +if [[ $1 ]] && [ ${1##*.} == "spec" ] +then +specfile=$1 +else +specfile=`grep '\.spec' ./CVS/Entries|cut -d'/' -f2` +fi + +echo "search for release in $specfile"; +# could be +#%define main_release 12.6 +#%define release 2 +#%define release 2%{?dist} +#Release: 24 +#Release: 24%{?dist} +rele=0; +release=`cat $specfile|egrep '^%define (main_)?release'|cut -d " " -f3|cut -d% -f1`; +if [[ ! $release ]]; then + release=`cat $specfile|egrep '^Release:'|cut -d ":" -f2| tr -d "[:space:]"|cut -d% -f1`; + rele=1; +fi + +echo "search for version in $specfile"; +#%define version 23 +#Version: 23 +version=`cat $specfile|grep -i '%define version'|cut -d " " -f3|cut -d% -f1`; +if [[ ! $version ]]; then + version=`cat $specfile|egrep '^Version:'|cut -d ":" -f2| tr -d "[:space:]"`; +fi + + + +echo "update release"; +oldrelease=$release; +#release=$(($release + 1));# do not handle float +#release=`echo "$release + 1"|bc`; # not always available +addme=1; +if [[ "$release" =~ ^[0-9]+\.[0-9]+$ ]] +then +addme=0.1; +fi +release=`lua -e "print( $release + $addme)"`; +echo "update release $oldrelease ==> $release"; +if [ "$rele" -eq "0" ]; then + cat $specfile |sed -r "s/(^%define (main_)?release) *$oldrelease/\1 $release/">$specfile.tmp; +else + cat $specfile |sed -r "s/(^Release:) *$oldrelease/\1 $release/">$specfile.tmp; +fi +cat $specfile.tmp > $specfile; + +echo "updating changelog $specfile"; +entete="* $dateH Brian Read $version-$release.sme" +changelog="- fix [SME: ]" +cat $specfile |sed "/^%changelog/a $entete\n$changelog\n" >$specfile.tmp; +cat $specfile.tmp>$specfile; +rm -f $specfile.tmp +echo "nano $specfile" +# and check for old directory +if [ -d "*.old" ]; then + echo "old found" +else + echo "***Remember to make the old directory!!***" +fi