[packages/php-symfony-String] Rel 2; use phpab
arekm
arekm at pld-linux.org
Thu Apr 16 00:29:37 CEST 2026
commit 75229d9d0101824400d8448b299adda2ee596348
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Apr 16 00:29:25 2026 +0200
Rel 2; use phpab
php-symfony-String.spec | 54 +++----------------------------------------------
1 file changed, 3 insertions(+), 51 deletions(-)
---
diff --git a/php-symfony-String.spec b/php-symfony-String.spec
index 600f69f..b7f83a0 100644
--- a/php-symfony-String.spec
+++ b/php-symfony-String.spec
@@ -3,14 +3,13 @@
Summary: Symfony String Component
Name: php-symfony-String
Version: 7.2.9
-Release: 1
+Release: 2
License: MIT
Group: Development/Languages/PHP
Source0: https://github.com/symfony/string/archive/v%{version}/string-%{version}.tar.gz
# Source0-md5: bbabb7bca5996a7b465adf264f9a0cac
URL: https://symfony.com/doc/current/components/string.html
-BuildRequires: /usr/bin/php
-BuildRequires: php(tokenizer)
+BuildRequires: phpab
BuildRequires: rpmbuild(macros) >= 1.610
Requires: php(core) >= %{php_min_version}
Requires: php(ctype)
@@ -31,54 +30,7 @@ way.
%setup -q -n string-%{version}
%build
-# generate classmap autoloader
-cat > gen_autoload.php <<'EOPHP'
-<?php
-$dir = getcwd();
-$map = [];
-$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
-foreach ($it as $f) {
- if ($f->getExtension() !== 'php') continue;
- if (str_contains($f->getPathname(), '/Tests/')) continue;
- if ($f->getFilename() === 'gen_autoload.php') continue;
- $rel = substr($f->getPathname(), strlen($dir));
- $tokens = token_get_all(file_get_contents($f->getPathname()));
- $ns = '';
- for ($i = 0; $i < count($tokens); $i++) {
- if (is_array($tokens[$i]) && $tokens[$i][0] === T_NAMESPACE) {
- $ns = '';
- for ($j = $i + 1; $j < count($tokens); $j++) {
- if (is_array($tokens[$j]) && in_array($tokens[$j][0], [T_NAME_QUALIFIED, T_STRING])) {
- $ns .= $tokens[$j][1];
- } elseif (is_array($tokens[$j]) && $tokens[$j][0] === T_WHITESPACE) {
- continue;
- } else {
- break;
- }
- }
- }
- if (is_array($tokens[$i]) && in_array($tokens[$i][0], [T_CLASS, T_INTERFACE, T_TRAIT, T_ENUM])) {
- for ($j = $i + 1; $j < count($tokens); $j++) {
- if (is_array($tokens[$j]) && $tokens[$j][0] === T_STRING) {
- $fqcn = $ns ? $ns . '\\' . $tokens[$j][1] : $tokens[$j][1];
- $map[$fqcn] = $rel;
- break;
- }
- }
- }
- }
-}
-ksort($map);
-$lines = [];
-foreach ($map as $class => $path) {
- $lines[] = "\t\t\t\t" . var_export($class, true) . ' => ' . var_export($path, true);
-}
-$out = "<?php\n// this is an autogenerated file - do not edit\nspl_autoload_register(\n\tfunction(\$class) {\n\t\tstatic \$classes = null;\n\t\tif (\$classes === null) {\n\t\t\t\$classes = array(\n" . implode(",\n", $lines) . ",\n\t\t\t);\n\t\t}\n\t\tif (isset(\$classes[\$class])) {\n\t\t\trequire __DIR__ . \$classes[\$class];\n\t\t}\n\t}\n);\n";
-file_put_contents('autoload.php', $out);
-echo "Generated autoload.php with " . count($map) . " classes\n";
-EOPHP
-php gen_autoload.php
-rm gen_autoload.php
+phpab -n -e '*/Tests/*' -o autoload.php .
%install
rm -rf $RPM_BUILD_ROOT
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/php-symfony-String.git/commitdiff/75229d9d0101824400d8448b299adda2ee596348
More information about the pld-cvs-commit
mailing list