diff --git a/.gitignore b/.gitignore index c103199..da7ddfe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /jsqueeze-70a8167daf0e2d5522d5d77a11e3a7d6753683ce.tar.gz /jsqueeze-2e581762884cfd035d9b148794ef2a4ab2c3b893.tar.gz +/php-patchwork-jsqueeze-2.0.5-693d64850eab2ce6a7c8f7cf547e1ab46e69d542.tar.gz diff --git a/php-patchwork-jsqueeze-get-source.sh b/php-patchwork-jsqueeze-get-source.sh new file mode 100755 index 0000000..ba71f5d --- /dev/null +++ b/php-patchwork-jsqueeze-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-jsqueeze.spec b/php-patchwork-jsqueeze.spec index 3287845..a88ff4e 100644 --- a/php-patchwork-jsqueeze.spec +++ b/php-patchwork-jsqueeze.spec @@ -1,38 +1,70 @@ -%global github_owner tchwork -%global github_name jsqueeze -%global github_version 2.0.2 -%global github_commit 2e581762884cfd035d9b148794ef2a4ab2c3b893 -%global packagist_owner patchwork -%global packagist_name jsqueeze -%global psr4_namespace Patchwork +# +# Fedora spec file for php-patchwork-jsqueeze +# +# Copyright (c) 2016-2021 Adam Williamson +# Shawn Iwinski +# +# License: MIT +# http://opensource.org/licenses/MIT +# +# Please preserve changelog entries +# -# phpci (uses namespacing) -%global php_min_ver 5.3.0 +%global github_owner tchwork +%global github_name jsqueeze +%global github_version 2.0.5 +%global github_commit 693d64850eab2ce6a7c8f7cf547e1ab46e69d542 -Name: php-%{packagist_owner}-%{packagist_name} +%global composer_vendor patchwork +%global composer_project jsqueeze + +# "php": ">=5.3.0" +%global php_min_ver 5.3.0 + +%if 0%{?fedora} +%bcond_without tests +%else +%bcond_with tests +%endif + +%{!?phpdir: %global phpdir %{_datadir}/php} + +Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 1%{?dist} +Release: 22%{?dist} Summary: Efficient JavaScript minification -Group: Development/Libraries -License: ASL 2.0 or GPLv2 +# Automatically converted from old format: ASL 2.0 or GPLv2 - review is highly recommended. +License: Apache-2.0 OR GPL-2.0-only URL: https://github.com/%{github_owner}/%{github_name} -# Must use commit-based not tag-based github tarball: -# https://fedoraproject.org/wiki/Packaging:SourceURL#Github -Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{github_name}-%{github_commit}.tar.gz + +# GitHub export does not include tests. +# Run php-patchwork-jsqueeze-get-source.sh to create full source. +Source0: %{name}-%{github_version}-%{github_commit}.tar.gz +Source1: %{name}-get-source.sh + BuildArch: noarch -# For tests +# Autoloader +BuildRequires: %{_bindir}/phpab +# Tests +%if %{with tests} +## composer.json BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: %{_bindir}/phpunit +BuildRequires: phpunit9 +## phpcompatinfo (computed from version 2.0.5) +BuildRequires: php-pcre +%endif Requires: php(language) >= %{php_min_ver} +# phpcompatinfo (computed from version 2.0.5) Requires: php-pcre -Provides: php-composer(%{packagist_owner}/%{packagist_name}) = %{version} +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description JSqueeze shrinks / compresses / minifies / mangles Javascript code. + It's a single PHP class that is developed, maintained and thoroughly tested since 2003 on major JavaScript frameworks (e.g. jQuery). @@ -42,33 +74,131 @@ semi-colons are missing. In term of compression ratio, it compares to YUI Compressor and UglifyJS. +Autoloader: %{phpdir}/Patchwork/autoload-jsqueeze.php + %prep %setup -qn %{github_name}-%{github_commit} %build -# Empty build section, nothing required +: Generate autoloader +%{_bindir}/phpab --output src/autoload-jsqueeze.php src/ +cat src/autoload-jsqueeze.php %install -# use PSR-0 layout relative to _datadir/php -mkdir -p %{buildroot}%{_datadir}/php/%{psr4_namespace} -cp -pr src/* %{buildroot}%{_datadir}/php/%{psr4_namespace} +mkdir -p %{buildroot}%{phpdir}/Patchwork +cp -pr src/* %{buildroot}%{phpdir}/Patchwork/ %check -%{_bindir}/phpunit +%if %{with tests} +: Create tests autoloader +cat << 'EOF' | tee tests/bootstrap.php + - 2.0.5-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Sat Jan 18 2025 Fedora Release Engineering - 2.0.5-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Wed Aug 7 2024 Miroslav Suchý - 2.0.5-20 +- convert license to SPDX + +* Fri Jul 19 2024 Fedora Release Engineering - 2.0.5-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Thu Jan 25 2024 Fedora Release Engineering - 2.0.5-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Jan 21 2024 Fedora Release Engineering - 2.0.5-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jul 21 2023 Fedora Release Engineering - 2.0.5-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Fri Jan 20 2023 Fedora Release Engineering - 2.0.5-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Fri Jul 22 2022 Fedora Release Engineering - 2.0.5-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Fri Jan 21 2022 Fedora Release Engineering - 2.0.5-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Wed Dec 8 2021 Remi Collet - 2.0.5-12 +- disable test suite on EL +- switch to phpunit9 + +* Fri Jul 23 2021 Fedora Release Engineering - 2.0.5-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Wed Jan 27 2021 Fedora Release Engineering - 2.0.5-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 2.0.5-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Thu Jan 30 2020 Fedora Release Engineering - 2.0.5-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Fri Jul 26 2019 Fedora Release Engineering - 2.0.5-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sat Feb 02 2019 Fedora Release Engineering - 2.0.5-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jul 13 2018 Fedora Release Engineering - 2.0.5-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Fri Feb 09 2018 Fedora Release Engineering - 2.0.5-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 2.0.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 2.0.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Oct 10 2016 Shawn Iwinski - 2.0.5-1 +- Update to 2.0.5 (RHBZ #1383300, #1383302) +- Add spec license + +* Thu Feb 04 2016 Fedora Release Engineering - 2.0.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Thu Jun 18 2015 Fedora Release Engineering - 2.0.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + * Sat Apr 25 2015 Adam Williamson - 2.0.2-1 - new release 2.0.2 diff --git a/sources b/sources index 8e3aaea..026693c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -1c8e4c7782b91338a14a4e7512871521 jsqueeze-2e581762884cfd035d9b148794ef2a4ab2c3b893.tar.gz +a2dd061e258734851f5fc20832bd096e php-patchwork-jsqueeze-2.0.5-693d64850eab2ce6a7c8f7cf547e1ab46e69d542.tar.gz