[php-PHPParser] - provide php-composer(nikic/php-parser) - fix license handling

Remi Collet remi at fedoraproject.org
Thu Feb 26 07:05:40 UTC 2015


commit 44a1f75f5d92e364e03ae3741fd0f3bea1cae9e2
Author: Remi Collet <remi at fedoraproject.org>
Date:   Thu Feb 26 08:05:34 2015 +0100

    - provide php-composer(nikic/php-parser)
    - fix license handling

 .gitignore                  |  3 ++-
 makesrc.sh                  | 24 ++++++++++++++++++++++++
 php-PHPParser-command.patch | 13 +++++++++++++
 php-PHPParser.spec          | 40 ++++++++++++++++++++++++++++++++++------
 sources                     |  2 +-
 5 files changed, 74 insertions(+), 8 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 8e9a39e..cd029e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
-/v0.9.3.tar.gz
+clog
 /php-PHPParser-0.9.4-1e5e280ae88a27effa2ae4aa2bd088494ed8594f.tar.gz
 /php-PHPParser-1.0.0-a6d46c17b10d89f35a92fa4b8fb5071615bfb36c.tar.gz
 /php-PHPParser-1.0.0-2b96ab8edccd5a0d0e7a826a7dc53c421ae64f94.tar.gz
 /php-PHPParser-1.0.1-b9a60372f26356feb85b4b9ca50a395a5f0d7f34.tar.gz
 /php-PHPParser-1.0.2-a8ffc6fcfcbae268656c8acf1298e378ac1ee5f1.tar.gz
+/php-PHPParser-1.1.0-ac05ef6.tgz
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..d78aad2
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+NAME=php-PHPParser
+OWNER=nikic
+PROJECT=PHP-Parser
+VERSION=$(sed -n '/^%global github_version/{s/.* //;p}' $NAME.spec)
+COMMIT=$(sed -n '/^%global github_commit/{s/.* //;p}' $NAME.spec)
+SHORT=${COMMIT:0:7}
+
+echo "Cloning..."
+git clone https://github.com/nikic/PHP-Parser.git $PROJECT-$SHORT
+
+echo "Gettin commit..."
+pushd $PROJECT-$SHORT
+git checkout $COMMIT
+popd
+
+echo "Archiving..."
+tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$SHORT
+
+echo "Cleaning..."
+rm -rf $PROJECT-$SHORT
+
+echo "Done."
diff --git a/php-PHPParser-command.patch b/php-PHPParser-command.patch
new file mode 100644
index 0000000..0a8cfd5
--- /dev/null
+++ b/php-PHPParser-command.patch
@@ -0,0 +1,13 @@
+diff -up bin/php-parse.php.rpm bin/php-parse.php
+--- bin/php-parse.php.rpm	2015-02-25 17:52:01.000000000 +0100
++++ bin/php-parse.php	2015-02-25 17:52:55.000000000 +0100
+@@ -1,6 +1,8 @@
++#!/usr/bin/php
+ <?php
+ 
+-require __DIR__ . '/../lib/bootstrap.php';
++require 'PhpParser/Autoloader.php';
++PhpParser\Autoloader::register();
+ 
+ ini_set('xdebug.max_nesting_level', 2000);
+ 
diff --git a/php-PHPParser.spec b/php-PHPParser.spec
index 468eee1..3a022f5 100644
--- a/php-PHPParser.spec
+++ b/php-PHPParser.spec
@@ -1,7 +1,19 @@
+#
+# RPM spec file for php-PHPParser
+#
+# Copyright (c) 2012-2015 Shawn Iwinski <shawn.iwinski at gmail.com>
+#
+# License: MIT
+# http://opensource.org/licenses/MIT
+#
+# Please preserve changelog entries
+#
+
 %global github_owner    nikic
 %global github_name     PHP-Parser
-%global github_version  1.0.2
-%global github_commit   a8ffc6fcfcbae268656c8acf1298e378ac1ee5f1
+%global github_version  1.1.0
+%global github_commit   ac05ef6f95bf8361549604b6031c115f92f39528
+%global github_short    %(c=%{github_commit}; echo ${c:0:7})
 
 %global lib_name        PhpParser
 %global lib_name_old    PHPParser
@@ -16,13 +28,19 @@ Summary:       A PHP parser written in PHP
 Group:         Development/Libraries
 License:       BSD
 URL:           https://github.com/%{github_owner}/%{github_name}
-Source0:       %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
+# Upstream tarball don't provide test suite
+# Use mksrc.sh to generate a git snapshot tarball
+Source0:       %{name}-%{github_version}-%{github_short}.tgz
+Source1:       makesrc.sh
+
+# Patch for distribution
+Patch0:        %{name}-command.patch
 
 BuildArch:     noarch
 # For tests
 BuildRequires: php(language) >= %{php_min_ver}
 BuildRequires: %{_bindir}/phpunit
-# For tests: phpcompatinfo (computed from version 1.0.2)
+# For tests: phpcompatinfo (computed from version 1.1.0)
 BuildRequires: php-ctype
 BuildRequires: php-filter
 BuildRequires: php-pcre
@@ -34,7 +52,7 @@ BuildRequires: php-xmlwriter
 # composer.json
 Requires:      php(language) >= %{php_min_ver}
 Requires:      php-tokenizer
-# phpcompatinfo (computed from version 1.0.2)
+# phpcompatinfo (computed from version 1.1.0)
 Requires:      php-filter
 Requires:      php-pcre
 Requires:      php-spl
@@ -49,7 +67,9 @@ A PHP parser written in PHP to simplify static analysis and code manipulation.
 
 
 %prep
-%setup -q -n %{github_name}-%{github_commit}
+%setup -q -n %{github_name}-%{github_short}
+
+%patch0 -p0 -b .rpm
 
 
 %build
@@ -65,6 +85,8 @@ mkdir -p -m 755 %{buildroot}%{_datadir}/php/%{lib_name_old}
 ln -s ../%{lib_name}/Autoloader.php \
     %{buildroot}%{_datadir}/php/%{lib_name_old}/Autoloader.php
 
+install -Dpm 755 bin/php-parse.php %{buildroot}%{_bindir}/php-parse
+
 
 %check
 %{_bindir}/phpunit
@@ -74,11 +96,17 @@ ln -s ../%{lib_name}/Autoloader.php \
 %{!?_licensedir:%global license %%doc}
 %license LICENSE
 %doc *.md doc grammar composer.json
+%{_bindir}/php-parse
 %{_datadir}/php/%{lib_name_old}
 %{_datadir}/php/%{lib_name}
 
 
 %changelog
+* Wed Feb 25 2015 Remi Collet <remi at fedoraproject.org> - 1.1.0-1
+- update to 1.1.0
+- use git snapshot as upstream tarball don't provide the test suite
+- provide the php-parse command
+
 * Wed Nov  5 2014 Remi Collet <remi at fedoraproject.org> 1.0.2-1
 - Update to 1.0.2
 
diff --git a/sources b/sources
index 6b15f58..b097b27 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-939448c4ffe413b6d8ba488720e8599b  php-PHPParser-1.0.2-a8ffc6fcfcbae268656c8acf1298e378ac1ee5f1.tar.gz
+fdf684710d3ed7b4be0c02d420df98be  php-PHPParser-1.1.0-ac05ef6.tgz


More information about the scm-commits mailing list