From 37a9f5d7763cb79bcb3a0a40fd9ca206a73d21e5 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 23 Sep 2015 11:24:48 +0200 Subject: php-patchwork-utf8: backport --- Makefile | 4 +++ php-patchwork-utf8-get-source.sh | 69 ++++++++++++++++++++++++++++++++++++++++ php-patchwork-utf8.spec | 18 ++++++++++- 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 Makefile create mode 100755 php-patchwork-utf8-get-source.sh 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/php-patchwork-utf8-get-source.sh b/php-patchwork-utf8-get-source.sh new file mode 100755 index 0000000..ba71f5d --- /dev/null +++ b/php-patchwork-utf8-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-patchwork-utf8.spec b/php-patchwork-utf8.spec index ccd973e..f021d78 100644 --- a/php-patchwork-utf8.spec +++ b/php-patchwork-utf8.spec @@ -1,3 +1,4 @@ +# remirepo spec file for php-patchwork-utf8, from: # # Fedora spec file for php-patchwork-utf8 # @@ -21,7 +22,11 @@ %global php_min_ver 5.3.0 # Build using "--without tests" to disable tests +%if 0%{?rhel} == 5 +%global with_tests 0%{?_with_tests:1} +%else %global with_tests 0%{!?_without_tests:1} +%endif %{!?phpdir: %global phpdir %{_datadir}/php} @@ -43,6 +48,7 @@ Source1: %{name}-get-source.sh # https://github.com/tchwork/utf8/pull/50 Patch0: %{name}-pull-50.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # Relative paths BuildRequires: python @@ -133,6 +139,8 @@ rm -f \ %install +rm -rf %{buildroot} + : Library mkdir -p %{buildroot}%{phpdir} cp -rp src/Patchwork %{buildroot}%{phpdir}/ @@ -160,18 +168,26 @@ ln -s \ %endif +%clean +rm -rf %{buildroot} + + %files +%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE* %doc *.md %doc composer.json %{phpdir}/Patchwork %exclude %{phpdir}/Patchwork/Utf8/unicode-data.tbz2 -%exclude %{phpdir}/Patchwork/Utf8/WindowsStreamWrapper.php +#exclude %{phpdir}/Patchwork/Utf8/WindowsStreamWrapper.php %{_datadir}/%{name} %changelog +* Wed Sep 23 2015 Remi Collet - 1.2.3-3 +- backport for remi repository + * Tue Sep 22 2015 Shawn Iwinski - 1.2.3-3 - Update patch for license files -- cgit