[Buildroot] Bug in pkg-stats?

Peter Korsgaard jacmet at uclibc.org
Wed Oct 5 18:36:34 UTC 2011

>>>>> "H" == H Hartley Sweeten <hartleys at visionengravers.com> writes:


 H>     version=""

 H>     if grep -m1 "_VERSION" $i > /dev/null ; then
 H> 	version=`grep -m1 "_VERSION" $i | awk '{ print $NF }'`
 H>     else
 H> 	version="unknown"
 H>     fi

 H> This works fine for the packages that have _VERSION defined like:

 H> FOO_VERSION = x.y.z

 H> But it ends up with the whole line when the spaces are missing around the
 H> '='.  Oh well...

You could simply do it awk:

version=$(awk -F'=| ' '/_VERSION/ { print $NF } END { print "unknown" } ' \
          $i | head -n 1)

But it naturally still doesn't work for packages with multiple versions
(like busybox) or where version is major.minor (like glib2).

Bye, Peter Korsgaard

More information about the buildroot mailing list