How to detect the version of a installed perl module during portbuild

Jason Helfman jgh at FreeBSD.org
Wed Jan 4 04:18:53 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Jan 03, 2012 at 05:41:01PM -0600, Paul Schmehl thus spake:
>--On January 3, 2012 9:52:15 PM +0100 Olli Hauer <ohauer at FreeBSD.org> wrote:
>
>> Hi,
>>
>> I'm searching a solution to detect the version of p5-JSON-RPC during
>> build time.
>>
>> JSON-RPC-1.01 is *not* backward compatible to 0.96 so I have to apply a
>> fix to the port only if JSON-RPC > 0.96 is installed.
>>
>>
>>> From http://cpansearch.perl.org/src/DMAKI/JSON-RPC-1.01/Changes
>> 1.00_01  2011 Nov 16
>>     - If you are using old JSON::RPC code (up to 0.96), DO NOT EXPECT
>>       YOUR CODE TO WORK. THIS VERSION IS BACKWARDS *INCOMPATIBLE*
>> ...................................................^^^^^^^^^^^^^^
>>
>
>This returns the installed package:
>
>pkg_info -qa | grep "p5-JSON-RPC" | sort | uniq
>
>so maybe you could do something like?
>
>JSON_VER=`pkg_info -qa | grep "p5-JSON-RPC" | sort | uniq | cut -d'-' -f4`
>
>.if ${JSON_VER} >= 1
>  do this
>.else
>  do this
>.endif
>

This may be more clean:

$ perl -MJSON::RPC -le 'print $JSON::RPC::VERSION'
1.01

- -jgh

- -- 
Jason Helfman         | FreeBSD Committer
jgh at FreeBSD.org       | http://people.freebsd.org/~jgh
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iQEcBAEBAgAGBQJPA9MDAAoJECBZmmNBUNPcpNwH/2sQp0rr0Nl0a7pfS99EV15y
YAae3zfYoQcLEURO8bovAtYWWdPFlWpXTyvCwp85z/kXx+qm3BtgRLMh/37Nkoep
qkkM3qj5j5SGQE9iqGUBKM7bSeoi4J2NJcQG+dJlFY8/uWQwby63WQt/a2P+pUb/
MxXIPkkLs3DkF+RWU63xrYIC7px4YNSpL3DZaetDEVM/O6tLod990qfVRkE+bRdj
SPxdIkPOD0c9klzGEBkVoQlDBkMLKpgnMw2RVwG/T6G1L6uKdOe8xOmrVDowm1KS
KT8Su29j89BR7NJdlr8OxNj0Y2JiUlsPihu2kZOGvddogjKZC3y6yZ5ckEbIBeg=
=DfSK
-----END PGP SIGNATURE-----


More information about the freebsd-ports mailing list