Skip to content

Commit

Permalink
use rpm to query the spec version
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidner committed Dec 10, 2013
1 parent 65528d1 commit 3def8d7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build-tools/Makefile.am.toplevel
Expand Up @@ -10,7 +10,7 @@
Y2TOOL = $(Y2DEVTOOLS_PREFIX)/bin/y2tool

RPMNAME = $(shell cat $(srcdir)/RPMNAME)
VERSION = $(shell grep '^[[:space:]]*Version:' $(srcdir)/package/$(RPMNAME).spec | sed -e 's/Version:[[:space:]]*\([[:print:]]\+\)/\1/')
VERSION = $(shell rpm --specfile --qf "%{VERSION}" $(srcdir)/package/$(RPMNAME).spec)
SUBDIRS_FILE = $(shell test -e $(srcdir)/SUBDIRS && echo SUBDIRS)
ACINCLUDE_FILE = $(shell test -e $(srcdir)/acinclude.m4 && echo acinclude.m4)

Expand Down
3 changes: 1 addition & 2 deletions build-tools/cmake/modules/YastCommon.cmake
Expand Up @@ -51,8 +51,7 @@ ENDIF (NOT DEFINED RPMNAME)

MESSAGE(STATUS "package name set to '${RPMNAME}'")
file (GLOB spec_files "package/*.spec")
execute_process(COMMAND "grep" "^[[:space:]]*Version:" ${spec_files}
COMMAND "sed" "-e" "s/Version:[[:space:]]*\\([[:print:]]\\+\\)/\\1/"
execute_process(COMMAND "rpm" "--specfile" "--qf" "%{VERSION}" ${spec_files}
OUTPUT_VARIABLE VERSION)
message(STATUS "Version: ${VERSION}")

Expand Down
3 changes: 2 additions & 1 deletion build-tools/scripts/y2autoconf
Expand Up @@ -39,7 +39,8 @@ if ($#ARGV >= 0 && ($ARGV[0] eq "-h" || $ARGV[0] eq "--help"))
$RPMNAME = `cat RPMNAME`;
chomp $RPMNAME;

$VERSION = `grep '^[[:space:]]*Version:' package/$RPMNAME.spec | sed -e 's/Version:[[:space:]]*\([[:print:]]\+\)/\1/'`;
# the query is dofferent from other places, need to escape %

This comment has been minimized.

Copy link
@lslezak

lslezak Dec 10, 2013

Member

Just a typo: different

$VERSION = `rpm --specfile --qf "\%{VERSION}" package/$RPMNAME.spec`;
chomp $VERSION;

$MAINTAINER = `cat MAINTAINER`;
Expand Down
2 changes: 1 addition & 1 deletion ytools/y2tool/tagversion
Expand Up @@ -30,7 +30,7 @@ while true; do
done

p=`cat RPMNAME`
v=`grep '^[[:space:]]*Version:' package/$p.spec | sed -e 's/Version:[[:space:]]*\([[:print:]]\+\)/\1/' | tr "." "_"`
v=`rpm --specfile --qf "%{VERSION}" package/$p.spec | tr "." "_"`
if [ -z "$p" -o -z "$v" ]; then
echo "Cannot find RPMNAME or Version value in package/$p.spec in `pwd`"
exit 1
Expand Down

0 comments on commit 3def8d7

Please sign in to comment.