From 0c9278c7e8f06f4cbc4f877dd6b29c3ffe844c0d Mon Sep 17 00:00:00 2001 From: Davide Madrisan Date: Tue, 1 May 2012 23:18:39 +0200 Subject: [PATCH] pck-update: stop execution with an error code when specfile.newrelease() reports an error Signed-off-by: Davide Madrisan --- ChangeLog | 11 +++++++++++ plugins/pck-update.in | 31 +++++++++++++++++-------------- po/it/pck-update.po | 5 ++++- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4c5cc65..cd2a9c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Changes in version 1.10.1 +--- Maj -- 2012 Davide Madrisan + ++ bugfix + * pck-update - Davide Madrisan: + Stop pck-update execution with an error code when 'specfile.newrelease()' + reports an error. + (Bug reported by Silvan Calarco.) + +------------------------------------------------------------------------------- + Changes in version 1.10.0 Tue Maj 01 2012 Davide Madrisan diff --git a/plugins/pck-update.in b/plugins/pck-update.in index 6379268..ba4adaa 100644 --- a/plugins/pck-update.in +++ b/plugins/pck-update.in @@ -565,15 +565,19 @@ function specfile.newrelease() { ( . $infofile - # NOTE: we only accept release strings in the format '' + # NOTE: allowed format is: '' [[ "$SPEC_RELEASE" =~ ^[0-9]+(\.[0-9]+){0,}[^0-9\.]+.*$ ]] || - { notify.debug "\ -$FUNCNAME: SPEC_RELEASE ($SPEC_RELEASE): unsupported format"; - exit 1; } + notify.error \ + $"release number: unsupported format"": \"$SPEC_RELEASE\"" if [ "$pck_newver" = $SPEC_VERSION ]; then if [ "$pck_newrel" ]; then - [[ "$pck_newrel" =~ ^[0-9]+.*${DISTRO_rpm}$ ]] || exit 1 + [[ "$pck_newrel" =~ ^[0-9]+.*${DISTRO_rpm}$ ]] || + notify.error \ + $"release number: unsupported format"": \"$pck_newrel\"" + [ "$pck_newrel" '>' "$SPEC_RELEASE" ] || + notify.error $"\ +new release number \"$pck_newrel\" <= current release \"$SPEC_RELEASE\"" echo "$pck_newrel" else local sr_relnum="${SPEC_RELEASE%%[^0-9\.]*}" @@ -583,11 +587,12 @@ $FUNCNAME: SPEC_RELEASE ($SPEC_RELEASE): unsupported format"; [[ "$SPEC_RELEASE" =~ ^[0-9]+(\.[0-9]+){1,}[^\.]*$ ]] && { echo "${sr_relnum%\.*}.$(( ${sr_relnum/*\./} + 1 ))${DISTRO_rpm}" - break; } + return 0; } # '<[0-9]+>' [[ "$SPEC_RELEASE" =~ ^[0-9]+[^0-9]+$ ]] && - { echo "$(( $sr_relnum + 1 ))${DISTRO_rpm}"; break; } + { echo "$(( $sr_relnum + 1 ))${DISTRO_rpm}" + return 0; } # this line should be never reached notify.error $"(bug)"" -- $FUNCNAME: "\ @@ -595,12 +600,7 @@ $"release number: unsupported format"": \"$SPEC_RELEASE\"" fi else echo "1${DISTRO_rpm}" - fi ) || \ - { echo "$SPEC_RELEASE" - [ "$pck_newrel" ] && notify.error \ - $"release number: unsupported format"": \"$pck_newrel\"" || - notify.error \ - $"release number: unsupported format"": \"$SPEC_RELEASE\""; } + fi ) || { echo "$SPEC_RELEASE"; return 1; } } # function specfile.checksintax() @@ -1479,8 +1479,11 @@ s|\(.*[ \t]*${define_list_name[$i]}[ \t]*\).*|\1${define_list_value[$i]}|}" \ fi fi - local specfile_newrelease="\ + # NOTE: local specfile_newrelease="$(...)" does not work! + local specfile_newrelease + specfile_newrelease="\ $(specfile.newrelease "$pck_newver" "$pck_newrel")" + [ $? -eq 0 ] || exit 1 if [ "$spec_format" = 1 ]; then notify.debug $"specfile autoformattig enabled" diff --git a/po/it/pck-update.po b/po/it/pck-update.po index 8a5d677..2511808 100644 --- a/po/it/pck-update.po +++ b/po/it/pck-update.po @@ -226,7 +226,10 @@ msgid "missing mandatory arg" msgstr "parametro mancante" msgid "release number: unsupported format" -msgstr "release: formato non supportato" +msgstr "numero di release: formato non supportato" + +msgid "new release \\`$pck_newrel' must be greater than current one \\`$SPEC_RELEASE'" +msgstr "la nuova release \\`$pck_newrel' deve essere maggiore di quella corrente \\`$SPEC_RELEASE'" msgid "checking" msgstr "sto controllando"