summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer.json10
-rwxr-xr-xmakesrc.sh28
-rw-r--r--php-phpunit-php-text-template2.spec44
3 files changed, 74 insertions, 8 deletions
diff --git a/composer.json b/composer.json
index 68ed142..0955bab 100644
--- a/composer.json
+++ b/composer.json
@@ -17,9 +17,19 @@
"support": {
"issues": "https://github.com/sebastianbergmann/php-text-template/issues"
},
+ "config": {
+ "platform": {
+ "php": "7.3.0"
+ },
+ "optimize-autoloader": true,
+ "sort-packages": true
+ },
"require": {
"php": "^7.3"
},
+ "require-dev": {
+ "phpunit/phpunit": "^9.0"
+ },
"autoload": {
"classmap": [
"src/"
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..4190c13
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+NAME=$(basename $PWD)
+OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec)
+PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
+COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec)
+SHORT=${COMMIT:0:7}
+
+echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
+
+echo "Cloning..."
+rm -rf $PROJECT-$COMMIT
+git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
+
+echo "Getting commit..."
+pushd $PROJECT-$COMMIT
+git checkout $COMMIT
+cp composer.json ../composer.json
+popd
+
+echo "Archiving..."
+tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs --exclude tools $PROJECT-$COMMIT
+
+echo "Cleaning..."
+rm -rf $PROJECT-$COMMIT
+
+echo "Done."
diff --git a/php-phpunit-php-text-template2.spec b/php-phpunit-php-text-template2.spec
index 2fd98f6..fbc80d0 100644
--- a/php-phpunit-php-text-template2.spec
+++ b/php-phpunit-php-text-template2.spec
@@ -6,7 +6,8 @@
#
# Please, preserve the changelog entries
#
-%global gh_commit 526dc996cc0ebdfa428cd2dfccd79b7b53fee346
+%global bootstrap 0
+%global gh_commit 0c69cbf965d5317ba33f24a352539f354a25db09
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner sebastianbergmann
%global gh_project php-text-template
@@ -19,19 +20,31 @@
%global php_home %{_datadir}/php
%global ver_major 2
+%if %{bootstrap}
+%global with_tests 0%{?_with_tests:1}
+%else
+%global with_tests 0%{!?_without_tests:1}
+%endif
+
Name: php-%{pk_vendor}-%{pk_project}%{ver_major}
-Version: 2.0.0
+Version: 2.0.1
Release: 1%{?dist}
Summary: Simple template engine
License: BSD
URL: https://github.com/%{gh_owner}/%{gh_project}
-Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz
+Source0: %{name}-%{version}-%{gh_short}.tgz
+Source1: makesrc.sh
BuildArch: noarch
BuildRequires: php(language) >= 7.3
BuildRequires: php-cli
BuildRequires: php-fedora-autoloader-devel
+%if %{with_tests}
+# From composer.json, require-dev
+# "phpunit/phpunit": "^9.0"
+BuildRequires: phpunit9
+%endif
# From composer.json
# "php": "^7.3"
@@ -60,12 +73,22 @@ mkdir -p %{buildroot}%{php_home}/%{ns_vendor}
cp -pr src %{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}%{ver_major}
+%if %{with_tests}
%check
-: check autoloader
-php -r '
-require "%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}%{ver_major}/autoload.php";
-exit (class_exists("%{ns_vendor}\\%{ns_project}\\Template") ? 0 : 1);
-'
+: Generate tests autoloader
+mkdir vendor
+%{_bindir}/phpab --output vendor/autoload.php tests
+
+: Run upstream test suite
+ret=0
+for cmd in php php73 php74 php80; do
+ if which $cmd; then
+ $cmd -d auto_prepend_file=%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}%{ver_major}/autoload.php \
+ %{_bindir}/phpunit9 --verbose || ret=1
+ fi
+done
+exit $ret
+%endif
%files
@@ -79,6 +102,11 @@ exit (class_exists("%{ns_vendor}\\%{ns_project}\\Template") ? 0 : 1);
%changelog
+* Tue Jun 16 2020 Remi Collet <remi@remirepo.net> - 2.0.1-1
+- update to 2.0.1
+- sources from git snapshot
+- run upstream test suite
+
* Fri Feb 7 2020 Remi Collet <remi@remirepo.net> - 2.0.0-1
- update to 2.0.0
- raise dependency on PHP 7.3