Commit 08bfa59a98f4ee110b15d38ea133414fa6a37aad

Authored by Silvan Calarco
1 parent b20b079907
Exists in master

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

Showing 2 changed files with 15 additions and 3 deletions Side-by-side Diff

conf/autospec.conf.in
... ... @@ -23,6 +23,9 @@
23 23 packager_fullname=
24 24 packager_email=
25 25  
  26 +## Detect rpm version
  27 +rpm_version="`rpm --version | sed 's|.* .* ||'`"
  28 +
26 29 ## Mode to be used when creating and updating the specfiles -------------------
27 30 rpm_specfile_mode="644"
28 31  
... ... @@ -637,12 +637,21 @@
637 637 notify.error "$FUNCNAME: "$"can't create temporary files"
638 638 notify.debug "$FUNCNAME: tmpspreprerr = \`${NOTE}$tmpspreprerr${NORM}'"
639 639  
640   - notify.debug "\
  640 + if [ "${rpm_version:0:2}" == "5." ]; then
  641 + notify.debug "\
641 642 $FUNCNAME: running: rpm -q $rpm_options --specfile --specedit $specfile ..."
642 643  
643   - eval "\
  644 + eval "\
644 645 rpm -q $rpm_options --specfile --specedit $specfile \
645   - > $specfile_preprocessed 2> $tmpspreprerr"
  646 + > $specfile_preprocessed 2> $tmpspreprerr"
  647 + else
  648 + notify.debug "\
  649 +$FUNCNAME: running: rpmspec $rpm_options -P $specfile ..."
  650 +
  651 + eval "\
  652 +rpmspec $rpm_options -P $specfile \
  653 + > $specfile_preprocessed 2> $tmpspreprerr"
  654 + fi
646 655  
647 656 if [ -s "$tmpspreprerr" ]; then
648 657 notify.warning $"\