blob: 112a1f08e423ea1f9a5bf230c3bd0fdf27c9682f (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/usr/bin/env php
<?php
/**
* reads pear package dependencies from deps.txt and copies them into lib/
*/
$deps = file(__DIR__ . '/../deps.txt');
$libdir = __DIR__ . '/../lib/';
error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED);
require_once 'PEAR/Registry.php';
$reg = new PEAR_Registry();
foreach ($deps as $dep) {
$dep = trim($dep);
list($channel, $pkgname) = explode('/', $dep);
$pkginfo = $reg->packageInfo($pkgname, null, $channel);
if ($pkginfo === null) {
echo 'Package not found: ' . $dep . "\n";
exit(1);
}
echo "Copying " . $channel . '/' . $pkgname . "\n";
$files = 0;
foreach ($pkginfo['filelist'] as $fileinfo) {
if ($fileinfo['role'] != 'php') {
continue;
}
$orig = $fileinfo['installed_as'];
$path = $libdir . ltrim(
$fileinfo['baseinstalldir'] . '/' . $fileinfo['name'], '/'
);
$dir = dirname($path);
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
if (!copy($orig, $path)) {
echo " Error copying $orig to $path\n";
exit(2);
}
++$files;
}
echo " copied $files files\n";
}
?>
|