Subject: Re: Changes to use new PEAR features (channels and package.xml v2)
To: None <tech-pkg@netbsd.org>
From: Christopher W. Richardson <cwr@nexthop.com>
List: tech-pkg
Date: 06/27/2007 13:35:17
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

"Christopher W. Richardson" <cwr@nexthop.com> writes:

> And, of course, I spoke too soon ... I have no confirmed that the
> patch I previously provided actually breaks existing pear
> packages.  I'll take another look at it this evening.

OK, I fixed it.  Here's a patch which I've tested with 1/2 a
dozen pear packages and works fine both for old and new ones:

RCS file: /cvsroot/pkgsrc/lang/php/pear_plist.php,v
retrieving revision 1.4
diff -r1.4 pear_plist.php
14,17c14,30
< if (!empty($info['attribs']) && $info['attribs']['version'] ==
'2.0')
<       $pkg = $info['name'];
< else
<       $pkg = $info['package'];
- ---
> #
> # Read in package.xml using new API, and extract channel
> information
> $z = &PEAR_Config::singleton();
> $package = new PEAR_PackageFile($z);
> $pf = $package->fromAnyFile("$WRKSRC/package.xml",
> PEAR_VALIDATE_NORMAL);
>
> $version = $pf->getPackagexmlVersion();
>
> #
> # Use new method to get package name and channel info
> if ($version == '1.0')
>         $pkg = $pf->_packageInfo['package'];
> else {
>         $pkg = $pf->_packageInfo['name'];
>         $channel = $pf->_packageInfo['channel'];
> }
>
20c33,38
< echo "$PEAR_LIB/.registry/".strtolower($pkg).".reg\n";
- ---
> if (($version == '1.0') || ($channel == 'pear.php.net'))
>         echo "$PEAR_LIB/.registry/".strtolower($pkg).".reg\n";
> else
>         echo "$PEAR_LIB/.registry/.channel." . $channel . "/" .
>             strtolower($pkg) . ".reg\n";
>

Cheers,
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (NetBSD)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFGgp/UP65RBOOHTzERAuuQAKDXx7d5aXg+RtB/B5zvXydkS1IqMQCdHGF7
xEKwL25FvQJltlXvoBH7WbM=
=S4SV
-----END PGP SIGNATURE-----