Subject: Re: Changes to use new PEAR features (channels and package.xml v2)
To: Adrian Portelli <adrianp@stindustries.net>
From: Christopher W. Richardson <cwr@nexthop.com>
List: tech-pkg
Date: 06/26/2007 00:04:32
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

"Adrian Portelli" <adrianp@stindustries.net> writes:

> Christopher W. Richardson wrote:
>> I've come to two (possibly erroneous) conclusions:
>> 
>> 	1) Our PEAR stuff is not set up to use channels other
>>         than the default ones which come with pear
>>         (pear.php.net, pecl.php.net, and URI)
>
> We don't make any modifications to the PEAR defaults as such.

Right ... this isn't about modifying the defaults; it's about
doing stuff above and beyond the default behavior.

> AFAIK the only PEAR packages that have been packaged this far
> (that are in pkgsrc) come from pear.php.net so you could be
> breaking some new ground here.

Exactly my point :)

Specifically, pear creates the following directories:

lib/php/.registry/.channel.pecl.php.net
lib/php/.registry/.channel.__uri

PEAR packages from pear.php.net create *.reg files in
lib/php/.registry/. If I do, e.g.,

	pear channel-discover foo

then a new directory is created:

lib/php/.registry/.channel.foo

and packages from foo put their .reg files in
.registry/.channel./foo, rather than in .registry/.

The a) b) and c) which I originally suggested are ways of dealing
with this, and associated, magic.

>>         2) pear_plist.php does not really handle package.xml v2
>>            packages
>
> This I'm not sure about. [...] See:
>
> http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/lang/php/pear_plist.php.diff?r1=1.3&r2=1.4&f=h

Right.  I actually looked at this before the initial post.  I may
be wrong, because, as I said, I'm not really an expert on this
stuff (in fact, that's a serious understatement); but, post the
above patch, things still don't work for new package.xml flies.
See:

http://pear.php.net/manual/en/guide.developers.package2.contents.php

and

http://pear.php.net/manual/en/guide.developers.package2.release.php

Again, I could be wrong about this, but see below.

> Before we go any further with this could I get some information
> on what versions of PEAR and PHP you're running.

pkg_comp:default.conf# pear -V
PEAR Version: 1.5.4
PHP Version: 5.2.3
Zend Engine Version: 2.2.0
Running on: NetBSD ns 2.1.0_STABLE NetBSD 2.1.0_STABLE (GRIZZLY) #0: Sun May  7 22:58:34 PDT 2006 cwr@ns:/usr/obj/sys/arch/i386/compile/GRIZZLY i386

> Also could you send me across what you have done so far for
> this Role_Web package ?  It would just give me and idea where
> you're up to and what problems your coming across.

You can see the problems with the trivial instantiation: using
the following for the Makefile in web/pear-Roll_Web (the
remaining files are the standard distinfo and 1-line PLIST):

	# $NetBSD$
        #

        DISTNAME=       Role_Web-1.1.1
        PKGREVISION=    1

        MAINTAINER=     cwr@nexthop.com
        COMMENT=        Provides a Web file role for the PEAR
        installer

        HOMEPAGE=	http://pearified.com/index.php?package=Role_Web

        MASTER_SITE_PEAR_PACKAGE+= http://pearified.com/get/

        .include "../../lang/php/pear.mk"
        .include "../../mk/bsd.pkg.mk"

"make" works fine with the above.  However, "make install" fails
thusly:

pkg_comp:default.conf# make install
=> Required installed package digest>=20010302: digest-20060826
found
===> Checking for vulnerabilities in php5-pear-Role_Web-1.1.1nb1
===> Installing for php5-pear-Role_Web-1.1.1nb1
=> Generating pre-install file lists
cd /pkg_comp/obj/pkgsrc/www/pear-Role_Web/default/Role_Web-1.1.1 && /usr/pkg/bin/pear "install" package.xml || exit 1
parsePackageName(): invalid package name "package.xml" in
"package.xml"
Unknown channel "pearified.com"
Parsing of package.xml from file "package.xml" failed
Cannot initialize 'package.xml', invalid or missing package file
Package "package.xml" is not valid
install failed
*** Error code 1
        
One can get past the above with:

pear channel-discover pearified.com

This is the part that we need to weave into the pear stuff
... presumably in one of the three ways I mentioned, but
potentially in other ways.  However, that just leads us to the
problem with pear_plist.php:

pkg_comp:default.conf# pear channel-discover pearified.com
Adding Channel "pearified.com" succeeded
Discovery of channel "pearified.com" succeeded
pkg_comp:default.conf# make install
=> Required installed package digest>=20010302: digest-20060826
found
===> Checking for vulnerabilities in php5-pear-Role_Web-1.1.1nb1
===> Installing for php5-pear-Role_Web-1.1.1nb1
=> Generating pre-install file lists
cd /pkg_comp/obj/pkgsrc/www/pear-Role_Web/default/Role_Web-1.1.1 && /usr/pkg/bin/pear "install" package.xml || exit 1
install ok: channel://pearified.com/Role_Web-1.1.1
pearified/Role_Web has post-install scripts:
/usr/pkg/lib/php/Pearified/Role/Web/setup.php
Use "pear run-scripts pearified/Role_Web" to run
DO NOT RUN SCRIPTS FROM UNTRUSTED SOURCES
=> Automatic manual page handling
=> Generating post-install file lists
pkg_create: can't stat `/usr/pkg/lib/php/.registry/role_web.reg'
=> Registering installation for php5-pear-Role_Web-1.1.1nb1
pkg_admin: php5-pear-Role_Web-1.1.1nb1: File `/usr/pkg/lib/php/.registry/role_web.reg' is in +CONTENTS but not on filesystem!
php5-pear-Role_Web-1.1.1nb1 requires installed package php-5.2.3nb2
php5-pear-Role_Web-1.1.1nb1 requires installed package php5-pear-1.5.4nb1
=> Checking file-check results for php5-pear-Role_Web-1.1.1nb1
ERROR: ************************************************************
ERROR: The following files are in the PLIST but not in /usr/pkg:
ERROR:         /usr/pkg/lib/php/.registry/role_web.reg
ERROR: ************************************************************
ERROR: The following files are in /usr/pkg but not in the PLIST:
ERROR:         /usr/pkg/lib/php/.channels/.alias/pearified.txt
ERROR:         /usr/pkg/lib/php/.channels/pearified.com.reg
ERROR:         /usr/pkg/lib/php/.registry/.channel.pearified.com/role_web.reg
*** Error code 1

The problems start with the "can't stat" above ... because that
file is actually in
/usr/pkg/lib/php/.registry/.channel.pearified.com/ ... and then
there are the file list problems which I believe are associated
with using the deprecated function call in pear_plist.php, rather
than the new one.

What do you think?

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

iD8DBQFGgJBMP65RBOOHTzERAu2GAJ93ZGmjRJkGhte0dP7bAHgmYe36oACgxVeW
6s746roJv0o/CuO9fnduAe4=
=kniP
-----END PGP SIGNATURE-----