pck-update: Display the error detected by the command "rpm -q --specfile --specedit" when a specfile contains errors

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2012-01-21 23:24:37 +01:00
parent e8bd1780dc
commit e0ad10cbdf
2 changed files with 20 additions and 2 deletions

View File

@ -1,3 +1,13 @@
Changes in version 1.9.1
--- --- -- 2012 Davide Madrisan <davide.madrisan(a)gmail.com>
+ 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 <davide.madrisan(a)gmail.com>

View File

@ -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"