From e0ad10cbdf4e5103e32dd2c4828ecf4f04c67241 Mon Sep 17 00:00:00 2001 From: Davide Madrisan Date: Sat, 21 Jan 2012 23:24:37 +0100 Subject: [PATCH] pck-update: Display the error detected by the command "rpm -q --specfile --specedit" when a specfile contains errors Signed-off-by: Davide Madrisan --- ChangeLog | 10 ++++++++++ plugins/pck-update.in | 12 ++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 438b877..383c5f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Changes in version 1.9.1 +--- --- -- 2012 Davide Madrisan + ++ improvement + * pck-update - Davide Madrisan: + Display the error detected by the command 'rpm -q --specfile --specedit' + when a specfile contains errors. + +-------------------------------------------------------------------------------- + Changes in version 1.9.0 - Silvan Birthday Release Sun Jan 15 2012 Davide Madrisan diff --git a/plugins/pck-update.in b/plugins/pck-update.in index 5e5d6dc..5818589 100644 --- a/plugins/pck-update.in +++ b/plugins/pck-update.in @@ -439,12 +439,20 @@ done)" # create the specfile_preprocessed only once if [ ! -s "$specfile_preprocessed" ]; then + local tmpspreprerr=$(mktemp -q -t $me.XXXXXXXX) + [ $? -eq 0 ] || notify.error $"can't create temporary files" + notify.debug "tmpspreprerr = \`${NOTE}$tmpspreprerr${NORM}'" + notify.debug "running: \ rpm -q $USER_RPMDEFINE_OPTS --specfile --specedit $SRPM_SPECFILE_WITH_PATH ..." + eval "\ rpm -q $USER_RPMDEFINE_OPTS --specfile --specedit $SRPM_SPECFILE_WITH_PATH \ - 2>/dev/null >> $specfile_preprocessed" || - notify.error $"rpm exited with error code \`$?'" + 2> $tmpspreprerr >> $specfile_preprocessed" + [ -s "$tmpspreprerr" ] && + { notify.error $"specfile has errors:""\n$(\ + while read line; do echo " $line"; done < $tmpspreprerr)"; } + rm -f $tmpspreprerr fi SPECFILE_PREPROCESSED="$specfile_preprocessed"