function Package() { $config = array("server" => array('short' => 's', 'max' => 1, 'min' => 1, 'desc' => "server URL", 'default' => ""), "package" => array('short' => 'p', 'max' => 1, 'min' => 1, 'desc' => "package name"), "debug" => array('short' => 'd', 'max' => 1, 'min' => 1, 'desc' => "debug level", 'default' => "0"), "refresh" => array('short' => 'r', 'max' => 1, 'min' => 1, 'desc' => "refresh cache", 'default' => "0")); $args =& Console_Getargs::factory($config); if (PEAR::isError($args)) { die(Console_Getargs::getHelp($config)); } $client = new FedoraPkgdb(array('debug' => intval($args->getValue('debug')), 'server' => $args->getValue('server'))); $rep = $client->getPackageInfo($args->getValue('package'), intval($args->getValue('refresh'))); if (!$rep) { die("Package not found\n"); } $first = true; foreach ($rep as $branch => $pack) { if ($first) { $first = false; echo 'Name: ' . $pack['package']['name'] . "\n"; echo 'Summary: ' . $pack['package']['summary'] . "\n"; echo 'PkgDB: ' . $client->getPackageURL($pack['package']['name']) . "\n"; echo "Description:\n" . $pack['package']['description'] . "\n"; } echo $branch . ":\t" . $pack['owner']; $i = 0; $tmp = $pack['people']; if (count($tmp)) { sort($tmp); echo " (" . implode($tmp, ', ') . ")\n"; } else { echo "\n"; } } }
* * @author Remi Collet <*****@*****.**> * @author Johan Cwiklinski <*****@*****.**> * @copyright 2010-2014 Remi Collet * @license http://www.gnu.org/licenses/agpl-3.0-standalone.html AGPL License 3.0 or (at your option) any later version * @link http://github.com/remicollet/rpmphp/ * @since The begining of times. */ header('Content-Type: application/json;charset=utf-8'); require 'include/main.php'; $name = $_GET['name']; if (!isset($name) || !$name) { $fedpkg = array('error' => 'No name provided'); } else { $fedcli = new FedoraPkgdb(); $fedpkg = $fedcli->getPackageInfo($name); if ($fedpkg === false) { $fedpkg = array('error' => 'Unknown package'); } else { //let's clean all little to avoid heavy json foreach (array_keys($fedpkg) as $k) { unset($fedpkg[$k]['specfile']); unset($fedpkg[$k]['groups']); unset($fedpkg[$k]['collection']); unset($fedpkg[$k]['collectionid']); unset($fedpkg[$k]['critpath']); unset($fedpkg[$k]['qacontact']); unset($fedpkg[$k]['statuschange']); unset($fedpkg[$k]['statuscode']); unset($fedpkg[$k]['id']); unset($fedpkg[$k]['packageid']);