66 lines
1.8 KiB
Plaintext
66 lines
1.8 KiB
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
LANG="en_us_8859_1";
|
||
|
dateJ=`date "+%Y-%m-%d"`;
|
||
|
dateH=`date "+%a %b %d %Y"`;
|
||
|
|
||
|
|
||
|
#if [[ $1 ]] && [ -f $1 ] && [ ${1: -4} == ".spec" ]
|
||
|
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\s+(main_)?release'|sed -r 's/\s+/ /g'|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|egrep -i '%define\s+version'|sed -r 's/\s+/ /g' |cut -d " " -f3|cut -d% -f1`;
|
||
|
echo "version : $version"
|
||
|
if [[ ! $version ]]; then
|
||
|
version=`cat $specfile|egrep '^Version:'|cut -d ":" -f2| tr -d "[:space:]"`;
|
||
|
fi
|
||
|
echo "version : $version"
|
||
|
|
||
|
|
||
|
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\s+(main_)?release) *$oldrelease/\1 $release/">$specfile.tmp;
|
||
|
else
|
||
|
cat $specfile |sed -r "s/(^Release:\s+)$oldrelease/\1$release/">$specfile.tmp;
|
||
|
fi
|
||
|
cat $specfile.tmp > $specfile;
|
||
|
|
||
|
echo "updating changelog $specfile";
|
||
|
entete="* $dateH ME MYSELF <myemail@koozali.org> $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 "vim $specfile"
|