Date: Tue, 3 Jan 2012 20:18:12 -0800 From: Jason Helfman <jgh@FreeBSD.org> To: Paul Schmehl <pschmehl_lists@tx.rr.com> Cc: ohauer@freebsd.org, freebsd-ports@FreeBSD.org Subject: Re: How to detect the version of a installed perl module during portbuild Message-ID: <20120104041811.GA77025@dormouse.experts-exchange.com> In-Reply-To: <CE503C49DD251ECD02D0F7E1@utd71538.utdallas.edu> References: <4F036A7F.1000908@FreeBSD.org> <CE503C49DD251ECD02D0F7E1@utd71538.utdallas.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
-----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@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@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-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120104041811.GA77025>