rpms/php-pear/devel php-pear-1.4.5-makerpm-cleanup.patch, NONE, 1.1 php-pear-1.4.5-makerpm-rh-namingconvs.patch, NONE, 1.1 php-pear-1.4.5-template-fixes.patch, NONE, 1.1 php-pear-1.4.5-template-postun.patch, NONE, 1.1 .cvsignore, 1.3, 1.4 php-pear.spec, 1.6, 1.7
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Fri Jan 13 11:27:00 UTC 2006
Author: jorton
Update of /cvs/dist/rpms/php-pear/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv3787
Modified Files:
.cvsignore php-pear.spec
Added Files:
php-pear-1.4.5-makerpm-cleanup.patch
php-pear-1.4.5-makerpm-rh-namingconvs.patch
php-pear-1.4.5-template-fixes.patch
php-pear-1.4.5-template-postun.patch
Log Message:
* Fri Dec 30 2005 Tim Jackson <tim at timj.co.uk> 1:1.4.5-6
- Patches to fix "pear makerpm"
php-pear-1.4.5-makerpm-cleanup.patch:
PEAR/Command/Package.php | 170 ++++++++++++++++++++++++++++++++++++++---------
data/PEAR/template.spec | 2
2 files changed, 141 insertions(+), 31 deletions(-)
--- NEW FILE php-pear-1.4.5-makerpm-cleanup.patch ---
--- PEAR/Command/Package.php 2005-12-23 14:23:41.000000000 +0000
+++ PEAR/Command/Package.php 2005-12-30 13:25:41.000000000 +0000
@@ -205,12 +205,29 @@
'arg' => 'FILE',
'doc' => 'Use FILE as RPM spec file template'
),
+ 'rpm-release' => array(
+ 'shortopt' => 'r',
+ 'arg' => 'RELEASE',
+ 'doc' => 'RPM release version. Defaults to "1".'
+ ),
'rpm-pkgname' => array(
'shortopt' => 'p',
'arg' => 'FORMAT',
- 'doc' => 'Use FORMAT as format string for RPM package name, %s is replaced
-by the PEAR package name, defaults to "PEAR::%s".',
+ 'doc' => 'Use FORMAT as format string for RPM package name. Substitutions
+are as follows:
+%s = PEAR package name
+%S = PEAR package name (with underscores replaced with hyphens)
+%C = Channel alias
+%c = Channel alias, lowercased
+Defaults to "%C::%s".',
),
+ 'rpm-depname' => array(
+ 'shortopt' => 'd',
+ 'arg' => 'FORMAT',
+ 'doc' => 'Use FORMAT as format string for RPM package name. Substitutions
+are as for the --rpm-pkgname option. Defaults to be the same as
+the format defined by the --rpm-pkgname option.',
+ ),
),
'doc' => '<package-file>
@@ -219,7 +236,7 @@
package tarball in the SOURCES directory:
$ pear makerpm ../SOURCES/Net_Socket-1.0.tgz
-Wrote RPM spec file PEAR::Net_Geo-1.0.spec
+Wrote RPM spec file PEAR::Net_Socket-1.0.spec
$ rpm -bb PEAR::Net_Socket-1.0.spec
...
Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
@@ -736,10 +753,7 @@
/*
(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
@@ -797,25 +811,42 @@
}
$info['possible_channel'] = '';
$info['extra_config'] = '';
+
if (isset($options['rpm-pkgname'])) {
$rpm_pkgname_format = $options['rpm-pkgname'];
} else {
- if ($pf->getChannel() == 'pear.php.net' || $pf->getChannel() == 'pecl.php.net') {
- $alias = 'PEAR';
- } else {
- $chan = &$reg->getChannel($pf->getChannel());
- $alias = $chan->getAlias();
- $alias = strtoupper($alias);
- $info['possible_channel'] = $pf->getChannel() . '/';
- }
- $rpm_pkgname_format = $alias . '::%s';
+ $rpm_pkgname_format = '%C::%s';
+ }
+
+ if (isset($options['rpm-depname'])) {
+ $rpm_depname_format = $options['rpm-depname'];
+ } else {
+ $rpm_depname_format = $rpm_pkgname_format;
+ }
+
+ if (isset($options['rpm-release'])) {
+ $info['release'] = $options['rpm-release'];
+ } else {
+ $info['release'] = '1';
+ }
+
+ $alias = $this->_getChannelAlias($pf->getChannel(), $pf->getPackage());
+ if ($alias != 'PEAR' && $alias != 'PECL') {
+ $info['possible_channel'] = $pf->getChannel() . '/';
}
$info['extra_headers'] = '';
$info['doc_files'] = '';
$info['files'] = '';
$info['package2xml'] = '';
- $info['rpm_package'] = sprintf($rpm_pkgname_format, $pf->getPackage());
+ $info['rpm_package'] = $this->_getRPMNameFromFormat($rpm_pkgname_format, $pf->getPackage(), $alias);
+
+ // Hook to support virtual provides, where the dependency name differs
+ // from the package name
+ if ($rpm_pkgname_format != $rpm_depname_format) {
+ $info['extra_headers'] .= 'Provides: ' . $this->_getRPMNameFromFormat($rpm_depname_format, $pf->getPackage(), $alias) . ' = ' . $pf->getVersion(). "\n";
+ }
+
$srcfiles = 0;
foreach ($info['filelist'] as $name => $attr) {
if (!isset($attr['role'])) {
@@ -896,13 +927,11 @@
if ($dep['type'] != 'pkg') {
continue;
}
- if (isset($dep['channel']) && $dep['channel'] != 'pear.php.net' &&
- $dep['channel'] != 'pecl.php.net') {
- $chan = &$reg->getChannel($dep['channel']);
- $package = strtoupper($chan->getAlias()) . '::' . $dep['name'];
- } else {
- $package = 'PEAR::' . $dep['name'];
- }
+
+ if (!isset($dep['channel'])) $dep['channel'] = null;
+ // $package contains the *dependency name* here, which may or may
+ // not be the same as the package name
+ $package = $this->_getRPMNameFromFormat($rpm_depname_format, $dep['name'], $this->_getChannelAlias($dep['channel'], $dep['name']));
$trans = array(
'>' => '>',
'<' => '<',
@@ -940,12 +969,10 @@
$deps['required']['package'] = array($deps['required']['package']);
}
foreach ($deps['required']['package'] as $dep) {
- if ($dep['channel'] != 'pear.php.net' && $dep['channel'] != 'pecl.php.net') {
- $chan = &$reg->getChannel($dep['channel']);
- $package = strtoupper($chan->getAlias()) . '::' . $dep['name'];
- } else {
- $package = 'PEAR::' . $dep['name'];
- }
+ if (!isset($dep['channel'])) $dep['channel'] = null;
+ // $package contains the *dependency name* here, which may or may
+ // not be the same as the package name
+ $package = $this->_getRPMNameFromFormat($rpm_depname_format, $dep['name'], $this->_getChannelAlias($dep['channel'], $dep['name']));
if (isset($dep['conflicts']) && (isset($dep['min']) ||
isset($dep['max']))) {
$deprange = array();
@@ -1082,6 +1109,89 @@
return true;
}
+
+ // }}}
+ // {{{ _getChannelAlias()
+ /*
+ * Return a channel alias from a channel name
+ *
+ * @param string $chan_name Channel name (e.g. 'pecl.php.net')
+ * @param string $package_name Optional name of the PEAR package to which $chan_name relates.
+ * Assists when "guessing" channel aliases for PEAR/PECL
+ * @return string Channel alias (e.g. 'PECL')
+ */
+
+ function _getChannelAlias($chan_name, $package_name = null)
+ {
+ switch($chan_name) {
+ case null:
+ case '':
+ // If channel name not supplied, it is presumably
+ // either PEAR or PECL. There's no sure-fire way of
+ // telling between the two, but we try to make an
+ // intelligent guess: if the package name is supplied
+ // and starts with a lowercase letter, it's PECL.
+ if (ereg('^[a-z]', $package_name)) {
+ $alias = 'PECL';
+ } else {
+ $alias = 'PEAR';
+ }
+ break;
+ case 'pear.php.net':
+ $alias = 'PEAR';
+ break;
+ case 'pecl.php.net':
+ $alias = 'PECL';
+ break;
+ default:
+ $reg = &$this->config->getRegistry();
+ $chan = &$reg->getChannel($pf->getChannel());
+ $alias = $chan->getAlias();
+ $alias = strtoupper($alias);
+ break;
+ }
+ return $alias;
+ }
+
+ // }}}
+ // {{{ _getRPMNameFromFormat()
+
+ /*
+ * Get an RPM package or dependency name from a format string
+ *
+ * This method generates an RPM package or dependency name based on
+ * a format string containing substitution variables, rather like
+ * sprintf(). It supports the following substitution variables:
+ * %s = package name
+ * %S = package name, with underscores replaced with hyphens
+ * %C = channel alias
+ * %c = channel alias, lowercased
+ *
+ * @param string $format Format string
+ * @param string $pear_package_name PEAR package name (e.g. Example_Package)
+ * @param string $channel_alias Channel alias (e.g. 'PEAR', 'PECL')
+ * @return string RPM package/dependency name
+ */
+
+ function _getRPMNameFromFormat($format, $pear_package_name, $channel_alias)
+ {
+ // The package name
+ $name = str_replace('%s', $pear_package_name, $format);
+
+ // The package name, with underscores replaced with hyphens
+ $name = str_replace('%S', str_replace('_', '-', $pear_package_name), $name);
+
+ // The channel alias
+ $name = str_replace('%C', $channel_alias, $name);
+
+ // The channel alias, lowercased
+ $name = str_replace('%c', strtolower($channel_alias), $name);
+
+ return $name;
+ }
+
+ // }}}
+ // {{{ doConvert()
function doConvert($command, $options, $params)
{
--- data/PEAR/template.spec 2005-12-30 12:36:53.000000000 +0000
+++ data/PEAR/template.spec 2005-12-30 13:10:50.000000000 +0000
@@ -1,7 +1,7 @@
Summary: PEAR: @summary@
Name: @rpm_package@
Version: @version@
-Release: 1
+Release: @release@
License: @release_license@
Group: Development/Libraries
Source: http://@master_server@/get/@package@-%{version}.tgz
php-pear-1.4.5-makerpm-rh-namingconvs.patch:
Package.php | 43 +++++++++++++++++++++++++++----------------
1 files changed, 27 insertions(+), 16 deletions(-)
--- NEW FILE php-pear-1.4.5-makerpm-rh-namingconvs.patch ---
--- PEAR/Command/Package.php.orig 2005-12-30 13:59:44.000000000 +0000
+++ PEAR/Command/Package.php 2005-12-30 22:33:02.000000000 +0000
@@ -219,14 +219,13 @@
%S = PEAR package name (with underscores replaced with hyphens)
%C = Channel alias
%c = Channel alias, lowercased
-Defaults to "%C::%s".',
+Defaults to "php-%c-%S".',
),
'rpm-depname' => array(
'shortopt' => 'd',
'arg' => 'FORMAT',
'doc' => 'Use FORMAT as format string for RPM package name. Substitutions
-are as for the --rpm-pkgname option. Defaults to be the same as
-the format defined by the --rpm-pkgname option.',
+are as for the --rpm-pkgname option. Defaults to "php-%c(%s)"',
),
),
'doc' => '<package-file>
@@ -236,10 +235,10 @@
package tarball in the SOURCES directory:
$ pear makerpm ../SOURCES/Net_Socket-1.0.tgz
-Wrote RPM spec file PEAR::Net_Socket-1.0.spec
-$ rpm -bb PEAR::Net_Socket-1.0.spec
+Wrote RPM spec file php-pear-Net-Socket.spec
+$ rpm -bb php-pear-Net-Socket.spec
...
-Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
+Wrote: /usr/src/redhat/RPMS/i386/php-pear-Net-Socket-1.0-1.i386.rpm
',
),
'convert' => array(
@@ -815,13 +814,13 @@
if (isset($options['rpm-pkgname'])) {
$rpm_pkgname_format = $options['rpm-pkgname'];
} else {
- $rpm_pkgname_format = '%C::%s';
+ $rpm_pkgname_format = 'php-%c-%S';
}
if (isset($options['rpm-depname'])) {
$rpm_depname_format = $options['rpm-depname'];
} else {
- $rpm_depname_format = $rpm_pkgname_format;
+ $rpm_depname_format = 'php-%c(%s)';
}
if (isset($options['rpm-release'])) {
@@ -857,7 +856,7 @@
$info['doc_files'] .= " $name";
// Map role to the rpm vars
} else {
- $c_prefix = '%{_libdir}/php/pear';
+ $c_prefix = '%{_datadir}/pear';
switch ($attr['role']) {
case 'php':
$prefix = $c_prefix;
@@ -924,14 +923,26 @@
if (isset($dep['optional']) && $dep['optional'] == 'yes') {
continue;
}
- if ($dep['type'] != 'pkg') {
- continue;
- }
- if (!isset($dep['channel'])) $dep['channel'] = null;
- // $package contains the *dependency name* here, which may or may
- // not be the same as the package name
- $package = $this->_getRPMNameFromFormat($rpm_depname_format, $dep['name'], $this->_getChannelAlias($dep['channel'], $dep['name']));
+ switch ($dep['type']) {
+ case 'pkg':
+ if (!isset($dep['channel'])) $dep['channel'] = null;
+ // $package contains the *dependency name* here, which may or may
+ // not be the same as the package name
+ $package = $this->_getRPMNameFromFormat($rpm_depname_format, $dep['name'], $this->_getChannelAlias($dep['channel'], $dep['name']));
+ break;
+ case 'ext':
+ // This only works if all PHP extensions are either in their own
+ // package, and/or the main package Provides: php-[extname] for
+ // built-in extensions
+ $package = 'php-'.$dep['name'];
+ break;
+ case 'php':
+ $package = 'php';
+ break;
+ default:
+ continue;
+ }
$trans = array(
'>' => '>',
'<' => '<',
php-pear-1.4.5-template-fixes.patch:
template.spec | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
--- NEW FILE php-pear-1.4.5-template-fixes.patch ---
This patch rolls up:
- php-pear-1.4.5-rh-namingconvs.patch
- php-pear-1.4.5-template-docfix.patch
--- template.spec 2005-12-30 10:52:57.000000000 +0000
+++ template.spec 2005-12-30 10:58:49.000000000 +0000
@@ -1,3 +1,5 @@
+%define peardir %{_datadir}/pear
+
Summary: PEAR: @summary@
Name: @rpm_package@
Version: @version@
@@ -8,7 +10,6 @@
BuildRoot: %{_tmppath}/%{name}-root
URL: http://@master_server@/package/@package@
Prefix: %{_prefix}
-#Docdir: @doc_dir@/@package@
BuildArchitectures: @arch@
@extra_headers@
@@ -17,13 +18,14 @@
%prep
rm -rf %{buildroot}/*
+%setup -c -T
# XXX Source files location is missing here in pear cmd
pear -v -c %{buildroot}/pearrc \
- -d php_dir=%{_libdir}/php/pear \
+ -d php_dir=%{peardir} \
-d doc_dir=/docs \
-d bin_dir=%{_bindir} \
- -d data_dir=%{_libdir}/php/pear/data \
- -d test_dir=%{_libdir}/php/pear/tests \
+ -d data_dir=%{peardir}/data \
+ -d test_dir=%{peardir}/tests \
-d ext_dir=%{_libdir} \@extra_config@
-s
@@ -50,14 +52,15 @@
pear -c %{buildroot}/pearrc install --nodeps -R %{buildroot} \
$RPM_SOURCE_DIR/@package at -%{version}.tgz
rm %{buildroot}/pearrc
-rm %{buildroot}/%{_libdir}/php/pear/.filemap
-rm %{buildroot}/%{_libdir}/php/pear/.lock
-rm -rf %{buildroot}/%{_libdir}/php/pear/.registry
-if [ -d "%{buildroot}/docs/@package@/doc" ]; then
- rm -rf $RPM_BUILD_DIR/doc
- mv %{buildroot}/docs/@package@/doc $RPM_BUILD_DIR
+rm %{buildroot}/%{peardir}/.filemap
+rm %{buildroot}/%{peardir}/.lock
+rm -rf %{buildroot}/%{peardir}/.registry
+
+if [ "@doc_files@" != "" ]; then
+ mv %{buildroot}/docs/@package@/* .
rm -rf %{buildroot}/docs
fi
+
mkdir -p %{buildroot}@rpm_xml_dir@
tar -xzf $RPM_SOURCE_DIR/@package at -%{version}.tgz package at package2xml@.xml
cp -p package at package2xml@.xml %{buildroot}@rpm_xml_dir@/@package at .xml
php-pear-1.4.5-template-postun.patch:
template.spec | 1 -
1 files changed, 1 deletion(-)
--- NEW FILE php-pear-1.4.5-template-postun.patch ---
--- template.spec 2005-12-30 12:29:18.000000000 +0000
+++ template.spec 2005-12-30 12:36:53.000000000 +0000
@@ -34,7 +34,6 @@
# if refcount = 0 then package has been removed (not upgraded)
if [ "$1" -eq "0" ]; then
pear uninstall --nodeps -r @possible_channel@@package@
- rm @rpm_xml_dir@/@package at .xml
fi
Index: .cvsignore
===================================================================
RCS file: /cvs/dist/rpms/php-pear/devel/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- .cvsignore 1 Dec 2005 17:15:43 -0000 1.3
+++ .cvsignore 13 Jan 2006 11:26:55 -0000 1.4
@@ -1,2 +1,3 @@
XML_RPC-1.4.4.tgz
install-pear-nozlib-1.4.5.phar
+install-pear-nozlib-1.4.6.phar
Index: php-pear.spec
===================================================================
RCS file: /cvs/dist/rpms/php-pear/devel/php-pear.spec,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- php-pear.spec 14 Dec 2005 09:06:39 -0000 1.6
+++ php-pear.spec 13 Jan 2006 11:26:56 -0000 1.7
@@ -6,7 +6,7 @@
Summary: PHP Extension and Application Repository framework
Name: php-pear
Version: 1.4.5
-Release: 5
+Release: 6
Epoch: 1
License: PHP
Group: System
@@ -18,6 +18,10 @@
Source11: pecl.sh
Source12: peardev.sh
Source20: XML_RPC-%{xmlrpcver}.tgz
+Patch0: php-pear-1.4.5-template-fixes.patch
+Patch1: php-pear-1.4.5-template-postun.patch
+Patch2: php-pear-1.4.5-makerpm-cleanup.patch
+Patch3: php-pear-1.4.5-makerpm-rh-namingconvs.patch
BuildArchitectures: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: php >= 5.1.0-1
@@ -45,6 +49,13 @@
-b $RPM_BUILD_ROOT%{_bindir} \
%{SOURCE20}
+pushd %{buildroot}%{peardir}
+%{__patch} -p0 data/PEAR/template.spec %{PATCH0}
+%{__patch} -p1 data/PEAR/template.spec %{PATCH1}
+%{__patch} -p0 < %{PATCH2}
+%{__patch} -p0 < %{PATCH3}
+popd
+
# Replace /usr/bin/* with simple scripts:
for f in pecl pear peardev; do
install -m 755 $RPM_SOURCE_DIR/${f}.sh $RPM_BUILD_ROOT%{_bindir}/${f}
@@ -83,6 +94,9 @@
%config %{_sysconfdir}/pear.conf
%changelog
+* Fri Dec 30 2005 Tim Jackson <tim at timj.co.uk> 1:1.4.5-6
+- Patches to fix "pear makerpm"
+
* Wed Dec 14 2005 Joe Orton <jorton at redhat.com> 1:1.4.5-5
- set default sig_keydir to /etc/pearkeys
- remove ext_dir setting from /etc/pear.conf (#175673)
More information about the fedora-cvs-commits
mailing list