summaryrefslogtreecommitdiffstats
path: root/php-google-apiclient-services.spec
blob: 20d3b632e9abdf5ebab77687f04a0a48a8b294f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# remirepo spec file for php-google-apiclient-services, from
#
# Fedora spec file for php-google-apiclient-services
#
# Copyright (c) 2017-2019 Shawn Iwinski <shawn@iwin.ski>
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#

%global github_owner     googleapis
%global github_name      google-api-php-client-services
%global github_version   0.102
%global github_commit    82274e12b08c6828ebcc45a6bc01adbac63de8e9

%global composer_vendor  google
%global composer_project apiclient-services

# "php": ">=5.4"
%global php_min_ver 5.4

# Build using "--without tests" to disable tests
%global with_tests 0%{!?_without_tests:1}

%{!?phpdir:  %global phpdir  %{_datadir}/php}

Name:          php-%{composer_vendor}-%{composer_project}
Version:       %{github_version}
Release:       1%{?github_release}%{?dist}
Summary:       Google PHP API Client Services

License:       ASL 2.0
URL:           https://github.com/%{github_owner}/%{github_name}
Source0:       %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz

BuildArch:     noarch
# Tests
%if %{with_tests}
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
BuildRequires: php-composer(phpunit/phpunit)
## phpcompatinfo (computed from version 0.102)
##     <none>
## Autoloader
BuildRequires: php-composer(fedora/autoloader)
%endif

# composer.json
Requires:      php(language) >= %{php_min_ver}
# phpcompatinfo (computed from version 0.102)
#     <none>
# Autoloader
Requires:      php-composer(fedora/autoloader)

# Composer
Provides:      php-composer(%{composer_vendor}/%{composer_project}) = %{version}

Conflicts:     php-google-apiclient < 2

%description
%{summary}.

Autoloader: %{phpdir}/Google/Service/autoload.php


%prep
%setup -qn %{github_name}-%{github_commit}


%build
: Create autoloader
cat <<'AUTOLOAD' | tee src/Google/Service/autoload.php
<?php
/**
 * Autoloader for %{name} and its' dependencies
 * (created by %{name}-%{version}-%{release}).
 */
require_once '%{phpdir}/Fedora/Autoloader/autoload.php';

\Fedora\Autoloader\Autoload::addPsr0('Google_Service_', dirname(dirname(__DIR__)));
AUTOLOAD


%install
mkdir -p %{buildroot}%{phpdir}
cp -rp src/* %{buildroot}%{phpdir}/


%check
%if %{with_tests}
sed -e '/require_once/d' \
    -e 's#$path\s*=.*#$path="%{buildroot}%{phpdir}/Google/Service/";#' \
    -i tests/ServiceTest.php

: Create tests bootstrap
cat <<'BOOTSTRAP' | tee bootstrap.php
<?php
require '%{buildroot}%{phpdir}/Google/Service/autoload.php';

// Mock "Google_Service_autoload" class for Google_Service_ServiceTest
// @see Google_Service_ServiceTest::serviceProvider()
class Google_Service_autoload {}
BOOTSTRAP

: Upstream tests
RETURN_CODE=0
PHPUNIT=$(which phpunit)
for PHP_EXEC in "" php71 php72 php73 php74; do
    if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
        $PHP_EXEC $PHPUNIT --bootstrap bootstrap.php --verbose \
            -d memory_limit="512M" || RETURN_CODE=1
    fi
done
exit $RETURN_CODE
%else
: Tests skipped
%endif


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
%doc composer.json
%dir %{phpdir}/Google
     %{phpdir}/Google/Service


%changelog
* Sun Jun 16 2019 Shawn Iwinski <shawn@iwin.ski> - 0.102-1
- Update to 0.102 (RHBZ #1584457)

* Tue Feb 26 2019 Shawn Iwinski <shawn@iwin.ski> - 0.87-1
- Update to 0.87 (RHBZ #1584457)

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.60-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.60-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Sat May 26 2018 Shawn Iwinski <shawn@iwin.ski> - 0.60-1
- Update to 0.60 (RHBZ #1527508)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.38-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Dec 13 2017 Shawn Iwinski <shawn@iwin.ski> - 0.38-1
- Update to 0.38 (RHBZ #1505203)

* Sun Oct 08 2017 Shawn Iwinski <shawn@iwin.ski> - 0.29-1
- Update to 0.29 (RHBZ #1490369)

* Sun Sep 10 2017 Shawn Iwinski <shawn@iwin.ski> - 0.22-1
- Update to 0.22 (RHBZ #1481241)

* Sat Aug 05 2017 Shawn Iwinski <shawn@iwin.ski> - 0.17-1
- Update to 0.17 (RHBZ #1469105)

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Jul 08 2017 Shawn Iwinski <shawn@iwin.ski> - 0.13-1
- Update to 0.13 (RHBZ #1461829)

* Mon Apr 03 2017 Shawn Iwinski <shawn@iwin.ski> - 0.11-1
- Update to 0.11
- Raise tests' memory limit to 512M

* Sat Mar 11 2017 Shawn Iwinski <shawn@iwin.ski> - 0.10-1
- Initial package