diff options
author | Remi Collet <remi@remirepo.net> | 2022-01-24 09:10:55 +0100 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2022-01-24 09:10:55 +0100 |
commit | abad386ea58fb0e082f5a7ed4ef6e74ad07a7501 (patch) | |
tree | 0daceb8c23b39792550a2c8b97dd63287d804149 |
-rw-r--r-- | .gitignore | 9 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | composer.json | 39 | ||||
-rwxr-xr-x | makesrc.sh | 31 | ||||
-rw-r--r-- | php-code-lts-u2f-php-server.spec | 125 |
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..026f4cd --- /dev/null +++ b/composer.json @@ -0,0 +1,39 @@ +{ + "name": "code-lts/u2f-php-server", + "description": "Server side handling class for FIDO U2F registration and authentication", + "license":"BSD-2-Clause", + "homepage": "https://github.com/code-lts/U2F-php-server#readme", + "authors": [ + { + "name": "Samuel Hawksby-Robinson", + "email": "samuel@samyoul.com" + }, + { + "name": "William Desportes", + "email": "williamdes@wdes.fr" + } + ], + "support": { + "issues": "https://github.com/code-lts/U2F-php-server/issues", + "source": "https://github.com/code-lts/U2F-php-server" + }, + "scripts": { + "phpunit": "./vendor/bin/phpunit" + }, + "require": { + "php": "^7.1 || ^8.0", + "ext-openssl":"*" + }, + "require-dev": { + "phpunit/phpunit": "^7 || ^8 || ^9" + }, + "autoload": { + "psr-4": { "CodeLts\\U2F\\U2FServer\\": ["src/"] } + }, + "autoload-dev": { + "psr-4": { "CodeLts\\U2F\\U2FServer\\Tests\\": ["test/"] } + }, + "replace": { + "samyoul/u2f-php-server": "*" + } +} diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..d2478f4 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,31 @@ +#!/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} + +if [ -f $NAME-$VERSION-$SHORT.tgz ]; then + echo skip $NAME-$VERSION-$SHORT.tgz +else + echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION, Commit=$COMMIT\n" + + echo "Cloning..." + git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT + + echo "Getting commit..." + pushd $PROJECT-$COMMIT + git checkout $COMMIT || exit 1 + cp composer.json ../composer.json + popd + + echo "Archiving..." + tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT + + echo "Cleaning..." + rm -rf $PROJECT-$COMMIT +fi +echo "Done." + diff --git a/php-code-lts-u2f-php-server.spec b/php-code-lts-u2f-php-server.spec new file mode 100644 index 0000000..dd1a5c0 --- /dev/null +++ b/php-code-lts-u2f-php-server.spec @@ -0,0 +1,125 @@ +# remirepo/fedora spec file for php-code-lts-u2f-php-server +# +# Copyright (c) 2022 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# + +%bcond_without tests + +# Github +%global gh_commit 59b3b28185e7fa255180a61278f6f65739082771 +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_owner code-lts +%global gh_project U2F-php-server +# Packagist +%global pk_vendor code-lts +%global pk_project u2f-php-server +# Namespace +%global ns_vendor CodeLts +%global ns_project U2F +%global ns_library U2FServer + +Name: php-%{pk_vendor}-%{pk_project} +Version: 1.2.0 +Release: 1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist} +Summary: Server side handling class for FIDO U2F registration and authentication + +License: BSD +URL: https://github.com/%{gh_owner}/%{gh_project} +# Git snapshot to retrieve tests +Source0: %{name}-%{version}-%{?gh_short}.tgz +Source1: makesrc.sh + +BuildArch: noarch +%if %{with tests} +BuildRequires: php(language) >= 7.1 +BuildRequires: php-hash +BuildRequires: php-json +BuildRequires: php-openssl +BuildRequires: php-reflection +BuildRequires: php-spl +# From composer.json, "require-dev": { +# "phpunit/phpunit": "^7 || ^8 || ^9" +BuildRequires: phpunit9 +# For autoloader +BuildRequires: php-fedora-autoloader-devel +%endif + +# From composer.json, "require": { +# "php": "^7.1 || ^8.0", +# "ext-openssl":"*" +Requires: php(language) >= 7.1 +Requires: php-openssl +# From phpcompatinfo report for 1.2.0 +Requires: php-hash +Requires: php-json +Requires: php-spl +# For generated autoloader +Requires: php-composer(fedora/autoloader) + +# Composer +Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version} + + +%description +Server-side handling of FIDO U2F registration and authentication for PHP. + +Securing your online accounts and doing your bit to protect your data is +extremely important and increasingly more so as hackers get more sophisticated. +FIDO's U2F enables you to add a simple unobtrusive method of 2nd factor +authentication, allowing users of your service and/or application to link +a hardware key to their account. + +This project is a fork of unmaintained samyoul/u2f-php-server. + +Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}/%{ns_library}/autoload.php + + +%prep +%setup -q -n %{gh_project}-%{gh_commit} + + +%build +: Create autoloader +%{_bindir}/phpab --template fedora --output src/autoload.php src + + +%install +: Library +mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project} +cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/%{ns_library} + + +%check +%if %{with tests} +: Tests autoloader +mkdir vendor +ln -s %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/%{ns_library}/autoload.php vendor/autoload.php + +: Upstream test suite +for cmd in php php74 php80 php81; do + if which $cmd + then + $cmd %{_bindir}/phpunit9 --verbose + fi +done +%endif + + +%files +# remirepo:1 +%{!?_licensedir:%global license %%doc} +%license LICENCE +%doc composer.json +%doc *.md +%dir %{_datadir}/php/%{ns_vendor} +%dir %{_datadir}/php/%{ns_vendor}/%{ns_project} + %{_datadir}/php/%{ns_vendor}/%{ns_project}/%{ns_library} + + +%changelog +* Mon Jan 24 2022 Remi Collet <remi@remirepo.net> - 1.2.0-1 +- initial package (from php-samyoul-u2f-php-server) |