diff options
| -rwxr-xr-x[l---------] | makesrc.sh | 28 | ||||
| -rwxr-xr-x | php-webmozart-assert2-get-source.sh | 74 | ||||
| -rw-r--r-- | php-webmozart-assert2.spec | 59 |
3 files changed, 53 insertions, 108 deletions
diff --git a/makesrc.sh b/makesrc.sh index bd21789..f2a2aed 120000..100755 --- a/makesrc.sh +++ b/makesrc.sh @@ -1 +1,27 @@ -php-webmozart-assert2-get-source.sh
\ No newline at end of file +#!/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) + +if [ -f $NAME-$VERSION.tgz ]; then + echo "$NAME-$VERSION.tgz already there" +else + echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION \n" + + echo "Cloning..." + rm -rf $PROJECT-$VERSION + git clone https://github.com/$OWNER/$PROJECT.git --depth 1 --branch $VERSION $PROJECT-$VERSION || exit 1 + + echo "Getting composer..." + cp $PROJECT-$VERSION/composer.json composer.json + + echo "Archiving..." + tar czf $NAME-$VERSION.tgz --exclude-vcs $PROJECT-$VERSION + + echo "Cleaning..." + rm -rf $PROJECT-$VERSION + + echo "Done." +fi diff --git a/php-webmozart-assert2-get-source.sh b/php-webmozart-assert2-get-source.sh deleted file mode 100755 index 76e9f57..0000000 --- a/php-webmozart-assert2-get-source.sh +++ /dev/null @@ -1,74 +0,0 @@ -#/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 - -SPEC_DIR=`pwd` - -print "SPEC_DIR = $SPEC_DIR" - -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 || exit 1 - cp composer.json ${SPEC_DIR} - popd - - TAR_DIR=${GIT_NAME}-${GIT_COMMIT} - print "TAR_DIR = $TAR_DIR" - - mv $GIT_DIR $TAR_DIR - - TAR_FILE=${SPEC_DIR}/${NAME}-${VERSION}-${GIT_COMMIT:0:7}.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-webmozart-assert2.spec b/php-webmozart-assert2.spec index 780fd1f..6fa72e7 100644 --- a/php-webmozart-assert2.spec +++ b/php-webmozart-assert2.spec @@ -9,66 +9,53 @@ # Please preserve changelog entries # -# enable bootstrap when need to provide a new autoloader -%global bootstrap 0 -%global github_owner webmozart -%global github_name assert -%global github_version 2.1.6 -%global github_commit ff31ad6efc62e66e518fbab1cde3453d389bcdc8 -%global github_short %(c=%{github_commit}; echo ${c:0:7}) +%bcond_without tests + +%global gh_owner webmozart +%global gh_project assert %global major 2 %global composer_vendor webmozart %global composer_project assert # "php": "^8.2" -%global php_min_ver 8.2 +%global php_min_ver 8.2 # PHPUnit -%global phpunit_require phpunit11 -%global phpunit_exec phpunit11 +%global phpunit_require phpunit11 +%global phpunit_exec phpunit11 -%if %{bootstrap} -# Build using "--with tests" to enable tests -%global with_tests 0%{?_with_tests:1} -%else -# Build using "--without tests" to disable tests -%global with_tests 0%{!?_without_tests:1} -%endif +%global phpdir %{_datadir}/php -%{!?phpdir: %global phpdir %{_datadir}/php} Name: php-%{composer_vendor}-%{composer_project}%{major} -Version: %{github_version} -Release: 1%{?github_release}%{?dist} Summary: Assertions to validate method input/output with nice error messages - License: MIT -URL: https://github.com/%{github_owner}/%{github_name} +Version: 2.3.0 +Release: 1%{?dist} +URL: https://github.com/%{gh_owner}/%{gh_project} # GitHub export does not include tests. -# Run php-webmozart-assert-get-source.sh to create full source. -Source0: %{name}-%{github_version}-%{github_short}.tar.gz -Source1: %{name}-get-source.sh +# Run makesrc.sh to create full source. +Source0: %{name}-%{version}.tgz +Source1: makesrc.sh BuildArch: noarch # Tests -%if %{with_tests} +%if %{with tests} ## composer.json BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: php-ctype BuildRequires: %{phpunit_require} -## phpcompatinfo (computed from version 1.7.0) +## phpcompatinfo (computed from version 2.2.0) BuildRequires: php-mbstring BuildRequires: php-simplexml +%endif ## Autoloader BuildRequires: php-composer(fedora/autoloader) -%endif # composer.json Requires: php(language) >= %{php_min_ver} -Requires: php-ctype -# phpcompatinfo (computed from version 1.7.0) +# phpcompatinfo (computed from version 2.2.0) Requires: php-mbstring # Autoloader Requires: php-composer(fedora/autoloader) @@ -88,7 +75,7 @@ Autoloader: %{phpdir}/Webmozart/Assert%{major}/autoload.php %prep -%setup -qn %{github_name}-%{github_commit} +%setup -qn %{gh_project}-%{version} %build @@ -109,8 +96,8 @@ mkdir -p %{buildroot}%{phpdir}/Webmozart cp -rp src %{buildroot}%{phpdir}/Webmozart/Assert%{major} +%if %{with tests} %check -%if %{with_tests} : Create tests bootstrap cat <<'BOOTSTRAP' | tee bootstrap.php <?php @@ -145,6 +132,12 @@ exit $RETURN_CODE %changelog +* Tue Apr 14 2026 Remi Collet <remi@remirepo.net> - 2.3.0-1 +- update to 2.3.0 + +* Fri Apr 10 2026 Remi Collet <remi@remirepo.net> - 2.2.0-1 +- update to 2.2.0 + * Fri Feb 27 2026 Remi Collet <remi@remirepo.net> - 2.1.6-1 - update to 2.1.6 |
