[packages/composer] rebundle .phar without symfony components

glen glen at pld-linux.org
Mon Apr 1 23:12:30 CEST 2013


commit f21c5b27653a0add6ffaf669b045b6dbb9d902b1
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Tue Apr 2 00:11:00 2013 +0300

    rebundle .phar without symfony components

 composer.spec           | 38 ++++++++++++++++++++++++++++++--------
 no-bundle-symfony.patch | 24 ++++++++++++++++++++++++
 system-symfony.patch    | 18 ++++++++++++++++++
 3 files changed, 72 insertions(+), 8 deletions(-)
---
diff --git a/composer.spec b/composer.spec
index 8f9cf45..0e43894 100644
--- a/composer.spec
+++ b/composer.spec
@@ -1,10 +1,13 @@
 #
+# NOTE
+# - release tarballs: http://getcomposer.org/download/
+
 # Conditional build:
 %bcond_with	bootstrap		# build boostrap
 
 %define		php_min_version 5.3.4
 %define		subver	alpha7
-%define		rel		0.7
+%define		rel		0.13
 %include	/usr/lib/rpm/macros.php
 Summary:	Dependency Manager for PHP
 Name:		composer
@@ -13,11 +16,13 @@ Release:	0.%{subver}.%{rel}
 License:	MIT
 Group:		Development/Languages/PHP
 #Source0:	https://github.com/composer/composer/archive/%{version}-%{subver}.tar.gz
-Source0:	https://github.com/composer/composer/archive/master.tar.gz?/%{name}.tgz
-# Source0-md5:	0a4a4b06740a9b49d2ab9773a907aa94
+Source0:	http://github.com/composer/composer/tarball/master?/%{name}.tgz
+# Source0-md5:	661b31437f47e3ff23e616ab3fb21831
 Source1:	http://getcomposer.org/download/%{version}-%{subver}/%{name}.phar
 # Source1-md5:	f9b1dbd4ad0e3707bfe216690b210a7e
 Patch0:		nogit.patch
+Patch1:		no-bundle-symfony.patch
+Patch2:		system-symfony.patch
 URL:		http://www.getcomposer.org/
 BuildRequires:	/usr/bin/php
 BuildRequires:	php(ctype)
@@ -31,6 +36,9 @@ BuildRequires:	rpmbuild(macros) >= 1.461
 BuildRequires:	%{name}
 %endif
 Requires:	php(core) >= %{php_min_version}
+Requires:	php-symfony2-Console >= 2.1
+Requires:	php-symfony2-Finder >= 2.1
+Requires:	php-symfony2-Process >= 2.1
 Suggests:	git-core
 Suggests:	mercurial
 Suggests:	php(openssl)
@@ -47,25 +55,39 @@ declare the dependent libraries your project needs and it will install
 them in your project for you.
 
 %prep
-%setup -q -n %{name}-master
+%setup -qc
+mv composer-composer-*/* .
 %patch0 -p1
+%patch1 -p1
 
 %{__sed} -i -e '1s,^#!.*env php,#!%{__php},' bin/*
 
 %build
 %if %{with bootstrap}
-env -i PATH=$PATH \
-%{__php} %{SOURCE1} install --prefer-dist -v
+composer='env -i PATH="$PATH" %{__php} %{SOURCE1}'
 %else
-composer install --prefer-dist -v
+composer=composer
 %endif
+if [ ! -d vendor ]; then
+	$composer install --prefer-dist -v
+	%{__patch} -p1 < %{PATCH2}
+fi
 
-COMPOSER_VERSION=%{version}%{?subver:-%{subver}} \
+V=$(echo composer-composer-*)
+V=${V#composer-composer-}
+COMPOSER_VERSION=%{version}%{?subver:-%{subver}}${V:+-g$V} \
 %{__php} -d phar.readonly=0 ./bin/compile
 
+# sanity check
+%{__php} composer.phar --version
+
+install -d build
+%{__php} -r '$phar = new Phar($argv[1]); $phar->extractTo($argv[2]);' composer.phar build
+
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_bindir},%{_appdir}}
+cd build
 cp -a bin src res vendor $RPM_BUILD_ROOT%{_appdir}
 ln -s %{_appdir}/bin/%{name} $RPM_BUILD_ROOT%{_bindir}/%{name}
 
diff --git a/no-bundle-symfony.patch b/no-bundle-symfony.patch
new file mode 100644
index 0000000..3ae5c35
--- /dev/null
+++ b/no-bundle-symfony.patch
@@ -0,0 +1,24 @@
+--- composer-master/src/Composer/Compiler.php~	2013-04-01 22:37:46.000000000 +0300
++++ composer-master/src/Composer/Compiler.php	2013-04-01 22:37:53.179095295 +0300
+@@ -84,7 +84,6 @@
+             ->ignoreVCS(true)
+             ->name('*.php')
+             ->exclude('Tests')
+-            ->in(__DIR__.'/../../vendor/symfony/')
+             ->in(__DIR__.'/../../vendor/seld/jsonlint/src/')
+             ->in(__DIR__.'/../../vendor/justinrainbow/json-schema/src/')
+         ;
+--- composer-master/composer.json~	2013-04-01 13:18:27.000000000 +0300
++++ composer-master/composer.json	2013-04-01 23:47:07.240751219 +0300
+@@ -24,10 +24,7 @@
+     "require": {
+         "php": ">=5.3.2",
+         "justinrainbow/json-schema": "1.1.*",
+-        "seld/jsonlint": "1.*",
+-        "symfony/console": "~2.1 at dev",
+-        "symfony/finder": "~2.1",
+-        "symfony/process": "~2.1 at dev"
++        "seld/jsonlint": "1.*"
+     },
+     "require-dev": {
+         "phpunit/phpunit": "~3.7.10"
diff --git a/system-symfony.patch b/system-symfony.patch
new file mode 100644
index 0000000..30fc654
--- /dev/null
+++ b/system-symfony.patch
@@ -0,0 +1,18 @@
+--- ./vendor/composer/autoload_namespaces.php~	2013-04-01 22:50:46.954794399 +0300
++++ ./vendor/composer/autoload_namespaces.php	2013-04-01 22:53:05.747864077 +0300
+@@ -4,11 +4,12 @@
+ 
+ $vendorDir = dirname(dirname(__FILE__));
+ $baseDir = dirname($vendorDir);
++$phpDir = PEAR_INSTALL_DIR . '/';
+ 
+ return array(
+-    'Symfony\\Component\\Process\\' => $vendorDir . '/symfony/process/',
+-    'Symfony\\Component\\Finder' => $vendorDir . '/symfony/finder/',
+-    'Symfony\\Component\\Console\\' => $vendorDir . '/symfony/console/',
++    'Symfony\\Component\\Process\\' => $phpDir,
++    'Symfony\\Component\\Finder' => $phpDir,
++    'Symfony\\Component\\Console\\' => $phpDir,
+     'Seld\\JsonLint' => $vendorDir . '/seld/jsonlint/src/',
+     'JsonSchema' => $vendorDir . '/justinrainbow/json-schema/src/',
+     'Composer' => $baseDir . '/src/',
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/composer.git/commitdiff/f21c5b27653a0add6ffaf669b045b6dbb9d902b1



More information about the pld-cvs-commit mailing list