]> git.pld-linux.org Git - packages/composer.git/commitdiff
- use github code to build the package, added boostrap bcond
authorElan Ruusamäe <glen@delfi.ee>
Sat, 8 Dec 2012 02:01:24 +0000 (04:01 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Sat, 8 Dec 2012 02:01:24 +0000 (04:01 +0200)
composer-php.spec
nogit.patch [new file with mode: 0644]

index 1158bb5b8081c3435cccf2cb6480d921bda810d3..40b5ede82825b4d3d15f63368e92e434ae89e67d 100644 (file)
@@ -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 (file)
index 0000000..6dbd9a4
--- /dev/null
@@ -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);
This page took 0.098324 seconds and 4 git commands to generate.