⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 package.php

📁 php-4.4.7学习linux时下载的源代码
💻 PHP
📖 第 1 页 / 共 3 页
字号:
                    $err[] = $error['message'];                }            }        }        $this->_displayValidationResults($err, $warn);        $this->ui->outputData($this->output, $command);        return true;    }    // }}}    // {{{ doCvsTag()    function doCvsTag($command, $options, $params)    {        $this->output = '';        $_cmd = $command;        if (sizeof($params) < 1) {            $help = $this->getHelp($command);            return $this->raiseError("$command: missing parameter: $help[0]");        }        $obj = &$this->getPackageFile($this->config, $this->_debug);        $info = $obj->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL);        if (PEAR::isError($info)) {            return $this->raiseError($info);        }        $err = $warn = array();        if (!$info->validate()) {            foreach ($info->getValidationWarnings() as $error) {                if ($error['level'] == 'warning') {                    $warn[] = $error['message'];                } else {                    $err[] = $error['message'];                }            }        }        if (!$this->_displayValidationResults($err, $warn, true)) {            $this->ui->outputData($this->output, $command);            return $this->raiseError('CVS tag failed');        }        $version = $info->getVersion();        $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $version);        $cvstag = "RELEASE_$cvsversion";        $files = array_keys($info->getFilelist());        $command = "cvs";        if (isset($options['quiet'])) {            $command .= ' -q';        }        if (isset($options['reallyquiet'])) {            $command .= ' -Q';        }        $command .= ' tag';        if (isset($options['slide'])) {            $command .= ' -F';        }        if (isset($options['delete'])) {            $command .= ' -d';        }        $command .= ' ' . $cvstag . ' ' . escapeshellarg($params[0]);        array_shift($params);        if (count($params)) {            // add in additional files to be tagged            $files = array_merge($files, $params);        }        foreach ($files as $file) {            $command .= ' ' . escapeshellarg($file);        }        if ($this->config->get('verbose') > 1) {            $this->output .= "+ $command\n";        }        $this->output .= "+ $command\n";        if (empty($options['dry-run'])) {            $fp = popen($command, "r");            while ($line = fgets($fp, 1024)) {                $this->output .= rtrim($line)."\n";            }            pclose($fp);        }        $this->ui->outputData($this->output, $_cmd);        return true;    }    // }}}    // {{{ doCvsDiff()    function doCvsDiff($command, $options, $params)    {        $this->output = '';        if (sizeof($params) < 1) {            $help = $this->getHelp($command);            return $this->raiseError("$command: missing parameter: $help[0]");        }        $obj = &$this->getPackageFile($this->config, $this->_debug);        $info = $obj->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL);        if (PEAR::isError($info)) {            return $this->raiseError($info);        }        $err = $warn = array();        if (!$info->validate()) {            foreach ($info->getValidationWarnings() as $error) {                if ($error['level'] == 'warning') {                    $warn[] = $error['message'];                } else {                    $err[] = $error['message'];                }            }        }        if (!$this->_displayValidationResults($err, $warn, true)) {            $this->ui->outputData($this->output, $command);            return $this->raiseError('CVS diff failed');        }        $info1 = $info->getFilelist();        $files = $info1;        $cmd = "cvs";        if (isset($options['quiet'])) {            $cmd .= ' -q';            unset($options['quiet']);        }        if (isset($options['reallyquiet'])) {            $cmd .= ' -Q';            unset($options['reallyquiet']);        }        if (isset($options['release'])) {            $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $options['release']);            $cvstag = "RELEASE_$cvsversion";            $options['revision'] = $cvstag;            unset($options['release']);        }        $execute = true;        if (isset($options['dry-run'])) {            $execute = false;            unset($options['dry-run']);        }        $cmd .= ' diff';        // the rest of the options are passed right on to "cvs diff"        foreach ($options as $option => $optarg) {            $arg = @$this->commands[$command]['options'][$option]['arg'];            $short = @$this->commands[$command]['options'][$option]['shortopt'];            $cmd .= $short ? " -$short" : " --$option";            if ($arg && $optarg) {                $cmd .= ($short ? '' : '=') . escapeshellarg($optarg);            }        }        foreach ($files as $file) {            $cmd .= ' ' . escapeshellarg($file['name']);        }        if ($this->config->get('verbose') > 1) {            $this->output .= "+ $cmd\n";        }        if ($execute) {            $fp = popen($cmd, "r");            while ($line = fgets($fp, 1024)) {                $this->output .= rtrim($line)."\n";            }            pclose($fp);        }        $this->ui->outputData($this->output, $command);        return true;    }    // }}}    // {{{ doPackageDependencies()    function doPackageDependencies($command, $options, $params)    {        // $params[0] -> the PEAR package to list its information        if (sizeof($params) != 1) {            return $this->raiseError("bad parameter(s), try \"help $command\"");        }        $obj = &$this->getPackageFile($this->config, $this->_debug);        $info = $obj->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL);        if (PEAR::isError($info)) {            return $this->raiseError($info);        }        $deps = $info->getDeps();        if (is_array($deps)) {            if ($info->getPackagexmlVersion() == '1.0') {                $data = array(                    'caption' => 'Dependencies for pear/' . $info->getPackage(),                    'border' => true,                    'headline' => array("Required?", "Type", "Name", "Relation", "Version"),                    );                foreach ($deps as $d) {                    if (isset($d['optional'])) {                        if ($d['optional'] == 'yes') {                            $req = 'No';                        } else {                            $req = 'Yes';                        }                    } else {                        $req = 'Yes';                    }                    if (isset($this->_deps_rel_trans[$d['rel']])) {                        $rel = $this->_deps_rel_trans[$d['rel']];                    } else {                        $rel = $d['rel'];                    }                    if (isset($this->_deps_type_trans[$d['type']])) {                        $type = ucfirst($this->_deps_type_trans[$d['type']]);                    } else {                        $type = $d['type'];                    }                    if (isset($d['name'])) {                        $name = $d['name'];                    } else {                        $name = '';                    }                    if (isset($d['version'])) {                        $version = $d['version'];                    } else {                        $version = '';                    }                    $data['data'][] = array($req, $type, $name, $rel, $version);                }            } else { // package.xml 2.0 dependencies display                require_once 'PEAR/Dependency2.php';                $deps = $info->getDependencies();                $reg = &$this->config->getRegistry();                if (is_array($deps)) {                    $d = new PEAR_Dependency2($this->config, array(), '');                    $data = array(                        'caption' => 'Dependencies for ' . $info->getPackage(),                        'border' => true,                        'headline' => array("Required?", "Type", "Name", 'Versioning', 'Group'),                        );                    foreach ($deps as $type => $subd) {                        $req = ($type == 'required') ? 'Yes' : 'No';                        if ($type == 'group') {                            $group = $subd['attribs']['name'];                        } else {                            $group = '';                        }                        if (!isset($subd[0])) {                            $subd = array($subd);                        }                        foreach ($subd as $groupa) {                            foreach ($groupa as $deptype => $depinfo) {                                if ($deptype == 'attribs') {                                    continue;                                }                                if ($deptype == 'pearinstaller') {                                    $deptype = 'pear Installer';                                }                                if (!isset($depinfo[0])) {                                    $depinfo = array($depinfo);                                }                                foreach ($depinfo as $inf) {                                    $name = '';                                    if (isset($inf['channel'])) {                                        $alias = $reg->channelAlias($inf['channel']);                                        if (!$alias) {                                            $alias = '(channel?) ' .$inf['channel'];                                        }                                        $name = $alias . '/';                                    }                                    if (isset($inf['name'])) {                                        $name .= $inf['name'];                                    } elseif (isset($inf['pattern'])) {                                        $name .= $inf['pattern'];                                    } else {                                        $name .= '';                                    }                                    if (isset($inf['uri'])) {                                        $name .= ' [' . $inf['uri'] .  ']';                                    }                                    if (isset($inf['conflicts'])) {                                        $ver = 'conflicts';                                    } else {                                        $ver = $d->_getExtraString($inf);                                    }                                    $data['data'][] = array($req, ucfirst($deptype), $name,                                        $ver, $group);                                }                            }                        }                    }                }            }            $this->ui->outputData($data, $command);            return true;        }        // Fallback        $this->ui->outputData("This package does not have any dependencies.", $command);    }    // }}}    // {{{ doSign()    function doSign($command, $options, $params)    {        require_once 'System.php';        require_once 'Archive/Tar.php';        // should move most of this code into PEAR_Packager        // so it'll be easy to implement "pear package --sign"        if (sizeof($params) != 1) {            return $this->raiseError("bad parameter(s), try \"help $command\"");        }        if (!file_exists($params[0])) {            return $this->raiseError("file does not exist: $params[0]");        }        $obj = $this->getPackageFile($this->config, $this->_debug);        $info = $obj->fromTgzFile($params[0], PEAR_VALIDATE_NORMAL);        if (PEAR::isError($info)) {            return $this->raiseError($info);        }        $tar = new Archive_Tar($params[0]);        $tmpdir = System::mktemp('-d pearsign');        if (!$tar->extractList('package2.xml package.sig', $tmpdir)) {            if (!$tar->extractList('package.xml package.sig', $tmpdir)) {                return $this->raiseError("failed to extract tar file");            }        }        if (file_exists("$tmpdir/package.sig")) {            return $this->raiseError("package already signed");        }        $packagexml = 'package.xml';        if (file_exists("$tmpdir/package2.xml")) {            $packagexml = 'package2.xml';        }        @unlink("$tmpdir/package.sig");        $input = $this->ui->userDialog($command,                                       array('GnuPG Passphrase'),                                       array('password'));        $gpg = popen("gpg --batch --passphrase-fd 0 --armor --detach-sign --output $tmpdir/package.sig $tmpdir/$packagexml 2>/dev/null", "w");        if (!$gpg) {            return $this->raiseError("gpg command failed");        }        fwrite($gpg, "$input[0]\n");        if (pclose($gpg) || !file_exists("$tmpdir/package.sig")) {            return $this->raiseError("gpg sign failed");        }        $tar->addModify("$tmpdir/package.sig", '', $tmpdir);        return true;    }    // }}}    /**     * For unit testing purposes     */    function &getInstaller(&$ui)    {        if (!class_exists('PEAR_Installer')) {            require_once 'PEAR/Installer.php';        }        $a = &new PEAR_Installer($ui);        return $a;    }    // {{{ doMakeRPM()    /*    (cox)    TODO:        - Fill the rpm dependencies in the template file.    IDEAS:        - Instead of mapping the role to rpm vars, perhaps it's better          to use directly the pear cmd to install the files by itself          in %postrun so:          pear -d php_dir=%{_libdir}/php/pear -d test_dir=.. <package>    */    function doMakeRPM($command, $options, $params)    {        require_once 'System.php';        require_once 'Archive/Tar.php';        if (sizeof($params) != 1) {            return $this->raiseError("bad parameter(s), try \"help $command\"");        }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -