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

2012-01-04 Thread Matthew Seaman
On 03/01/2012 23:41, Paul Schmehl wrote:
 This returns the installed package:
 
 pkg_info -qa | grep p5-JSON-RPC | sort | uniq

Woah!  Try it like this:

pkg_info -Ex p5-JSON-RPC

 so maybe you could do something like?
 
 JSON_VER=`pkg_info -qa | grep p5-JSON-RPC | sort | uniq | cut -d'-' -f4`

JSON_VER=$( pkg_info -Ex p5-JSON-RPC | sed -e 's/^.*-//' )

 .if ${JSON_VER} = 1
  do this
 .else
  do this
 .endif

case ${JSON_VER) in
1.*)
do_stuff
;;
0.*)
do_something_else
;;
esac

case does a string comparison using standard shell globbing rules --
it's a lot more flexible than trying to do maths on version numbers.

Using perl to generate the version number is also viable as suggested by
Jason:

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

but it strikes me as slightly wasteful to fire up an entire perl
interpreter just to print out the value of one variable.

However, if the object is to create a port that has a BUILD_DEPENDS on
devel/p5-JSON-RPC then you only need to support what is already in the
ports -- and that's version 1.01.  The BUILD_DEPENDS line can enforce that:

BUILD_DEPENDS = p5-JSON-RPC=1.01:${PORTSDIR}/devel/p5-JSON-RPC

Should you have some program that requires JSON::RPC = 0.96, then
create a p5-JSON-RPC-096 port to provide exactly that.

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
JID: matt...@infracaninophile.co.uk   Kent, CT11 9PW



signature.asc
Description: OpenPGP digital signature


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

2012-01-04 Thread Chris Rees
On 4 Jan 2012 08:59, Matthew Seaman m.sea...@infracaninophile.co.uk
wrote:

 On 03/01/2012 23:41, Paul Schmehl wrote:
  This returns the installed package:
 
  pkg_info -qa | grep p5-JSON-RPC | sort | uniq

 Woah!  Try it like this:

 pkg_info -Ex p5-JSON-RPC

  so maybe you could do something like?
 
  JSON_VER=`pkg_info -qa | grep p5-JSON-RPC | sort | uniq | cut -d'-'
-f4`

 JSON_VER=$( pkg_info -Ex p5-JSON-RPC | sed -e 's/^.*-//' )

$$(

It's a Makefile, don't forget ;)


  .if ${JSON_VER} = 1
   do this
  .else
   do this
  .endif

 case ${JSON_VER) in
1.*)
do_stuff
;;
0.*)
do_something_else
;;
 esac

 case does a string comparison using standard shell globbing rules --
 it's a lot more flexible than trying to do maths on version numbers.

 Using perl to generate the version number is also viable as suggested by
 Jason:

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

 but it strikes me as slightly wasteful to fire up an entire perl
 interpreter just to print out the value of one variable.

 However, if the object is to create a port that has a BUILD_DEPENDS on
 devel/p5-JSON-RPC then you only need to support what is already in the
 ports -- and that's version 1.01.  The BUILD_DEPENDS line can enforce
that:

 BUILD_DEPENDS = p5-JSON-RPC=1.01:${PORTSDIR}/devel/p5-JSON-RPC

 Should you have some program that requires JSON::RPC = 0.96, then
 create a p5-JSON-RPC-096 port to provide exactly that.

Cheers,

Matthew

 --
 Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
  Flat 3
 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
 JID: matt...@infracaninophile.co.uk   Kent, CT11 9PW

___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


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

2012-01-04 Thread Olli Hauer
On 2012-01-03 21:52, 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*
 ...^^
 

Thanks for all the suggestions ;)

Meanwhile the following solutions was suggested from upstream (will be 
implemented as patch in the port)

-use base qw(JSON::RPC::Server::CGI);
+BEGIN {
+eval { require JSON::RPC::Server::CGI; };
+if ($@) {
+require JSON::RPC::Legacy::Server::CGI;
+our @ISA = qw(JSON::RPC::Legacy::Server::CGI);
+}
+else {
+our @ISA = qw(JSON::RPC::Server::CGI);
+}
+}


--
 olli
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


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

2012-01-04 Thread Paul Schmehl
--On January 4, 2012 8:59:12 AM + Matthew Seaman 
m.sea...@infracaninophile.co.uk wrote:



On 03/01/2012 23:41, Paul Schmehl wrote:

This returns the installed package:

pkg_info -qa | grep p5-JSON-RPC | sort | uniq


Woah!  Try it like this:

pkg_info -Ex p5-JSON-RPC



I bow to the master.

--
Paul Schmehl, Senior Infosec Analyst
As if it wasn't already obvious, my opinions
are my own and not those of my employer.
***
It is as useless to argue with those who have
renounced the use of reason as to administer
medication to the dead. Thomas Jefferson
There are some ideas so wrong that only a very
intelligent person could believe in them. George Orwell

___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


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

2012-01-03 Thread Olli Hauer
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*
...^^


--
olli
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


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

2012-01-03 Thread Paul Schmehl

--On January 3, 2012 9:52:15 PM +0100 Olli Hauer oha...@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

--
Paul Schmehl, Senior Infosec Analyst
As if it wasn't already obvious, my opinions
are my own and not those of my employer.
***
It is as useless to argue with those who have
renounced the use of reason as to administer
medication to the dead. Thomas Jefferson
There are some ideas so wrong that only a very
intelligent person could believe in them. George Orwell

___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


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

2012-01-03 Thread Jason Helfman
-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 oha...@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
j...@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-
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org