File: rules

package info (click to toggle)
symfony 7.3.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 129,560 kB
  • sloc: php: 1,503,693; xml: 6,816; javascript: 1,043; sh: 586; makefile: 241; pascal: 70
file content (233 lines) | stat: -rwxr-xr-x 11,755 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#!/usr/bin/make -f

include /usr/share/dpkg/default.mk
UPSTREAM := $(DEB_VERSION_UPSTREAM)

%:
	dh $@

override_dh_auto_build:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	# Check if licenses of all images are properly covered in d/copyright
	./debian/licensing/bin/check_image_licenses --check
else
	@echo "** image license check disabled"
endif
	phpab \
		--template debian/autoload.php.tpl \
		--output src/Symfony/autoload.php \
		src/Symfony/Bundle/FullStack.php
	mkdir --parents debian/packages_to_build debian/autoloaders
	# Walk through the parts of upstream's code that should be packaged into
	# separate Debian binary packages and write down a package-to-build info
	# file containing shell variables for each package.
	# Those files will be traverse later on in different targets of this
	# makefile (debian/rules). They solely exists to not repeat the extraction
	# of those variables in each of those target over and over again.
	# Then, build a class loader for the package, using the template in
	# debian/$deb_pkg_name.autoload.php.tpl if it exists (to load dependencies).
	set -e;\
	 for src_path in $$(find src/Symfony/ -mindepth 2 -maxdepth 4 -type d); do \
	  if [ -e $$src_path/composer.json ]; then \
	   pkg_path=$${src_path#src/Symfony/}; \
	   deb_pkg_name=php-$$(cat $$src_path/composer.json | jq -r '.name | tostring' | sed -r 's|/|-|'); \
	   if [ $$(grep -c -E -e "^Package: $$deb_pkg_name\$$" debian/control) -ne 1 ]; then \
	    echo "W: No Debian package '$$deb_pkg_name' defined in debian/control," 1>&2; \
	    echo "   therefor not considering Symfony $$pkg_path," 1>&2; \
	    continue; \
	   fi; \
	   echo "# This file contains some variables sourced" > debian/packages_to_build/$$deb_pkg_name; \
	   echo "# by various targets in debian/rules" >> debian/packages_to_build/$$deb_pkg_name; \
	   echo "deb_pkg_name='$$deb_pkg_name'" >> debian/packages_to_build/$$deb_pkg_name; \
	   echo "src_path='$$src_path'" >> debian/packages_to_build/$$deb_pkg_name; \
	   echo "pkg_path='$$pkg_path'" >> debian/packages_to_build/$$deb_pkg_name; \
	   echo "symfony $${deb_pkg_name#php-symfony-} Symfony/$$pkg_path/autoload.php" > debian/autoloaders/$$deb_pkg_name; \
	   if [ \( $$deb_pkg_name = php-symfony-mailer \) -o \
		\( $$deb_pkg_name = php-symfony-messenger \) -o \
		\( $$deb_pkg_name = php-symfony-notifier \) -o \
		\( $$deb_pkg_name = php-symfony-translation \) ] ; then \
	    phpab --output $$src_path/autoload.php \
		--blacklist '*\\tests\\*' \
		--blacklist '*\\bridge\\*' \
		--exclude 'src/Symfony/Component/Messenger/Tests/Exception/HandlerFailedExceptionTest.php' \
		--whitelist 'symfony\\*' \
		--template debian/$$deb_pkg_name.autoload.php.tpl \
		$$src_path; \
	   else \
	    phpab --output $$src_path/autoload.php \
		--blacklist '*\\tests\\*' \
		--blacklist 'symfony\\config\\*' \
		--exclude 'src/Symfony/Bridge/Doctrine/Tests/ArgumentResolver/EntityValueResolverTest.php' \
		--exclude 'src/Symfony/Bridge/Doctrine/Tests/Fixtures/DoctrineLoaderEmbed.php' \
		--exclude 'src/Symfony/Bridge/Doctrine/Tests/Fixtures/DoctrineLoaderEntity.php' \
		--exclude 'src/Symfony/Bridge/Doctrine/Tests/Fixtures/EmbeddedIdentifierEntity.php' \
		--exclude 'src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineWithEmbedded.php' \
		--exclude 'src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/Fixtures/proxy-implem.php' \
		--exclude 'src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/*' \
		--exclude 'src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php' \
		--exclude 'src/Symfony/Component/Routing/Tests/Fixtures/AttributesFixtures/*' \
		--whitelist 'symfony\\*' \
		--tolerant \
		--template debian/$$deb_pkg_name.autoload.php.tpl \
		$$src_path; \
	   fi; \
	  fi; \
	 done

override_dh_auto_test:
	mkdir --parents vendor build
	cp -r src/Symfony build
	sed -i "s/@VERSION@/$(UPSTREAM)/;s/\+dfsg//" \
		$(CURDIR)/build/Symfony/Bundle/DebugBundle/DependencyInjection/Configuration.php \
		$(CURDIR)/build/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php \
                $(CURDIR)/build/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php \
                $(CURDIR)/build/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php \
                $(CURDIR)/build/Symfony/Bundle/WebProfilerBundle/DependencyInjection/Configuration.php
	rm -r build/Symfony/Contracts
	cp debian/autoload_runtime.php vendor
	phpab	--output vendor/autoload.php \
		--whitelist '*\\tests\\*' \
		--tolerant \
		--template debian/autoload.php.tests.tpl \
		--blacklist 'symfony\\component\\dependencyinjection\\tests\\fixtures\\container\\projectservicecontainer' \
		--exclude 'build/Symfony/Bridge/Doctrine/Tests/ArgumentResolver/EntityValueResolverTest.php' \
		--exclude 'build/Symfony/Bridge/Doctrine/Tests/Fixtures/DoctrineLoaderEmbed.php' \
		--exclude 'build/Symfony/Bridge/Doctrine/Tests/Fixtures/DoctrineLoaderEntity.php' \
		--exclude 'build/Symfony/Bridge/Doctrine/Tests/Fixtures/EmbeddedIdentifierEntity.php' \
		--exclude 'build/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineWithEmbedded.php' \
		--exclude 'build/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/Fixtures/proxy-implem.php' \
		--exclude 'build/Symfony/Component/DependencyInjection/Tests/Fixtures/php/*' \
		--exclude 'build/Symfony/Component/Messenger/Tests/Exception/HandlerFailedExceptionTest.php' \
		--exclude 'build/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php' \
		--exclude 'build/Symfony/Component/Routing/Tests/Fixtures/AttributesFixtures/*' \
		build/Symfony
	ln -s /usr/share/php/AsyncAws build
	ln -s /usr/share/php/Cache build
	ln -s /usr/share/php/Composer build
	ln -s /usr/share/php/Cron build
	ln -s /usr/share/php/Doctrine build
	ln -s /usr/share/php/Egulias build
	ln -s /usr/share/php/GuzzleHttp build
	ln -s /usr/share/php/Http build
	ln -s /usr/share/php/JoliCode build
	ln -s /usr/share/php/League build
	ln -s /usr/share/php/Masterminds build
	ln -s /usr/share/php/Monolog build
	ln -s /usr/share/php/Nyholm build
	ln -s /usr/share/php/PhpParser build
	ln -s /usr/share/php/Pheanstalk build
	ln -s /usr/share/php/phpDocumentor build
	ln -s /usr/share/php/PHPStan build
	ln -s /usr/share/php/PHPUnit build
	ln -s /usr/share/php/Predis build
	ln -s /usr/share/php/ProxyManager build
	ln -s /usr/share/php/Psr build
	ln -s /usr/share/php/Symfony/Contracts build/Symfony
	ln -s /usr/share/php/Symfony/Component/Mercure build/Symfony/Component
	ln -s /usr/share/php/Symfony/Component/Security/Acl build/Symfony/Component/Security
	ln -s /usr/share/php/Symfony/Polyfill build/Symfony
	ln -s /usr/share/php/Symfony/WebpackEncoreBundle build/Symfony
	ln -s /usr/share/php/Twig build
	ln -s build/Symfony .
	# Drop never ending testsuite with PHPUnit 11
	rm -f build/Symfony/Component/HttpKernel/phpunit.xml.dist
	rm -f build/Symfony/Component/RateLimiter/phpunit.xml.dist
	# Actual tests suite
	components=$$(find build/Symfony -mindepth 3 -maxdepth 4 -type f -name phpunit.xml.dist -printf '%h\n') && \
	 echo "$$components" | parallel --gnu --keep-order '/bin/echo -e "\\nRunning {} tests"; SYMFONY_DEPRECATIONS_HELPER=weak php -d assert.exception=1 -d zend.assertions=1 /usr/bin/phpunit --include build --colors=always --exclude-group jwt --exclude-group network --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group functional --exclude-group composer --exclude-group nophpunit11 {} || (/bin/echo -e "\\e[41mKO\\e[0m {}" && $$(exit 1));';

override_dh_phpcomposer:
	dh_phpcomposer --package=php-symfony --sourcedirectory=./
	# In debian/packages_to_build/ a file containing shell variables exists
	# for each package that should be build. Source one file after another
	# to make the shell variables available and run dh_phpcomposer for each
	# package.
	set -e;\
	 for package_info_file in $$(find debian/packages_to_build/ -mindepth 1 -maxdepth 1 -type f); do \
	  . $$package_info_file; \
	  dh_phpcomposer --package=$$deb_pkg_name --sourcedirectory=$$src_path; \
	 done

override_dh_install:
	dh_install --package=php-symfony
	# In debian/packages_to_build/ a file containing shell variables exists
	# for each package that should be build. Source one file after another
	# to make the shell variables available and run dh_install in order to
	# provide the PHP runtime code for each package.
	set -e; \
	 for package_info_file in $$(find debian/packages_to_build/ -mindepth 1 -maxdepth 1 -type f); do \
	  . $$package_info_file; \
	  dh_install --package=$$deb_pkg_name; \
	  dh_install --package=$$deb_pkg_name \
	      debian/autoloaders/$$deb_pkg_name usr/share/pkg-php-tools/autoloaders; \
	  if [ \( $$deb_pkg_name = php-symfony-mailer \) -o \
	       \( $$deb_pkg_name = php-symfony-messenger \) -o \
	       \( $$deb_pkg_name = php-symfony-notifier \) -o \
	       \( $$deb_pkg_name = php-symfony-translation \) ] ; then \
	   dh_install \
		-X.md \
		-Xcomposer.json \
		-XBridge \
		-XLICENSE \
		-Xphpunit.xml.dist \
		-XTests \
		--package=$$deb_pkg_name \
		$$src_path/* \
		usr/share/php/Symfony/$$pkg_path/; \
	  else \
	   dh_install \
		-X.git \
		-X.md \
		-Xcomposer.json \
		-XAssetMapper/Fixtures \
		-XLICENSE \
		-XResources/bin \
		-XResources/emoji \
		-XResources/meta \
		-Xphpunit.xml.dist \
		--package=$$deb_pkg_name \
		$$src_path/* \
		usr/share/php/Symfony/$$pkg_path/; \
	   find debian/$$deb_pkg_name -name bin -type d -print | xargs /bin/rm -rf; \
	   find debian/$$deb_pkg_name -name Tests -type d -print | xargs /bin/rm -rf; \
	   find debian/$$deb_pkg_name -name var -type d -print | xargs /bin/rm -rf; \
	  fi; \
	 done
	sed -i "s/@VERSION@/$(UPSTREAM)/;s/\+dfsg//" \
		$(CURDIR)/debian/php-symfony-debug-bundle/usr/share/php/Symfony/Bundle/DebugBundle/DependencyInjection/Configuration.php \
		$(CURDIR)/debian/php-symfony-framework-bundle/usr/share/php/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php \
                $(CURDIR)/debian/php-symfony-security-bundle/usr/share/php/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php \
                $(CURDIR)/debian/php-symfony-twig-bundle/usr/share/php/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php \
                $(CURDIR)/debian/php-symfony-web-profiler-bundle/usr/share/php/Symfony/Bundle/WebProfilerBundle/DependencyInjection/Configuration.php

execute_after_dh_installdocs:
	# In debian/packages_to_build/ a file containing shell variables exists
	# for each package that should be build. Source one file after another
	# to make the shell variables available and run dh_installdocs in order
	# to provide some basic documentation for each package.
	set -e; \
	 for package_info_file in $$(find debian/packages_to_build/ -mindepth 1 -maxdepth 1 -type f); do \
	  . $$package_info_file; \
	 done

execute_before_dh_installchangelogs:
	for i in $$(ls CHANGELOG-* -r); do cat $$i >> CHANGELOG && echo '' >> CHANGELOG; done

execute_after_dh_installchangelogs:
	# In debian/packages_to_build/ a file containing shell variables exists
	# for each package that should be build. Source one file after another
	# to make the shell variables available and run dh_installchangelogs in
	# order to provide upstream changelogs for each package.
	set -e; \
	 for package_info_file in $$(find debian/packages_to_build/ -mindepth 1 -maxdepth 1 -type f); do \
	  . $$package_info_file; \
	  if [ -f "$$src_path/CHANGELOG.md" ]; then \
	   dh_installchangelogs \
	    --package=$$deb_pkg_name \
	    $$src_path/CHANGELOG.md; \
	  elif [ -f "$$src_path/../CHANGELOG.md" ]; then \
	   dh_installchangelogs \
	    --package=$$deb_pkg_name \
	    $$src_path/../CHANGELOG.md; \
	  fi; \
	 done