diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2014-02-26 18:51:33 +0100 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2014-02-26 18:51:33 +0100 |
| commit | 2c310662cdbbcc84eab87af90b2b1ee964c560c1 (patch) | |
| tree | 716fc18a4bd8e4bcd9f999d1ddc5e971c99eae03 | |
| parent | 5274821c5d92a9267ec992ec1d6757c4765ee5e8 (diff) | |
| download | bdrem-2c310662cdbbcc84eab87af90b2b1ee964c560c1.tar.gz bdrem-2c310662cdbbcc84eab87af90b2b1ee964c560c1.zip | |
script to copy pear package dependencies
| -rw-r--r-- | .gitignore | 1 | ||||
| -rwxr-xr-x | bin/fetch-deps.php | 45 | ||||
| -rw-r--r-- | deps.txt | 4 |
3 files changed, 50 insertions, 0 deletions
@@ -1,2 +1,3 @@ /data/bdrem.config.php /dist/ +/lib diff --git a/bin/fetch-deps.php b/bin/fetch-deps.php new file mode 100755 index 0000000..112a1f0 --- /dev/null +++ b/bin/fetch-deps.php @@ -0,0 +1,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"; +} +?> diff --git a/deps.txt b/deps.txt new file mode 100644 index 0000000..083560f --- /dev/null +++ b/deps.txt @@ -0,0 +1,4 @@ +pear.php.net/Console_Color2 +pear.php.net/Console_CommandLine +pear.php.net/Console_Table +pear.php.net/Mail_mime |
