summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-08-25 16:09:28 +0200
committerRemi Collet <remi@remirepo.net>2020-08-25 16:09:28 +0200
commit6c81346d03ea2caca097acd30647894c489f9b5f (patch)
tree8dbfb4a49afeedd0aef4cffc213f0411b292ec60
initial package
-rw-r--r--.gitignore9
-rw-r--r--Makefile4
-rw-r--r--composer.json27
-rwxr-xr-xmakesrc.sh28
-rw-r--r--php-brick-varexporter.spec140
5 files changed, 208 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..01f0400
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+clog
+package-*.xml
+*.tgz
+*.tar.bz2
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..91b0fd5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../common/Makefile
+
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..2da21f6
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,27 @@
+{
+ "name": "brick/varexporter",
+ "description": "A powerful alternative to var_export(), which can export closures and objects without __set_state()",
+ "type": "library",
+ "keywords": [
+ "var_export"
+ ],
+ "license": "MIT",
+ "require": {
+ "php": ">=7.2",
+ "nikic/php-parser": "^4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.0",
+ "php-coveralls/php-coveralls": "^2.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Brick\\VarExporter\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Brick\\VarExporter\\Tests\\": "tests/"
+ }
+ }
+}
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..37cb6a2
--- /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 $PROJECT-$COMMIT
+
+echo "Cleaning..."
+rm -rf $PROJECT-$COMMIT
+
+echo "Done."
diff --git a/php-brick-varexporter.spec b/php-brick-varexporter.spec
new file mode 100644
index 0000000..10f3be0
--- /dev/null
+++ b/php-brick-varexporter.spec
@@ -0,0 +1,140 @@
+# remirepo/fedora spec file for php-brick-varexporter
+#
+# Copyright (c) 2020 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+# Github
+%global gh_commit 411110b797c6b1ecf947a0eec17ffaa59284f5a0
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner brick
+%global gh_project varexporter
+# Packagist
+%global pk_vendor %{gh_owner}
+%global pk_name %{gh_project}
+# Namespace
+%global ns_vendor Brick
+%global ns_project VarExporter
+
+Name: php-%{pk_vendor}-%{pk_name}
+Version: 0.3.2
+Release: 1%{?dist}
+Summary: A powerful alternative to var_export
+
+License: MIT
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source0: %{name}-%{version}-%{gh_short}.tgz
+# Create git snapshot as tests are excluded from official tarball
+Source1: makesrc.sh
+
+BuildArch: noarch
+
+BuildRequires: php(language) >= 7.2
+# remirepo:1
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+BuildRequires: (php-composer(nikic/php-parser) >= 4.0 with php-composer(nikic/php-parser) < 5)
+# remirepo:3
+%else
+BuildRequires: php-nikic-php-parser4
+%endif
+BuildRequires: php-reflection
+BuildRequires: php-date
+BuildRequires: php-pcre
+BuildRequires: php-spl
+# From composer.json, "require-dev": {
+# "phpunit/phpunit": "^7.0",
+# "php-coveralls/php-coveralls": "^2.0"
+BuildRequires: phpunit7
+# Autoloader
+BuildRequires: php-fedora-autoloader-devel
+
+# From composer.json, "require": {
+# "php": ">=7.2",
+# "nikic/php-parser": "^4.0"
+Requires: php(language) >= 7.2
+# remirepo:1
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+Requires: (php-composer(nikic/php-parser) >= 4.0 with php-composer(nikic/php-parser) < 5)
+# remirepo:3
+%else
+Requires: php-nikic-php-parser4
+%endif
+# From phpcompatifo report for 0.3.2
+Requires: php-reflection
+Requires: php-pcre
+Requires: php-spl
+# Autoloader
+Requires: php-composer(fedora/autoloader)
+
+Provides: php-composer(%{pk_vendor}/%{pk_name}) = %{version}
+
+
+%description
+This library aims to provide a prettier, safer, and powerful alternative
+to var_export(). The output is valid and standalone PHP code, that does
+not depend on the brick/varexporter library.
+
+Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}/autoload.php
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+
+%build
+: Create classmap autoloader
+phpab \
+ --template fedora \
+ --output src/autoload.php \
+ src
+
+cat << 'EOF' | tee -a src/autoload.php
+
+\Fedora\Autoloader\Dependencies::required([
+ '/usr/share/php/PhpParser4/autoload.php',
+]);
+
+EOF
+
+%install
+# Restore PSR-0 tree
+mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor}
+cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}
+
+
+%check
+: Generate a simple autoloader
+mkdir vendor
+cat << 'EOF' | tee vendor/autoload.php
+<?php
+// Installed library
+require '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('Brick\\VarExporter\\Tests\\', dirname(__DIR__) . '/tests');
+EOF
+
+: Run upstream test suite
+ret=0
+for cmd in php php72 php73 php74 php80; do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit7 \
+ --no-coverage \
+ --verbose || ret=1
+ fi
+done
+exit $ret
+
+
+%files
+# remirepo:1
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc *.md
+%doc composer.json
+%{_datadir}/php/%{ns_vendor}
+
+
+%changelog
+* Tue Aug 25 2020 Remi Collet <remi@remirepo.net> - 0.3.2-1
+- initial package