Home Wiki > openSUSE:Packaging PHP
Sign up | Login

openSUSE:Packaging PHP

tagline: From openSUSE

This page describes current practices and accepted standards for packaging PHP libraries and applications. Currently it concentrates on PEAR.

Change log

Packages need to have a .changes file. Create one with

osc vc

When updating package versions, please add a new section

- version x.y.z
- first relevant change
- second relevant change

You can usually find a change log in the package, on the web site or in the package.xml file


Packaging a pear channel

Name schema: php5-pear-channel-{channelname}

typical spec file:

%define peardir %(pear config-get php_dir 2> /dev/null || echo %{_datadir}/pear)
%define pear_xmldir  /var/lib/pear

Name:           php5-pear-channel-horde
Version:        1.0
Release:        0
Summary:        Adds pear.horde.org channel to PEAR
Group:          Development/Libraries/PHP
License:        BSD-3-Clause
Url:            http://pear.horde.org/
Source0:        http://pear.horde.org/channel.xml
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Requires:       php php5-pear
Requires:       php5-tokenizer
BuildRequires:  php5-tokenizer
BuildRequires:  php5-pear >= 5.1.1

%description
This package adds the pear.horde.org channel which allows PEAR packages
from this channel to be installed.


%prep
%setup -q -c -T

%build
# Empty build section, nothing to build

%install

%{__mkdir_p} %{buildroot}%{pear_xmldir}
%{__install} -pm 644 %{SOURCE0} %{buildroot}%{pear_xmldir}/pear.horde.org.xml

%clean

%{__rm} -rf %{buildroot}

%post

if [ $1 -eq  1 ] ; then
   pear channel-add %{pear_xmldir}/pear.horde.org.xml > /dev/null || :
else
   pear channel-update %{pear_xmldir}/pear.horde.org.xml > /dev/null ||:
fi

%postun

if [ $1 -eq 0 ] ; then
   pear channel-delete pear.horde.org.xml > /dev/null || :
fi

%files
%defattr(-,root,root,-)
%{pear_xmldir}/pear.horde.org.xml

%changelog