summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradrianp <adrianp@pkgsrc.org>2007-04-15 13:46:42 +0000
committeradrianp <adrianp@pkgsrc.org>2007-04-15 13:46:42 +0000
commitd9a1374854184e6894871f27b96fb1b25ebcd148 (patch)
treef1ab4f4e2c30b47314419869e6b53f61be115c8c
parent1775f79f4f4e7c526d4de64d623d26dce858b7dd (diff)
downloadpkgsrc-d9a1374854184e6894871f27b96fb1b25ebcd148.tar.gz
* Support v2 of the pear-* package format that is being used by some
newer pear packages. * Fix the case where an extra slash would be appended to the file path in the PLIST. * Both fixes from from Loic Hoguin and tested by Loic and myself.
-rw-r--r--lang/php/pear_plist.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/lang/php/pear_plist.php b/lang/php/pear_plist.php
index 537d1ca5561..eb4a63e56de 100644
--- a/lang/php/pear_plist.php
+++ b/lang/php/pear_plist.php
@@ -1,5 +1,5 @@
<?php
-# $NetBSD: pear_plist.php,v 1.3 2004/11/01 20:31:13 jdolecek Exp $
+# $NetBSD: pear_plist.php,v 1.4 2007/04/15 13:46:42 adrianp Exp $
# Parses package XML file and outputs appropriate PLIST
$PEAR_LIB = getenv('PEAR_LIB');
@@ -10,9 +10,13 @@ $dirrm = array();
include_once "PEAR/Common.php";
$obj = &new PEAR_Common;
$info = $obj->infoFromAny("$WRKSRC/package.xml");
-$pkg = $info['package'];
-// output list of package files, in same order as specified in package
+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']) {
@@ -28,6 +32,12 @@ foreach($info['filelist'] as $f => $v) {
if (!empty($v['baseinstalldir']) && $v['baseinstalldir'] != '/') {
$prefix = $v['baseinstalldir'] . '/';
+ # 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);
+
if ($PEAR_DIRRM_BASEDIR)
$dirrm[$v['baseinstalldir']] = true;
} else
@@ -45,8 +55,8 @@ foreach($info['filelist'] as $f => $v) {
$dirrm["{$prefix}{$f}"] = true;
}
-// output @dirrm directives, in reverse order so that deeper
-// directories are removed first
+# output @dirrm directives, in reverse order so that deeper
+# directories are removed first
$dirrm = array_keys($dirrm);
rsort($dirrm);
foreach($dirrm as $dir)