pck-update: do not ignore the release set by user

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2012-04-28 23:43:12 +02:00
parent 04a69669e4
commit d848b0a5b9
2 changed files with 38 additions and 16 deletions

View File

@ -46,6 +46,11 @@ Wed Apr 18 2012 Davide Madrisan <davide.madrisan(a)gmail.com>
Function renaming: repository.get_srpm_pckname_from_HTML() --> Function renaming: repository.get_srpm_pckname_from_HTML() -->
repository.get_srpm_pckname_from_site(). repository.get_srpm_pckname_from_site().
+ bugfix
* pck-update - Davide Madrisan:
specfile.newrelease(): do not ignore the release set by user at command
line. (Bug discovered by Silvan Calarco).
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Changes in version 1.9.4 Changes in version 1.9.4

View File

@ -558,6 +558,11 @@ $( cat $infofile | \
function specfile.newrelease() { function specfile.newrelease() {
[ -s "$infofile" ] || infofile.create [ -s "$infofile" ] || infofile.create
local pck_newver="$1"
local pck_newrel="$2"
notify.debug "$FUNCNAME: pck_newver = \"$pck_newver\""
notify.debug "$FUNCNAME: pck_newrel = \"$pck_newrel\""
( . $infofile ( . $infofile
# NOTE: we only accept release strings in the format '<version><distroid>' # NOTE: we only accept release strings in the format '<version><distroid>'
@ -567,26 +572,35 @@ $FUNCNAME: SPEC_RELEASE ($SPEC_RELEASE): unsupported format";
exit 1; } exit 1; }
if [ "$pck_newver" = $SPEC_VERSION ]; then if [ "$pck_newver" = $SPEC_VERSION ]; then
local sr_relnum="${SPEC_RELEASE%%[^0-9\.]*}" if [ "$pck_newrel" ]; then
local sr_distroid="${SPEC_RELEASE/$sr_relnum}" [[ "$pck_newrel" =~ ^[0-9]+.*${DISTRO_rpm}$ ]] || exit 1
notify.debug "$FUNCNAME: sr_relnum = \"$sr_relnum\"" echo "$pck_newrel"
notify.debug "$FUNCNAME: sr_distroid = \"$sr_distroid\"" else
local sr_relnum="${SPEC_RELEASE%%[^0-9\.]*}"
local sr_distroid="${SPEC_RELEASE/$sr_relnum}"
notify.debug "$FUNCNAME: sr_relnum = \"$sr_relnum\""
notify.debug "$FUNCNAME: sr_distroid = \"$sr_distroid\""
[[ "$SPEC_RELEASE" =~ ^[0-9]+(\.[0-9]+){1,}[^\.]*$ ]] && [[ "$SPEC_RELEASE" =~ ^[0-9]+(\.[0-9]+){1,}[^\.]*$ ]] &&
{ echo "${sr_relnum%\.*}.$(( ${sr_relnum/*\./} + 1 ))${DISTRO_rpm}" { echo "${sr_relnum%\.*}.$(( ${sr_relnum/*\./} + 1 ))${DISTRO_rpm}"
break; } break; }
# '<[0-9]+><distroid>' # '<[0-9]+><distroid>'
[[ "$SPEC_RELEASE" =~ ^[0-9]+[^0-9]+$ ]] && [[ "$SPEC_RELEASE" =~ ^[0-9]+[^0-9]+$ ]] &&
{ echo "$(( $sr_relnum + 1 ))${DISTRO_rpm}"; break; } { echo "$(( $sr_relnum + 1 ))${DISTRO_rpm}"; break; }
# this line should be never reached # this line should be never reached
notify.error $"\ notify.error $"(bug)"" -- $FUNCNAME: "\
(bug)"" -- $FUNCNAME: "$"release number: unsupported format"": \"$SPEC_RELEASE\"" $"release number: unsupported format"": \"$SPEC_RELEASE\""
fi
else else
echo "1${DISTRO_rpm}" echo "1${DISTRO_rpm}"
fi ) || \ fi ) || \
notify.error $"release number: unsupported format"": \"$SPEC_RELEASE\"" { echo "$SPEC_RELEASE"
[ "$pck_newrel" ] && notify.error \
$"release number: unsupported format"": \"$pck_newrel\"" ||
notify.error \
$"release number: unsupported format"": \"$SPEC_RELEASE\""; }
} }
# function specfile.checksintax() # function specfile.checksintax()
@ -1000,7 +1014,9 @@ function package.update() {
[[ "$pck_name" =~ \.spec$ ]] && pck_name="${pck_name%\.spec}" [[ "$pck_name" =~ \.spec$ ]] && pck_name="${pck_name%\.spec}"
local pck_newver="$3" local pck_newver="$3"
notify.debug "$FUNCNAME: pck_newver = $pck_newver"
local pck_newrel="$4" local pck_newrel="$4"
notify.debug "$FUNCNAME: pck_newrel = $pck_newrel"
if [[ $logging -eq 1 ]]; then # enable logging if [[ $logging -eq 1 ]]; then # enable logging
logging_file="\ logging_file="\
@ -1022,7 +1038,7 @@ cannot create logging directory"" (\`logging_file')"
fi fi
# note: leave here after the 'logging_file' stuff # note: leave here after the 'logging_file' stuff
notify.debug "pck_name = $pck_name" notify.debug "$FUNCNAME: pck_name = $pck_name"
# the arch on which autospec is being running # the arch on which autospec is being running
BUILD_ARCH="$(rpm --eval %_build_cpu 2>/dev/null)" BUILD_ARCH="$(rpm --eval %_build_cpu 2>/dev/null)"
@ -1463,7 +1479,8 @@ s|\(.*[ \t]*${define_list_name[$i]}[ \t]*\).*|\1${define_list_value[$i]}|}" \
fi fi
fi fi
local specfile_newrelease="$(specfile.newrelease)" local specfile_newrelease="\
$(specfile.newrelease "$pck_newver" "$pck_newrel")"
if [ "$spec_format" = 1 ]; then if [ "$spec_format" = 1 ]; then
notify.debug $"specfile autoformattig enabled" notify.debug $"specfile autoformattig enabled"