libspec.lib: use rpmspec -P <specfile> instead of rpm -q --specedit ... if rpm 4 is detected

This commit is contained in:
Silvan Calarco 2019-06-25 22:21:20 +02:00
parent b20b079907
commit 08bfa59a98
2 changed files with 15 additions and 3 deletions

View File

@ -23,6 +23,9 @@
packager_fullname=
packager_email=
## Detect rpm version
rpm_version="`rpm --version | sed 's|.* .* ||'`"
## Mode to be used when creating and updating the specfiles -------------------
rpm_specfile_mode="644"

View File

@ -637,12 +637,21 @@ $FUNCNAME: specfile_preprocessed = \"$specfile_preprocessed\""
notify.error "$FUNCNAME: "$"can't create temporary files"
notify.debug "$FUNCNAME: tmpspreprerr = \`${NOTE}$tmpspreprerr${NORM}'"
if [ "${rpm_version:0:2}" == "5." ]; then
notify.debug "\
$FUNCNAME: running: rpm -q $rpm_options --specfile --specedit $specfile ..."
eval "\
rpm -q $rpm_options --specfile --specedit $specfile \
> $specfile_preprocessed 2> $tmpspreprerr"
else
notify.debug "\
$FUNCNAME: running: rpmspec $rpm_options -P $specfile ..."
eval "\
rpmspec $rpm_options -P $specfile \
> $specfile_preprocessed 2> $tmpspreprerr"
fi
if [ -s "$tmpspreprerr" ]; then
notify.warning $"\