PG-430 Update rpm changelog automatically during build

pull/296/head
Vadim Yalovets 2022-05-31 08:43:32 +03:00
parent 3b9e180837
commit 33df4d1717
1 changed files with 25 additions and 0 deletions

View File

@ -92,6 +92,29 @@ add_percona_yum_repo(){
return
}
set_changelog(){
if [ -z $1 ]
then
echo "No spec file is provided"
return
else
start_line=0
while read -r line; do
(( start_line++ ))
if [ "$line" = "%changelog" ]
then
(( start_line++ ))
echo "$start_line"
current_date=$(date +"%a %b %d %Y")
sed -i "$start_line,$ d" $1
echo "* $current_date Percona Build/Release Team <eng-build@percona.com> - ${VERSION}-${RPM_RELEASE} >> $1
echo "- Release ${VERSION}-${RPM_RELEASE}" >> $1
return
fi
done <$1
fi
}
get_sources(){
cd "${WORKDIR}"
if [ "${SOURCE}" = 0 ]
@ -137,6 +160,8 @@ get_sources(){
sed -i "s:@@RPM_RELEASE@@:${RPM_RELEASE}:g" rpm/pg-stat-monitor.spec
sed -i "s:@@VERSION@@:${VERSION}:g" rpm/pg-stat-monitor.spec
set_changelog rpm/pg-stat-monitor.spec
cd ${WORKDIR}
#
source pg-stat-monitor.properties