---- PEAR_Command_Packaging-0.2.0/usr/share/pear/PEAR/Command/Packaging.php 2010-08-21 12:49:51.257395974 +0300
-+++ PEAR_Command_Packaging-0.2.0/usr/share/pear/PEAR/Command/Packaging.php 2010-08-21 15:27:50.933114597 +0300
+--- PEAR_Command_Packaging-0.2.0/usr/share/pear/PEAR/Command/Packaging.php 2010-08-21 15:27:50.933114597 +0300
++++ PEAR_Command_Packaging-0.2.0/usr/share/pear/PEAR/Command/Packaging.php 2010-08-22 11:54:43.779087274 +0300
@@ -54,6 +54,11 @@
'arg' => 'FILE',
'doc' => 'Use FILE as RPM spec file template'
'rpm-release' => array(
'shortopt' => 'r',
'arg' => 'RELEASE',
-@@ -121,7 +126,7 @@
+@@ -121,10 +126,10 @@
* $commands array above and in Packaging.xml so that it is consistent.
*/
var $_rpm_pkgname_format = array(
- 'pkg' => '%C::%s',
-+ 'pkg' => 'php-pear-%s',
++ 'pkg' => 'php-%s',
'chan' => 'php-channel-%c',
);
-
-@@ -142,7 +147,8 @@
+-
++
+ /**
+ * The default format of various dependencies that might be generated in the
+ * spec file. The currently-handled dependency types are:
+@@ -142,7 +147,9 @@
var $_rpm_depname_format = array(
'pkg' => '%P',
'ext' => 'php-%l',
- 'php' => 'php',
++ 'pear-pkg' => 'php-pear-%s',
+ 'pecl-ext' => 'php-pecl-%l',
+ 'php' => 'php-common',
'chan' => 'php-channel(%n)',
);
-@@ -159,7 +165,7 @@
+@@ -159,7 +166,7 @@
* chan - used when generating a spec file for a channel
*/
var $_rpm_specname_format = array(
'chan' => 'php-channel-%c.spec'
);
-@@ -182,11 +188,11 @@
+@@ -182,11 +189,11 @@
* need to be listed here
*/
var $_file_prefixes = array(
'script' => '%{_bindir}',
'cfg' => '%{_sysconfdir}/pear',
'www' => '%{_datadir}/pear/www'
-@@ -197,7 +203,7 @@
+@@ -197,7 +204,7 @@
* printf format. The first '%s' is the RPM header name followed by a colon,
* the second is the header value.
*/
// ------------------------------------------------------------------------
// --- END DISTRIBUTION CONFIG
-@@ -247,6 +253,7 @@
+@@ -247,6 +254,7 @@
'test_dir' => '',
'test_files_statement' => '',// empty string, or list of test files
'www_files_statement' => '', // empty string, or newline-separated list of files with "www" role
);
// The name of the template spec file to use
-@@ -330,15 +337,24 @@
+@@ -330,15 +338,24 @@
// Initialise the RPM package/dep naming format options
$this->_initialiseNamingOptions($options);
// If source file ends in ".xml" we assume we are creating an RPM spec
// for a channel rather than an actual package
if (substr(strtolower($source_file), -4) == '.xml') {
-@@ -378,13 +394,40 @@
+@@ -378,13 +395,40 @@
/**
* Format an RPM header line to be added to the spec file
* @param string $header The name of the RPM header to be added
/**
* Replace a macro in the output spec file
-@@ -410,16 +453,20 @@
+@@ -410,16 +454,20 @@
} else {
$package_name = null;
}
// Write the actual file
$wp = fopen($spec_file, 'wb');
if (!$wp) {
-@@ -457,7 +504,7 @@
+@@ -457,7 +505,7 @@
$rpmdep = $this->_getRPMName(null, $cf->getName(), $cf->getAlias(), 'chandep');
if (!empty($rpmdep) && $rpmdep != $this->_output['rpm_package']) {
}
// Channels don't really have version numbers; this will need to be
-@@ -564,7 +611,7 @@
+@@ -564,7 +612,7 @@
// Set up some of the basic macros
$this->_output['rpm_package'] = $this->_getRPMName($pf->getPackage(), $pf->getChannel(), null, 'pkg');
$this->_output['summary'] = trim($package_info['summary']);
$this->_output['possible_channel'] = $pf->getChannel();
$this->_output['channel_alias'] = $this->_getChannelAlias($pf->getPackage(), $pf->getChannel());
-@@ -646,11 +693,13 @@
+@@ -646,11 +694,13 @@
if (substr($this->_file_prefixes[$role], -2) == '%s') {
$this->_output[$macro_name] = str_replace('%s', $pf->getPackage(), $this->_file_prefixes[$role]);
} else {
}
}
$this->_output['files'] = trim($this->_output['files']);
-@@ -685,12 +734,11 @@
+@@ -685,12 +735,11 @@
function _generatePackageDeps($pf)
{
if (!isset($dep['type']) || $dep['type'] == 'pkg') {
$type = 'pkgdep';
-@@ -698,8 +746,14 @@
+@@ -698,8 +747,14 @@
$type = $dep['type'];
}
// $package contains the *dependency name* here, which may or may
// not be the same as the package name
-@@ -725,21 +779,25 @@
+@@ -725,21 +780,25 @@
if ($dep['rel'] == 'has') {
// We use $package as the index to the $requires array to de-duplicate deps.
// Note that in the case of duplicate deps, versioned deps will "win" - see several lines down.
} else {
$this->_output['package2xml'] = '2'; // tell the spec to use package2.xml
$deps = $pf->getDeps(true);
-@@ -842,10 +900,10 @@
+@@ -842,10 +901,10 @@
}
} else {
if (isset($dep['min'])) {
}
if (isset($dep['exclude'])) {
$ex = $dep['exclude'];
-@@ -864,18 +922,109 @@
- $a = $tar->extractInString('package2.xml');
+@@ -865,17 +924,108 @@
$tar->popErrorHandling();
if ($a === null || PEAR::isError($a)) {
- $this->_output['package2xml'] = '';
+ // PLD linux hack: include epoch for PEAR package
+ $version = "1:{$version}";
+ $buildrequires[$this->_output['pear_rpm_name']] = $this->_output['pear_rpm_name'] . ' >= ' . $version;
- }
-- if (count($requires)) {
-- $this->_output['extra_headers'] .= $this->_formatRpmHeader('Requires', implode(', ', $requires)) . "\n";
++ }
+ }
+
+ if (isset($deps['required']['extension'])) {
+ if (isset($deps['required']['subpackage'])) {
+ if (!isset($deps['required']['subpackage'][0])) {
+ $deps['required']['subpackage'] = array($deps['required']['subpackage']);
- }
-- if (count($conflicts)) {
-- $this->_output['extra_headers'] .= $this->_formatRpmHeader('Conflicts', implode(', ', $conflicts)) . "\n";
++ }
+ foreach ($deps['required']['subpackage'] as $dep) {
+ if (!isset($dep['channel'])) $dep['channel'] = null;
+
+
+ $requires[$package] = $package;
+ // XXX: should be more complese like above with ranges, etc
- }
- }
++ }
++ }
+
+ if (isset($deps['optional']['package'])) {
+ if (!isset($deps['optional']['package'][0])) {
+ $deps['optional']['package'] = array($deps['optional']['package']);
-+ }
+ }
+- if (count($requires)) {
+- $this->_output['extra_headers'] .= $this->_formatRpmHeader('Requires', implode(', ', $requires)) . "\n";
+ foreach ($deps['optional']['package'] as $dep) {
+ if (!isset($dep['channel'])) $dep['channel'] = null;
+
+
+ // fill extra info for _noautoreq deps
+ $this->_output['_noautoreq'] .= " pear(". str_replace('_', '/', $dep['name']) . ".*)";
-+ }
+ }
+- if (count($conflicts)) {
+- $this->_output['extra_headers'] .= $this->_formatRpmHeader('Conflicts', implode(', ', $conflicts)) . "\n";
+ }
+
+ if (isset($deps['optional']['extension'])) {
+
+ // suggests are not versioned (makes no sense in poldek)
+ $suggests[$package] = $package;
-+ }
-+ }
-+ }
+ }
+ }
+ }
+
+ // append extra headers which we collected
+ if (count($buildrequires)) {
+ }
+ if (count($suggests)) {
+ $this->_output['extra_headers'] .= $this->_formatRpmHeader('Suggests', $suggests) . "\n";
- }
++ }
}
-@@ -927,7 +1076,12 @@
+@@ -927,7 +1077,14 @@
case 'pkg':
return $this->_getRPMNameFromFormat($this->_rpm_pkgname_format['pkg'], $package_name, $chan_name, $chan_alias);
case 'pkgdep':
+ // PLD Linux: pecl extensions have different naming format
+ if ($chan_alias == 'PECL') {
+ $type = 'pecl-ext';
++ } elseif ($chan_alias == 'PEAR') {
++ $type = 'pear-pkg';
+ } else {
+ $type = 'pkg';
+ }