[packages/php-symfony-ServiceContracts] Initial

arekm arekm at pld-linux.org
Sat Apr 4 00:18:16 CEST 2026


commit 4c5b1c96c850671725728031bd68c3f16e1f0828
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Apr 4 00:18:00 2026 +0200

    Initial

 php-symfony-ServiceContracts.spec | 94 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)
---
diff --git a/php-symfony-ServiceContracts.spec b/php-symfony-ServiceContracts.spec
new file mode 100644
index 0000000..b811a2a
--- /dev/null
+++ b/php-symfony-ServiceContracts.spec
@@ -0,0 +1,94 @@
+%define		php_min_version 8.1
+Summary:	Symfony Service Contracts - generic abstractions related to writing services
+Name:		php-symfony-ServiceContracts
+Version:	3.5.1
+Release:	1
+License:	MIT
+Group:		Development/Languages/PHP
+Source0:	https://github.com/symfony/service-contracts/archive/v%{version}/service-contracts-%{version}.tar.gz
+# Source0-md5:	2562f97535a36b6a20efa5f9d95f7078
+URL:		https://github.com/symfony/service-contracts
+BuildRequires:	/usr/bin/php
+BuildRequires:	php(tokenizer)
+BuildRequires:	rpmbuild(macros) >= 1.610
+Requires:	php(core) >= %{php_min_version}
+Requires:	php(spl)
+Requires:	php-dirs >= 1.6
+Requires:	php-psr-container >= 1.1
+Requires:	php-symfony-DeprecationContracts >= 2.5
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+A set of service-related abstractions extracted from the Symfony
+components. They can be used to build on semantics that the Symfony
+components rely on, such as service subscribers and resetable services.
+
+%prep
+%setup -q -n service-contracts-%{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(), '/Test/')) 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
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{php_data_dir}/Symfony/Contracts/Service
+cp -a *.php Attribute $RPM_BUILD_ROOT%{php_data_dir}/Symfony/Contracts/Service
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc CHANGELOG.md LICENSE README.md
+%dir %{php_data_dir}/Symfony/Contracts
+%dir %{php_data_dir}/Symfony/Contracts/Service
+%{php_data_dir}/Symfony/Contracts/Service/*.php
+%{php_data_dir}/Symfony/Contracts/Service/Attribute
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/php-symfony-ServiceContracts.git/commitdiff/4c5b1c96c850671725728031bd68c3f16e1f0828



More information about the pld-cvs-commit mailing list