summaryrefslogtreecommitdiff
path: root/lang/php/pear_plist.php
blob: b106c755e6c28e1725e6ecea0a42031fb6617384 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
# $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');
if(! $DESTDIR = getenv('DESTDIR')) $DESTDIR='';

$config = &PEAR_Config::singleton();
$package = &new PEAR_PackageFile($config);
$info = $package->fromAnyFile("$WRKSRC/package.xml", PEAR_VALIDATE_INSTALLING);

$pkg = $info->getName();
$channel = $info->getChannel();

$registry = &new PEAR_Registry($DESTDIR.$PREFIX."/".$PEAR_LIB);
$flist = $registry->packageInfo($pkg, 'filelist', $channel);

$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";
}
?>