From owner-freebsd-ports@FreeBSD.ORG Wed Jan 4 04:18:53 2012 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97F301065675 for ; Wed, 4 Jan 2012 04:18:53 +0000 (UTC) (envelope-from bsd-src@helfman.org) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 524EE8FC08 for ; Wed, 4 Jan 2012 04:18:53 +0000 (UTC) Received: by iadj38 with SMTP id j38so40118037iad.13 for ; Tue, 03 Jan 2012 20:18:52 -0800 (PST) Received: by 10.50.189.137 with SMTP id gi9mr30973185igc.1.1325650732017; Tue, 03 Jan 2012 20:18:52 -0800 (PST) Received: from dormouse.experts-exchange.com ([72.29.164.238]) by mx.google.com with ESMTPS id g34sm184525326ibk.10.2012.01.03.20.18.50 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jan 2012 20:18:51 -0800 (PST) Sender: Jason Helfman Date: Tue, 3 Jan 2012 20:18:12 -0800 From: Jason Helfman To: Paul Schmehl Message-ID: <20120104041811.GA77025@dormouse.experts-exchange.com> References: <4F036A7F.1000908@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; x-action=pgp-signed In-Reply-To: X-Operating-System: FreeBSD 8.2-RELEASE amd64 Organization: The FreeBSD Project, http://www.freebsd.org X-Living-The-Dream: I love the SLO Life! X-PGP-FingerPrint: 8E0D C457 9A0F C91C 23F3 0454 2059 9A63 4150 D3DC X-PGP-Key: http://people.freebsd.org/~jgh/jgh.asc User-Agent: Mutt/1.5.21 (2010-09-15) Cc: ohauer@freebsd.org, freebsd-ports@FreeBSD.org Subject: Re: How to detect the version of a installed perl module during portbuild X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 04:18:53 -0000 -----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 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-----