[packages/composer-php] - use github code to build the package, added boostrap bcond

glen glen at pld-linux.org
Sat Dec 8 03:02:12 CET 2012


commit 7e4a18743663914d63242deb50bf52610f3847fd
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sat Dec 8 04:01:24 2012 +0200

    - use github code to build the package, added boostrap bcond

 composer-php.spec | 34 +++++++++++++++++++++++++++++-----
 nogit.patch       | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 5 deletions(-)
---
diff --git a/composer-php.spec b/composer-php.spec
index 1158bb5..40b5ede 100644
--- a/composer-php.spec
+++ b/composer-php.spec
@@ -1,7 +1,11 @@
+#
+# Conditional build:
+%bcond_with	bootstrap		# build boostrap
+
 %define		pkgname	composer
 %define		php_min_version 5.3.4
 %define		subver	alpha6
-%define		rel		0.1
+%define		rel		0.2
 %include	/usr/lib/rpm/macros.php
 Summary:	Dependency Manager for PHP
 Name:		%{pkgname}-php
@@ -9,11 +13,19 @@ Version:	1.0.0
 Release:	0.%{subver}.%{rel}
 License:	MIT
 Group:		Development/Languages/PHP
-Source0:	http://getcomposer.org/download/1.0.0-alpha6/%{pkgname}.phar
-# Source0-md5:	f9b1dbd4ad0e3707bfe216690b210a7e
+Source0:	https://github.com/composer/composer/archive/%{version}-%{subver}.tar.gz
+# Source0-md5:	bb5ad93089d09a1e58cfaf28fb5c2ab4
+Source1:	http://getcomposer.org/download/%{version}-%{subver}/%{pkgname}.phar
+# Source1-md5:	77ab6fa1a2b50539e935c826f9df27fb
+Patch0:		nogit.patch
 URL:		http://www.getcomposer.org/
+BuildRequires:	/usr/bin/php
+BuildRequires:	php(phar)
 BuildRequires:	rpm-php-pearprov >= 4.4.2-11
 BuildRequires:	rpmbuild(macros) >= 1.461
+%if %{without bootstrap}
+BuildRequires:	%{name}
+%endif
 Requires:	php(core) >= %{php_min_version}
 Requires:	php(phar)
 Suggests:	git-core
@@ -29,16 +41,28 @@ declare the dependent libraries your project needs and it will install
 them in your project for you.
 
 %prep
-%setup -qcT
+%setup -q -n %{pkgname}-%{version}%{?subver:-%{subver}}
+%patch0 -p1
+
+%build
+%if %{with bootstrap}
+cp -p %{SOURCE1} .
+%else
+composer install -v
+
+COMPOSER_VERSION=%{version}%{?subver:-%{subver}} \
+%{__php} -d phar.readonly=0 ./bin/compile
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT%{_bindir}
-cp -p %{SOURCE0} $RPM_BUILD_ROOT%{_bindir}/%{pkgname}
+cp -p %{pkgname}.phar $RPM_BUILD_ROOT%{_bindir}/%{pkgname}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
+%doc README.md CHANGELOG.md LICENSE PORTING_INFO
 %attr(755,root,root) %{_bindir}/composer
diff --git a/nogit.patch b/nogit.patch
new file mode 100644
index 0000000..6dbd9a4
--- /dev/null
+++ b/nogit.patch
@@ -0,0 +1,32 @@
+--- composer-1.0.0-alpha6/src/Composer/Compiler.php~	2012-10-23 11:54:25.000000000 +0300
++++ composer-1.0.0-alpha6/src/Composer/Compiler.php	2012-12-08 03:44:08.842614626 +0200
+@@ -35,16 +35,20 @@
+             unlink($pharFile);
+         }
+ 
+-        $process = new Process('git log --pretty="%h" -n1 HEAD', __DIR__);
+-        if ($process->run() != 0) {
+-            throw new \RuntimeException('Can\'t run git log. You must ensure to run compile from composer git repository clone and that git binary is available.');
+-        }
+-        $this->version = trim($process->getOutput());
++		$this->version = getenv('COMPOSER_VERSION');
+ 
+-        $process = new Process('git describe --tags HEAD');
+-        if ($process->run() == 0) {
+-            $this->version = trim($process->getOutput());
+-        }
++		if (empty($this->version)) {
++			$process = new Process('git log --pretty="%h" -n1 HEAD', __DIR__);
++			if ($process->run() != 0) {
++				throw new \RuntimeException('Can\'t run git log. You must ensure to run compile from composer git repository clone and that git binary is available.');
++			}
++			$this->version = trim($process->getOutput());
++
++			$process = new Process('git describe --tags HEAD');
++			if ($process->run() == 0) {
++				$this->version = trim($process->getOutput());
++			}
++		}
+ 
+         $phar = new \Phar($pharFile, 0, 'composer.phar');
+         $phar->setSignatureAlgorithm(\Phar::SHA1);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/composer-php.git/commitdiff/7e4a18743663914d63242deb50bf52610f3847fd



More information about the pld-cvs-commit mailing list