[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: getting the version of a package in the rules file.



Charles Plessy <charles-debian-nospam@plessy.org> writes:

> When ran in the shell or in a $$() construct,
> dpkg-parsechangelog | grep Ver | perl -ne '/\s(.*?)\-/ ; print $1'
> gives me the upstream version number of my package.

> Howerver, the following expression does not work as expected in
> debian/rules:

> VERSION=$(shell (dpkg-parsechangelog | grep Ver | perl -ne '/\s(.*?)\-/ ; print $1'))

> Apparently, the perl oneliner returns the whole string. Is there a
> cleaner method to get the upstream version number in debian/rules ?

I use:

version := $(shell dpkg-parsechangelog | grep ^Version: \
                 | cut -d' ' -f2 | cut -d- -f1)

I'm guessing the problem with the Perl one-liner is that you need to
double the $ in $1 since you're inside make.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>



Reply to: