summaryrefslogtreecommitdiffstats
path: root/composer.spec
blob: 59e9ad597da7410c91d67b8c4734d9891540da2f (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
# spec file for composer
#
# Copyright (c) 2015 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global gh_commit    e5985a9b559747a5f3868361ff26c31818d8c184
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_branch    1.0-dev
%global gh_date      20150225
%global gh_owner     composer
%global gh_project   composer
%global with_tests   %{?_without_tests:0}%{!?_without_tests:1}

Name:           composer
Version:        1.0.0
Release:        0.1.%{gh_date}git%{gh_short}%{?dist}
Summary:        Dependency Manager for PHP

Group:          Development/Libraries
License:        MIT
URL:            https://getcomposer.org/
Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz
Source1:        %{name}-autoload.php
Source2:        %{name}-bootstrap.php

# Fix shebang and use our autoloader
Patch0:         %{name}-rpm.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch
%if %{with_tests}
BuildRequires:  php-composer(justinrainbow/json-schema) >= 1.3
BuildRequires:  php-composer(seld/jsonlint)             >= 1.0
BuildRequires:  php-composer(symfony/console)           >= 2.5
BuildRequires:  php-composer(symfony/finder)            >= 2.2
BuildRequires:  php-composer(symfony/process)           >= 2.1
BuildRequires:  php-composer(symfony/class-loader)
BuildRequires:  %{_bindir}/phpunit
%endif

# From composer.json, requires
#        "php": ">=5.3.2",
#        "justinrainbow/json-schema": "~1.3",
#        "seld/jsonlint": "~1.0",
#        "symfony/console": "~2.5",
#        "symfony/finder": "~2.2",
#        "symfony/process": "~2.1"
Requires:       php(language)                           >= 5.3.2
Requires:       php-composer(justinrainbow/json-schema) >= 1.3
Requires:       php-composer(justinrainbow/json-schema) <  2
Requires:       php-composer(seld/jsonlint)             >= 1.0
Requires:       php-composer(seld/jsonlint)             <  2
Requires:       php-composer(symfony/console)           >= 2.5
Requires:       php-composer(symfony/console)           <  3
Requires:       php-composer(symfony/finder)            >= 2.2
Requires:       php-composer(symfony/finder)            <  3
Requires:       php-composer(symfony/process)           >= 2.1
Requires:       php-composer(symfony/process)           <  3
# From composer.json, suggest
#        "ext-zip": "Enabling the zip extension allows you to unzip archives, and allows gzip compression of all internet traffic",
#        "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages"
Requires:       php-zip
Requires:       php-openssl
# For our autoloader
Requires:       php-composer(symfony/class-loader)
# From phpcompatinfo
Requires:       php-ctype
Requires:       php-curl
Requires:       php-date
Requires:       php-filter
Requires:       php-hash
Requires:       php-iconv
Requires:       php-intl
Requires:       php-json
Requires:       php-libxml
Requires:       php-mbstring
Requires:       php-pcre
Requires:       php-phar
Requires:       php-reflection
Requires:       php-simplexml
Requires:       php-spl
Requires:       php-tokenizer
Requires:       php-xsl
Requires:       php-zlib
Provides:       php-composer(composer/composer) = %{version}


%description
Composer helps you declare, manage and install dependencies of PHP projects,
ensuring you have the right stack everywhere.

Documentation: https://getcomposer.org/doc/


%prep
%setup -q -n %{gh_project}-%{gh_commit}

%patch0 -p1 -b .rpm
cp -p %{SOURCE1} src/Composer/autoload.php
cp -p %{SOURCE2} tests/bootstrap.php
rm src/bootstrap.php

: fix reported version
DATE=%{gh_date}
DATE=${DATE:0:4}-${DATE:4:2}-${DATE:2:2}
sed -e '/VERSION/s/@package_version@/%{gh_commit}/' \
    -e '/BRANCH_ALIAS_VERSION/s/@package_branch_alias_version@/%{gh_branch}/' \
    -e "/RELEASE_DATE/s/@release_date@/$DATE/" \
    -i src/Composer/Composer.php


%build
# Nothing


%install
rm -rf       %{buildroot}

: Library
mkdir -p     %{buildroot}%{_datadir}/php
cp -pr src/* %{buildroot}%{_datadir}/php

: Resources
mkdir -p     %{buildroot}%{_datadir}/%{name}
cp -pr res   %{buildroot}%{_datadir}/%{name}/res

: Command
install -Dpm 755 bin/%{name} %{buildroot}%{_bindir}/%{name}


%check
%if %{with_tests}
: Run test suite
export BUILDROOT=%{buildroot}
%{_bindir}/phpunit --include-path $PWD/src
%else
: Test suite disabled
%endif


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md doc
%{_bindir}/%{name}
%{_datadir}/php/Composer
%{_datadir}/%{name}


%changelog
* Thu Feb 26 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-0.1.20150225gite5985a9
- Initial package