File php5-pear-Date_Holidays_Germany.spec of Package php5-pear-Date_Holidays_Germany

#
# spec file for package php5-pear-Date_Holidays_Germany
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%{!?pear_phpdir: %{expand: %%global pear_phpdir     %(pear config-get php_dir 2> /dev/null)}}
%{!?pear_xmldir: %{expand: %%global pear_xmldir     /var/lib/pear}}
%{!?__pear: %{expand: %%global __pear     %{_bindir}/pear}}

%define         pear_name  Date_Holidays_Germany
%define         pear_sname date_holidays_germany

Name:           php5-pear-%{pear_name}
Summary:        Driver class to calculate holidays in Germany
License:        PHP-3.01
Group:          Productivity/Networking/Web/Servers
Version:        0.1.2
Release:        0
BuildArch:      noarch
Url:            http://pear.php.net/package/%{pear_name}
Source:         http://download.pear.php.net/package/%{pear_name}-%{version}.tgz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  php >= 4.2.0
BuildRequires:  php5-pear
Requires:       php >= 4.2.0
Requires(post):   php-pear
Requires(postun): php-pear
Requires:       php5-pear-Date_Holidays
Provides:       pear-%{pear_name}
Provides:       php-pear-%{pear_name}
# Fix for renaming (package convention)
Provides:       pear-%{pear_sname} = %{version}
Provides:       php-pear-%{pear_sname} = %{version}
Provides:       php5-pear-%{pear_sname} = %{version}
Obsoletes:      pear-%{pear_sname} < %{version}
Obsoletes:      php-pear-%{pear_sname} < %{version}
Obsoletes:      php5-pear-%{pear_sname} < %{version}

%description
Date_Holidays helps you calculate the dates and titles of holidays and other special celebrations. 
This is the driver for Germany

%prep
%setup -c

%build

%install
%{__pear} -d date.timezone=UTC install --nodeps --offline --packagingroot %{buildroot} package.xml
%{__install} -D -m 0644 package.xml %{buildroot}%{pear_xmldir}/%{pear_name}.xml
%{__rm} -rf %{buildroot}/{doc,tmp}
%{__rm} -rf "%{buildroot}"/%{pear_phpdir}/.{filemap,lock,registry,channels,depdb,depdblock}

%check
%{__pear} run-tests

%post
# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
if [ "$1" = "1" ]; then
  %{__pear} install --nodeps --soft --force --register-only %{pear_xmldir}/%{pear_name}.xml
fi
if [ "$1" = "2" ]; then
  %{__pear} upgrade --offline --register-only %{pear_xmldir}/%{pear_name}.xml
fi

%postun
# on `rpm -e` PARAM is 0
if [ "$1" = "0" ]; then
  %{__pear} uninstall --nodeps --ignore-errors --register-only pear.php.net/%{pear_name}
fi

%clean
%{__rm} -rf %{buildroot}

%files
%defattr(-, root, root)
%{pear_phpdir}/*
%{pear_xmldir}/%{pear_name}.xml

%changelog