diff options
author | obache <obache> | 2010-08-29 06:08:07 +0000 |
---|---|---|
committer | obache <obache> | 2010-08-29 06:08:07 +0000 |
commit | 9f852f103b6f336c17986b423dd8d35010d457ed (patch) | |
tree | 34f30096a9c28eca0c22aafbb6b13bf3bf0e86d0 /lang/php | |
parent | 523c6d0c8deefa09cc433398874d0777c7a40636 (diff) | |
download | pkgsrc-9f852f103b6f336c17986b423dd8d35010d457ed.tar.gz |
Improve pear package handling
* support packages from other than default channels
* replace deprecated function usage in pear_plist.php
* generate filelist from installed registry, to support "install as" files.
tested with all pear pacakgs in pkgsrc.
Diffstat (limited to 'lang/php')
-rw-r--r-- | lang/php/pear.mk | 27 | ||||
-rw-r--r-- | lang/php/pear_plist.php | 68 |
2 files changed, 32 insertions, 63 deletions
diff --git a/lang/php/pear.mk b/lang/php/pear.mk index e98f0751679..3acff4b245c 100644 --- a/lang/php/pear.mk +++ b/lang/php/pear.mk @@ -1,4 +1,4 @@ -# $NetBSD: pear.mk,v 1.19 2010/08/25 06:37:20 obache Exp $ +# $NetBSD: pear.mk,v 1.20 2010/08/29 06:08:07 obache Exp $ # # This Makefile fragment is intended to be included by packages that build # and install pear packages. @@ -37,11 +37,11 @@ PEAR_LIB= lib/php PEAR_DESTDIR= -P ${DESTDIR} -f .endif -# Dynamic PLIST, generated via a helper PHP script, which parses the package -# XML config file. +# Dynamic PLIST, generated via a helper PHP script, which use registry. PEAR_GENERATE_PLIST= \ ${ECHO} "@comment The following lines are automatically generated"; \ - PEAR_LIB="${PEAR_LIB}" WRKSRC="${WRKSRC}" \ + ${SETENV} PEAR_LIB=${PEAR_LIB:Q} WRKSRC=${WRKSRC:Q} \ + ${INSTALL_ENV} PREFIX=${PREFIX:Q} \ ${PREFIX}/bin/php -d include_path=".:${PREFIX}/lib/php" \ -C -n ${PKGDIR}/../../lang/php/pear_plist.php; GENERATE_PLIST+= ${PEAR_GENERATE_PLIST} @@ -53,20 +53,15 @@ post-extract: do-install: cd ${WRKSRC} && ${SETENV} TZ=UTC \ - ${PEAR_CMD} "install" ${PEAR_DESTDIR} -n package.xml || exit 1 + ${PEAR_CMD} "install" ${PEAR_DESTDIR} -n -O package.xml || exit 1 .if ${_USE_DESTDIR} != "no" -CHECK_FILES_SKIP+= ${PREFIX}/lib/php/.channels/.alias/phpdocs.txt -CHECK_FILES_SKIP+= ${PREFIX}/lib/php/.channels/.alias/pear.txt -CHECK_FILES_SKIP+= ${PREFIX}/lib/php/.channels/.alias/pecl.txt -CHECK_FILES_SKIP+= ${PREFIX}/lib/php/.channels/__uri.reg -CHECK_FILES_SKIP+= ${PREFIX}/lib/php/.channels/doc.php.net.reg -CHECK_FILES_SKIP+= ${PREFIX}/lib/php/.channels/pear.php.net.reg -CHECK_FILES_SKIP+= ${PREFIX}/lib/php/.channels/pecl.php.net.reg -CHECK_FILES_SKIP+= ${PREFIX}/lib/php/.depdb -CHECK_FILES_SKIP+= ${PREFIX}/lib/php/.depdblock -CHECK_FILES_SKIP+= ${PREFIX}/lib/php/.filemap -CHECK_FILES_SKIP+= ${PREFIX}/lib/php/.lock +CHECK_FILES_SKIP+= ${PREFIX}/lib/php/\.channels/\.alias/.*\.txt +CHECK_FILES_SKIP+= ${PREFIX}/lib/php/\.channels/.*\.reg +CHECK_FILES_SKIP+= ${PREFIX}/lib/php/\.depdb +CHECK_FILES_SKIP+= ${PREFIX}/lib/php/\.depdblock +CHECK_FILES_SKIP+= ${PREFIX}/lib/php/\.filemap +CHECK_FILES_SKIP+= ${PREFIX}/lib/php/\.lock .endif .include "../../lang/php/phpversion.mk" diff --git a/lang/php/pear_plist.php b/lang/php/pear_plist.php index 6f3244708e5..b106c755e6c 100644 --- a/lang/php/pear_plist.php +++ b/lang/php/pear_plist.php @@ -1,58 +1,32 @@ <?php -# $NetBSD: pear_plist.php,v 1.7 2009/06/14 22:58:02 joerg Exp $ +# $NetBSD: pear_plist.php,v 1.8 2010/08/29 06:08:07 obache Exp $ # Parses package XML file and outputs appropriate PLIST +include_once "PEAR/Registry.php"; +include_once "PEAR/PackageFile.php"; + +$PREFIX = getenv('PREFIX'); $PEAR_LIB = getenv('PEAR_LIB'); $WRKSRC = getenv('WRKSRC'); -$PEAR_DIRRM_BASEDIR = getenv('PEAR_DIRRM_BASEDIR'); -$PEAR_DIRRM_EXCLUDE = getenv('PEAR_DIRRM_EXCLUDE'); -$dirrm = array(); - -include_once "PEAR/Common.php"; -$obj = &new PEAR_Common; -$info = $obj->infoFromAny("$WRKSRC/package.xml"); - -if (!empty($info['attribs']) && $info['attribs']['version'] == '2.0') - $pkg = $info['name']; -else - $pkg = $info['package']; - -# output list of package files, in same order as specified in package -echo "$PEAR_LIB/.registry/".strtolower($pkg).".reg\n"; -foreach($info['filelist'] as $f => $v) { - switch($v['role']) { - case 'test': - case 'doc': - case 'data': - $prefix = "$v[role]/$pkg/"; - $dirrm["$v[role]/$pkg"] = true; - break; +if(! $DESTDIR = getenv('DESTDIR')) $DESTDIR=''; - case 'php': - default: - if (!empty($v['baseinstalldir']) && $v['baseinstalldir'] != '/') { - $prefix = $v['baseinstalldir'] . '/'; +$config = &PEAR_Config::singleton(); +$package = &new PEAR_PackageFile($config); +$info = $package->fromAnyFile("$WRKSRC/package.xml", PEAR_VALIDATE_INSTALLING); - # sometimes the baseinstalldir begins with a slash, - # which make the PLIST output to have two instead of - # one. We fix this here. - if ($prefix[0] == '/') - $prefix = substr($prefix, 1); +$pkg = $info->getName(); +$channel = $info->getChannel(); - if ($PEAR_DIRRM_BASEDIR) - $dirrm[$v['baseinstalldir']] = true; - } else - $prefix = ''; - break; - } +$registry = &new PEAR_Registry($DESTDIR.$PREFIX."/".$PEAR_LIB); +$flist = $registry->packageInfo($pkg, 'filelist', $channel); - # replace backslashes with forward slashes in the path name, for - # pear packages written by non-UNIX oriented authors. - $f = str_replace('\\', '/', $f); - - echo "{$PEAR_LIB}/{$prefix}{$f}\n"; - - while(($f = dirname($f)) && $f != '.') - $dirrm["{$prefix}{$f}"] = true; +$regfile = $PEAR_LIB.'/.registry/.channel.'.$channel.'/'.strtolower($pkg).'.reg'; +if (!file_exists($DESTDIR.$PREFIX.'/'.$regfile)) { + $regfile = $PEAR_LIB.'/.registry/'.strtolower($pkg).'.reg'; +} +echo "$regfile\n"; +# output list of package files, in same order as specified in package +foreach($flist as $f) { + echo str_replace($PREFIX.'/','', $f['installed_as'])."\n"; } ?> |