protected function loadPackageInfo()
    {
        $config = PEAR_Config::singleton($this->config);

        if (empty($this->packageFile)) {
            // loads informations from PEAR package installed
            $reg = $config->getRegistry();
            if (!$reg->packageExists($this->package, $this->channel)) {
                throw new BuildException(
                    sprintf(
                        'PEAR package %s/%s does not exist',
                        $this->channel,
                        $this->package
                    )
                );
            }
            $packageInfo = $reg->getPackage($this->package, $this->channel);
        } else {
            // loads informations from PEAR package XML description file
            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
            $pkg = new PEAR_PackageFile($config);
            $packageInfo = $pkg->fromPackageFile($this->packageFile, PEAR_VALIDATE_NORMAL);
            PEAR::staticPopErrorHandling();
            if (@PEAR::isError($packageInfo)) {
                throw new BuildException("Errors in package file: " . $packageInfo->getMessage());
            }
        }

        return $packageInfo;
    }