From 6931f5525a306793497db6078222dbaeee841184 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 7 Mar 2018 07:49:16 +0100 Subject: New package --- .gitignore | 9 +++ Makefile | 4 ++ composer.json | 40 +++++++++++ php-pragmarx-google2fa.spec | 165 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 218 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 composer.json create mode 100644 php-pragmarx-google2fa.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f69818 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +clog +package-*.xml +*.tgz +*.tar.gz +*.tar.bz2 +*.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..897c259 --- /dev/null +++ b/composer.json @@ -0,0 +1,40 @@ +{ + "name": "pragmarx/google2fa", + "description": "A One Time Password Authentication package, compatible with Google Authenticator.", + "keywords": ["authentication", "two factor authentication", "google2fa", "laravel", "2fa"], + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Antonio Carlos Ribeiro", + "email": "acr@antoniocarlosribeiro.com", + "role": "Creator & Designer" + } + ], + "require": { + "php": ">=5.4", + "paragonie/constant_time_encoding": "~1.0|~2.0", + "paragonie/random_compat": "~1.4|~2.0", + "symfony/polyfill-php56": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4|~5|~6", + "bacon/bacon-qr-code": "~1.0" + }, + "autoload": { + "psr-4": { + "PragmaRX\\Google2FA\\": "src/", + "PragmaRX\\Google2FA\\Tests\\": "tests/" + } + }, + "extra": { + "component": "package", + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "suggest": { + "bacon/bacon-qr-code": "Required to generate inline QR Codes." + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/php-pragmarx-google2fa.spec b/php-pragmarx-google2fa.spec new file mode 100644 index 0000000..f0ba78e --- /dev/null +++ b/php-pragmarx-google2fa.spec @@ -0,0 +1,165 @@ +# remirepo/fedora spec file for php-pragmarx-google2fa +# +# Copyright (c) 2018 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# + +%global with_tests 0%{!?_without_tests:1} +# Github +%global gh_commit 5a818bda62fab0c0a79060b06d50d50b5525d631 +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_owner antonioribeiro +%global gh_project google2fa +# Packagist +%global pk_vendor pragmarx +%global pk_project %{gh_project} +# Namespace +%global ns_vendor PragmaRX +%global ns_project Google2FA + +Name: php-%{pk_vendor}-%{pk_project} +Version: 2.0.7 +Release: 1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist} +Summary: Google Two-Factor Authentication for PHP Package + +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 + +BuildArch: noarch +%if %{with_tests} +BuildRequires: php(language) >= 5.6 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires: (php-composer(paragonie/constant_time_encoding) >= 1.0 with php-composer(paragonie/constant_time_encoding) < 2) +BuildRequires: (php-composer(paragonie/random_compat) >= 2.0 with php-composer(paragonie/random_compat) < 3) +%else +BuildRequires: php-paragonie-constant-time-encoding +BuildRequires: php-paragonie-random-compat +%endif +BuildRequires: php-date +BuildRequires: php-hash +BuildRequires: php-pcre +# For tests, from composer.json "require-dev": { +# "phpunit/phpunit": "~4|~5|~6", +# "bacon/bacon-qr-code": "~1.0" +BuildRequires: php-composer(phpunit/phpunit) +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires: (php-composer(bacon/bacon-qr-code) >= 1.0 with php-composer(bacon/bacon-qr-code) < 2) +%else +BuildRequires: php-bacon-qr-code +%endif +# For autoloader +BuildRequires: php-composer(fedora/autoloader) +%endif + +# From composer.json, "require": { +# "php": ">=5.4", +# "paragonie/constant_time_encoding": "~1.0|~2.0", +# "paragonie/random_compat": "~1.4|~2.0", +# "symfony/polyfill-php56": "~1.2" +# Use 5.6 and avoid polyfill +Requires: php(language) >= 5.6 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +# Only use constant_time_encoding v1 available in Fedora for autoloader path +Requires: (php-composer(paragonie/constant_time_encoding) >= 1.0 with php-composer(paragonie/constant_time_encoding) < 2) +# Only use random_compat v2 available in Fedora for autoloader path +Requires: (php-composer(paragonie/random_compat) >= 2.0 with php-composer(paragonie/random_compat) < 3) +%else +Requires: php-paragonie-constant-time-encoding +Requires: php-paragonie-random-compat +%endif +# From phpcompatinfo report for 2.0.7 +Requires: php-hash +Requires: php-pcre +# From composer.json, "suggest": { +# "bacon/bacon-qr-code": "Required to generate inline QR Codes." +%if 0%{?fedora} >= 21 || 0%{?rhel} >= 8 +Recommends: php-composer(bacon/bacon-qr-code) +%endif +# For generated autoloader +Requires: php-composer(fedora/autoloader) + +# Composer +Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version} + + +%description +Google2FA is a PHP implementation of the Google Two-Factor Authentication +Module, supporting the HMAC-Based One-time Password (HOTP) algorithm +specified in RFC 4226 and the Time-based One-time Password (TOTP) algorithm +specified in RFC 6238. + +Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}/autoload.php + + +%prep +%setup -q -n %{gh_project}-%{gh_commit} + +: Create autoloader +cat <<'AUTOLOAD' | tee src/autoload.php + - 2.0.7-1 +- initial package -- cgit