From 40ccd8e6fb52636b0f64ba5380349f633ddba724 Mon Sep 17 00:00:00 2001 From: Shawn Iwinski Date: Tue, 28 Mar 2017 12:23:51 -0400 Subject: Initial import (RHBZ #1431377) --- .gitignore | 1 + php-firebase-php-jwt-get-source.sh | 69 +++++++++++++++++++ php-firebase-php-jwt.spec | 138 +++++++++++++++++++++++++++++++++++++ sources | 1 + 4 files changed, 209 insertions(+) create mode 100755 php-firebase-php-jwt-get-source.sh create mode 100644 php-firebase-php-jwt.spec diff --git a/.gitignore b/.gitignore index e69de29..6dd6b32 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/php-firebase-php-jwt-4.0.0-dccf163dc8ed7ed6a00afc06c51ee5186a428d35.tar.gz diff --git a/php-firebase-php-jwt-get-source.sh b/php-firebase-php-jwt-get-source.sh new file mode 100755 index 0000000..ba71f5d --- /dev/null +++ b/php-firebase-php-jwt-get-source.sh @@ -0,0 +1,69 @@ +#/bin/sh + +GIT=`which git` +RPM=`which rpm` + +if [ -z "$GIT" ] +then + echo "ERROR: 'git' command not found" 1>&2 + exit 1 +elif [ -z "$RPM" ] +then + echo "ERROR: 'rpm' command not found" 1>&2 + exit 1 +fi + +function print { + echo -e "\e[0;33m>>>>> ${1}\e[0m" +} + +if [ -x "$1" ] +then + SPEC=$1 +else + SPEC=`ls *.spec | head -1` +fi + +NAME=`echo $SPEC | sed 's#\.spec##'` +VERSION=`egrep '%global\s*github_version' $SPEC | awk '{print $3}'` + +print "SPEC = $SPEC" +print "NAME = $NAME" + +GIT_OWNER=`egrep '%global\s*github_owner' $SPEC | awk '{print $3}'` +GIT_NAME=`egrep '%global\s*github_name' $SPEC | awk '{print $3}'` +GIT_COMMIT=`egrep '%global\s*github_commit' $SPEC | awk '{print $3}'` +GIT_REPO=https://github.com/${GIT_OWNER}/${GIT_NAME} +GIT_DIR=`echo $GIT_REPO | sed 's#.*/##'` + +print "GIT_OWNER = $GIT_OWNER" +print "GIT_NAME = $GIT_NAME" +print "GIT_COMMIT = $GIT_COMMIT" +print "GIT_REPO = $GIT_REPO" +print "GIT_DIR = $GIT_DIR" + +TEMP_DIR=$(mktemp --dir) + +pushd $TEMP_DIR + print "Cloning git repo..." + $GIT clone $GIT_REPO + + pushd $GIT_DIR + print "Checking out commit..." + $GIT checkout $GIT_COMMIT + popd + + TAR_DIR=${GIT_NAME}-${GIT_COMMIT} + print "TAR_DIR = $TAR_DIR" + + mv $GIT_DIR $TAR_DIR + + TAR_FILE=`$RPM --eval='%{_sourcedir}'`/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz + print "TAR_FILE = $TAR_FILE" + + [ -e $TAR_FILE ] && rm -f $TAR_FILE + tar --exclude-vcs -czf $TAR_FILE $TAR_DIR + chmod 0644 $TAR_FILE +popd + +rm -rf $TEMP_DIR diff --git a/php-firebase-php-jwt.spec b/php-firebase-php-jwt.spec new file mode 100644 index 0000000..1178a5e --- /dev/null +++ b/php-firebase-php-jwt.spec @@ -0,0 +1,138 @@ +# +# Fedora spec file for php-firebase-php-jwt +# +# Copyright (c) 2017 Shawn Iwinski +# +# License: MIT +# http://opensource.org/licenses/MIT +# +# Please preserve changelog entries +# + +%global github_owner firebase +%global github_name php-jwt +%global github_version 4.0.0 +%global github_commit dccf163dc8ed7ed6a00afc06c51ee5186a428d35 + +%global composer_vendor firebase +%global composer_project php-jwt + +# "php": ">= 5.3.0" +%global php_min_ver 5.3.0 + +# Build using "--without tests" to disable tests +%global with_tests 0%{!?_without_tests:1} + +%{!?phpdir: %global phpdir %{_datadir}/php} + +Name: php-%{composer_vendor}-%{composer_project} +Version: %{github_version} +Release: 1%{?github_release}%{?dist} +Summary: A simple library to encode and decode JSON Web Tokens (JWT) + +Group: Development/Libraries +License: BSD +URL: https://github.com/%{github_owner}/%{github_name} + +# GitHub export does not include tests. +# Run php-firebase-php-jwt-get-source.sh to create full source. +Source0: %{name}-%{github_version}-%{github_commit}.tar.gz +Source1: %{name}-get-source.sh + +BuildArch: noarch +# Tests +%if %{with_tests} +## composer.json +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(phpunit/phpunit) +## phpcompatinfo (computed from version 4.0.0) +BuildRequires: php-date +BuildRequires: php-hash +BuildRequires: php-json +BuildRequires: php-mbstring +BuildRequires: php-openssl +BuildRequires: php-pcre +BuildRequires: php-spl +## Autoloader +BuildRequires: php-composer(fedora/autoloader) +%endif + +# composer.json +Requires: php(language) >= %{php_min_ver} +# phpcompatinfo (computed from version 4.0.0) +Requires: php-date +Requires: php-hash +Requires: php-json +Requires: php-mbstring +Requires: php-openssl +Requires: php-pcre +Requires: php-spl +# Autoloader +Requires: php-composer(fedora/autoloader) + +# Composer +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} + +%description +A simple library to encode and decode JSON Web Tokens (JWT) in PHP, conforming +to RFC 7519 [1]. + +Autoloader: %{phpdir}/Firebase/JWT/autoload.php + +[1] https://tools.ietf.org/html/rfc7519 + + +%prep +%setup -qn %{github_name}-%{github_commit} + + +%build +: Create autoloader +cat <<'AUTOLOAD' | tee src/autoload.php + - 4.0.0-1 +- Initial package diff --git a/sources b/sources index e69de29..b2b2607 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (php-firebase-php-jwt-4.0.0-dccf163dc8ed7ed6a00afc06c51ee5186a428d35.tar.gz) = c578f4f918b5e009d7ab2b27b3cc6f835010b3b1dd3f5ffff1b5885c0a5ef46ac67c1d810ea87df65ab2370afc6cca780e812537113102ef056f5b93a0b3a5e7 -- cgit