-
Notifications
You must be signed in to change notification settings - Fork 0
/
rules
executable file
·584 lines (439 loc) · 17.6 KB
/
rules
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
#!/usr/bin/make -f
SHELL :=/bin/sh
.SHELLFLAGS :=-ec
MAKEFLAGS += --no-print-directory
export DH_VERBOSE := 1
include /usr/share/dpkg/default.mk
# Ubuntu mangles png files by default, which can break some files.
export NO_PNG_PKG_MANGLE := 1
# handles DATE and TIME in Modules/getbuildinfo.c
export SOURCE_DATE_EPOCH
include debian/rules.pkg-info
PYTHON_VERSION ?= $(DEB_VERSION_UPSTREAM)
empty :=
space :=$(empty) $(empty)
comma :=,
xsedx :=$(shell printf '\027')
PYTHON_MAJOR_VERSION = $(word 1,$(subst .,$(space),$(PYTHON_VERSION)))
PYTHON_MINOR_VERSION = $(word 2,$(subst .,$(space),$(PYTHON_VERSION)))
PYTHON_BASE_VERSION = $(PYTHON_MAJOR_VERSION).$(PYTHON_MINOR_VERSION)
DEB_PYTHON_PRIO = $(shell printf '1%03d%03d0' $(PYTHON_MAJOR_VERSION) $(PYTHON_MINOR_VERSION))
PYTHON_PREFIX = opt/python-$(PYTHON_BASE_VERSION)
PYTHON_BINARY = usr/bin/python-$(PYTHON_BASE_VERSION)
PYTHON_MODULES = $(PYTHON_PREFIX)/lib/python$(PYTHON_BASE_VERSION)
export DEB_BUILD_CONTAINER_PYTHON=1
include debian/rules.ver
ifneq ($(DEB_HOST_ARCH_OS),linux)
$(warning unhandled operating system name: $(DEB_HOST_ARCH_OS))
endif
distribution = $(if $(filter Ubuntu,$(DEB_VENDOR) $(DEB_PARENT_VENDOR)),Ubuntu,Debian)
distrelease = $(shell sed -En '/^VERSION_CODENAME=(.+)$$/s//\1/p' /etc/os-release)
NPROC_MAKE := $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NPROC_MAKE := $(if $(NPROC_MAKE),$(NPROC_MAKE),$(shell nproc))
NPROC_TEST := $(shell echo "$$(( ( $(NPROC_MAKE) + 1 ) / 2 ))")
ifeq ($(distribution),Ubuntu)
# test_ssl assumes that openssl is compiled with security level set to 1
# make it so, during the build
export OPENSSL_CONF = $(CURDIR)/debian/tests/openssl.cnf
endif
include debian/rules.gcc-latest-ver
include debian/rules.gcc-flags
include debian/rules.gcc-lto
include debian/rules.gcc-pgo
build_dir = $(CURDIR)/debian.build
INSTALL_SHARED = $(CURDIR)/debian/tmp.shared
export HOME = $(CURDIR)/debian/tmp.home
include debian/rules.postconf
CONFIGURE_FLAGS = \
--prefix=/$(PYTHON_PREFIX) \
--build=$(DEB_HOST_MULTIARCH) \
--sysconfdir=/etc \
--localstatedir=/var \
--runstatedir=/run \
--disable-option-checking \
--disable-silent-rules \
--disable-maintainer-mode \
--disable-dependency-tracking \
--enable-ipv6 \
--with-computed-gotos \
--with-system-expat \
--with-system-ffi \
--enable-loadable-sqlite-extensions \
--with-dbmliborder=bdb:gdbm \
--with-ssl-default-suites=openssl \
CONFIGURE_FLAGS_SHARED = \
--enable-shared \
CONFIGURE_FLAGS_BINARY = \
$(if $(filter yes,$(with_lto)),--with-lto) \
$(if $(filter yes,$(with_pgo)),--enable-optimizations) \
config_site = \
ac_cv_file__dev_ptmx=yes \
ac_cv_file__dev_ptc=yes \
ac_cv_posix_semaphores_enabled=yes \
export SSL_CERT_FILE = /etc/ssl/certs/ca-certificates.crt
export REQUESTS_CA_BUNDLE = /etc/ssl/certs/ca-certificates.crt
PIP_CONF = $(word 1,$(wildcard debian/pip.conf.local) debian/pip.conf)
export PIP_CONFIG_FILE = $(CURDIR)/$(PIP_CONF)
# $1 = PYTHONHOME
# $2 = library subdirectory (may be empty)
x_python_LD_LIBRARY_PATH = $(1)$(if $(2),/$(2))$(if $(LD_LIBRARY_PATH),:$(LD_LIBRARY_PATH))
# $1 = PYTHONHOME
# $2 = library subdirectory (may be empty)
# $3 = path to binary
# $4 - wrapper cmd
x_python = env \
LD_LIBRARY_PATH='$(call x_python_LD_LIBRARY_PATH,$(strip $(1)),$(strip $(2)))' \
PYTHONHOME='$(strip $(1))' \
PATH='$(dir $(strip $(1))/$(strip $(3))):$(PATH)' \
$(strip $(4)) $(strip $(1))/$(strip $(3))
# TEST_OPTS and TEST_EXCLUDES are defined here
include debian/rules.tests
ifneq (,$(wildcard debian/rules.local))
include debian/rules.local
endif
.NOTPARALLEL:
DH_ARGS = --sourcedir=$(CURDIR) --builddir=$(build_dir)
%:
dh $@ --buildsystem=autoconf
override_dh_autoreconf:
dh_autoreconf autoreconf -- -fiv -Werror
execute_before_dh_auto_configure:
: # verify that we' having "right" gcc version
@echo '# CC = $(CC)' >&2
@$(CC) --version 2>&1 | head -n 1 >&2
: # verify CFLAGS
@echo "# CFLAGS = $${CFLAGS}" >&2
: # verify DEB_BUILD_OPTIONS
@echo "# DEB_BUILD_OPTIONS = $${DEB_BUILD_OPTIONS}" >&2
override_dh_auto_configure:
mkdir -p $(HOME)
define deb_python_configure
rm -rf $(build_dir) ; mkdir -p $(build_dir)
cd $(build_dir) ; \
OPT=' ' \
MKDIR_P='/bin/mkdir -p' \
$(config_site) \
env -u LD_LIBRARY_PATH -u LD_PRELOAD \
$(CURDIR)/configure \
$(CONFIGURE_FLAGS) \
$(strip $(1))
$(call deb_python_postconf)
sed -i -E \
-e 's$(xsedx)^RUNSHARED[[:space:]]*=[[:space:]]*(.*)$$$(xsedx)RUNSHARED = LD_PRELOAD= \1$(xsedx)' \
$(build_dir)/Makefile
endef
test_python = $(call x_python, $(build_dir) , , python , env -u PYTHONHOME )
define deb_python_build
CONTAINER_PYTHON_COMPAT=1 \
dh_auto_build $(DH_ARGS)
$(test_python) -c 'from _multiprocessing import SemLock' || true
$(test_python) -c 'import _decimal'
$(test_python) -c 'import math, cmath'
: # verify site packages paths
$(test_python) -c 'import site; print(site.getusersitepackages())'
$(test_python) -c 'import site; print(site.getsitepackages())'
$(test_python) -m site
endef
define deb_python_test
CONTAINER_PYTHON_COMPAT=1 \
NPROC=$(NPROC_TEST) \
dh_auto_test $(DH_ARGS) -- TESTOPTS='-j $(NPROC_TEST) $(TEST_OPTS)'
endef
define remove_pycache
: # $(strip $(1)): remove Python cache
find $(strip $(1))/ -name __pycache__ -type d -exec rm -rf '{}' '+'
find $(strip $(1))/ -name '*.py[co]' -ls -delete
endef
define fix_hashbangs_r
hashbang_rx='#!.*[/ ]python[^ ]*' ; \
list='$(strip $(1)).hashbang' ; \
find '$(strip $(1))/' -type f -exec grep -EIl "$${hashbang_rx}" '{}' '+' \
> "$${list}" || : ; \
if [ -s "$${list}" ] ; then \
while read -r f ; do \
[ -n "$$f" ] || continue ; \
x_flag=1 ; \
[ -x "$$f" ] || x_flag= ; \
sed -E "1s$(xsedx)$${hashbang_rx}$(xsedx)#!/$(PYTHON_BINARY)$(xsedx)" \
< "$$f" > "$${list}.tmp" ; \
if ! cmp -s "$${list}.tmp" "$$f" ; then \
echo "# fixed hashbang: $$f" ; \
mv -f "$${list}.tmp" "$$f" ; \
fi ; \
if [ -z "$${x_flag}" ] ; then \
echo "# fixed permissions: $$f" ; \
fi ; \
chmod 0755 "$$f" ; \
done < "$${list}" >&2 ; \
rm -f "$${list}.tmp" ; \
fi ; \
rm -f "$${list}"
endef
replace_string = -e "s/ $(1) / $(2) /g;s/ $(1)/ $(2)/g;s/$(1) /$(2) /g;s/$(1)/$(2)/g"
remove_string = -e "s/ $(1) / $(2)/g;s/ $(1)/ $(2)/g;s/$(1) /$(2) /g;s/$(1)/$(2)/g"
replace_prefixed = $(call replace_string,$(1)[^[:space:]\"']*,$(2))
remove_prefixed = $(call replace_prefixed,$(1)[^[:space:]\"']*,)
fake_srcdir =/usr/local/src/python-$(DEB_VERSION_UPSTREAM)
define buildrepro_backup
mkdir -p $(shell printf '%s' '$(dir $(strip $(1)))' | sed -zE 's,^debian/[^/]+/,debian/dist.orig/,')
cp $(strip $(1)) $(shell printf '%s' '$(strip $(1))' | sed -zE 's,^debian/[^/]+/,debian/dist.orig/,')
endef
# TODO: re-sync periodically with "sysconfig_substflags" in Debian
define buildrepro_fix
sed -i \
-e 's|$(CC)|$(DEB_HOST_GNU_TYPE)-gcc|g' \
-e 's|$(CC)|$(DEB_HOST_GNU_TYPE)-gcc|g' \
-e 's|$(CXX)|$(DEB_HOST_GNU_TYPE)-g++|g' \
-e 's|$(AR)|$(DEB_HOST_GNU_TYPE)-gcc-ar|g' \
-e 's|$(RANLIB)|$(DEB_HOST_GNU_TYPE)-gcc-ranlib|g' \
$(strip $(1))
sed -i -E \
$(call remove_prefixed,LD_LIBRARY_PATH=) \
$(call remove_prefixed,-f(debug|file|macro|profile)-prefix-map=) \
$(call remove_prefixed,-fprofile-dir=) \
$(call replace_prefixed,-fstack-protector,-fstack-protector-strong) \
$(call replace_string,-fstack-protector-strong-strong,-fstack-protector-strong) \
$(call remove_prefixed,--param=ssp-buffer-size=) \
$(call remove_prefixed,-specs=) \
$(call remove_string,-Wl$(comma)-z$(comma)now) \
$(call remove_string,-L\.) \
$(call replace_string,-Wl$(comma)-z$(comma)relro +-Wl$(comma)-z$(comma)relro,-Wl$(comma)-z$(comma)relro) \
-e 's/^RUNSHARED\s*=.*$$/RUNSHARED=/g' \
$(strip $(1))
sed -i \
-e 's|$(build_dir)/..|$(fake_srcdir)|g' \
-e 's|$(CURDIR)|$(fake_srcdir)|g' \
$(strip $(1))
endef
define buildrepro_compare
mkdir -p $(shell printf '%s' '$(dir $(strip $(1)))' | sed -zE 's,^debian/[^/]+/,debian/dist/,')
cp $(strip $(1)) $(shell printf '%s' '$(strip $(1))' | sed -zE 's,^debian/[^/]+/,debian/dist/,')
set +e ; diff -Naru --color \
$(shell printf '%s' '$(strip $(1))' | sed -zE 's,^debian/[^/]+/,debian/dist.orig/,') \
$(shell printf '%s' '$(strip $(1))' | sed -zE 's,^debian/[^/]+/,debian/dist/,') \
|| :
endef
# "aio" stands for "all-in-one"
define buildrepro_aio
$(call buildrepro_backup,$(strip $(1)))
$(call buildrepro_fix,$(strip $(1)))
$(call buildrepro_compare,$(strip $(1)))
endef
sysconfig_file = debian/tmp/$(PYTHON_MODULES)/_sysconfigdata__$(DEB_HOST_MULTIARCH).py
limb_python = $(call x_python, $(CURDIR)/debian/tmp/$(PYTHON_PREFIX) , lib , bin/python$(PYTHON_BASE_VERSION) , fakeroot )
define deb_python_install
dh_auto_install $(DH_ARGS)
$(call remove_pycache, debian/tmp )
: # remove manpages
rm -rf debian/tmp/$(PYTHON_PREFIX)/share/man/
: # preserve only small part of builtin testsuite
d='debian/tmp/$(PYTHON_MODULES)/test' ; \
rm -f debian/test.tar ; \
find "$$d/" -regextype egrep \
-regex '.+/test/(libregrtest|support|(__.+|ann_module.*|regrtest|test_support)\.py)$$' \
-exec tar -cvf debian/test.tar '{}' '+' ; \
rm -rf "$$d"
: # remove builtin testsuite
d='debian/tmp/$(PYTHON_PREFIX)' ; \
find "$$d/" -path '*/lib/*/test' -type d -exec rm -rf '{}' '+' ; \
find "$$d/" -path '*/lib/*/tests' -type d -exec rm -rf '{}' '+'
: # restore builtin testsuite
tar -xf debian/test.tar ; \
rm -f debian/test.tar
: # copy pip.conf
mkdir -p debian/tmp/$(PYTHON_PREFIX)/share
cp $(PIP_CONF) debian/tmp/$(PYTHON_PREFIX)/share/pip.conf
: # remove non-fully versioned symlinks
find debian/tmp/ -path '*/bin/*' -type l -exec rm -vf '{}' '+'
find debian/tmp/ -path '*/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/*' -type l -exec rm -vf '{}' '+'
: # file name mangling
cd debian/tmp/$(PYTHON_PREFIX)/bin ; \
mv python$(PYTHON_BASE_VERSION) python ; \
ln -s python python$(PYTHON_BASE_VERSION) ; \
ln -s python python$(PYTHON_MAJOR_VERSION) ; \
mv pydoc$(PYTHON_BASE_VERSION) pydoc ; \
ln -s pydoc pydoc$(PYTHON_BASE_VERSION) ; \
ln -s pydoc pydoc$(PYTHON_MAJOR_VERSION) ; \
mv 2to3-$(PYTHON_BASE_VERSION) 2to3 ; \
ln -s 2to3 2to3-$(PYTHON_BASE_VERSION) ; \
mv python$(PYTHON_BASE_VERSION)-config python-config ; \
ln -s python-config python$(PYTHON_BASE_VERSION)-config ; \
ln -s python-config python$(PYTHON_MAJOR_VERSION)-config ; \
ln -s python-config $(DEB_HOST_MULTIARCH)-python$(PYTHON_BASE_VERSION)-config ; \
ln -s python-config $(DEB_HOST_MULTIARCH)-python$(PYTHON_MAJOR_VERSION)-config ; \
mv idle$(PYTHON_BASE_VERSION) idle ; \
ln -s idle idle$(PYTHON_BASE_VERSION) ; \
ln -s idle idle$(PYTHON_MAJOR_VERSION)
rm -rf debian/dist debian/dist.orig
$(call buildrepro_aio, debian/tmp/$(PYTHON_PREFIX)/bin/python-config )
$(call buildrepro_aio, debian/tmp/$(PYTHON_MODULES)/config-$(PYTHON_BASE_VERSION)-$(DEB_HOST_MULTIARCH)/config.c )
$(call buildrepro_aio, debian/tmp/$(PYTHON_MODULES)/config-$(PYTHON_BASE_VERSION)-$(DEB_HOST_MULTIARCH)/Makefile )
$(call buildrepro_backup, $(sysconfig_file) )
: # adjust sysconfigdata
cat \
debian/regen-sysconfigdata.py.pre \
$(sysconfig_file) \
debian/regen-sysconfigdata.py.post \
> debian/tmp/regen-sysconfigdata.py
$(limb_python) debian/tmp/regen-sysconfigdata.py \
$(sysconfig_file)
rm -f debian/tmp/regen-sysconfigdata.py
$(call buildrepro_fix, $(sysconfig_file) )
sed -i -E \
-e 's/ +/ /g' \
$(sysconfig_file)
$(call buildrepro_compare, $(sysconfig_file) )
: # list installed packages
$(limb_python) -m pip list --format json \
> debian/pip.list.json
: # upgrade installed packages
$(limb_python) -m pip install --upgrade \
$$(jq -r '.[].name' < debian/pip.list.json)
: # install wheel
$(limb_python) -m pip install wheel
: # list installed packages (refreshing version info)
$(limb_python) -m pip list --format json \
> debian/pip.list.json
: # produce list of individual installed packages
jq -r '.[] | "pipver:" + .name + "=" + .version' \
< debian/pip.list.json \
> debian/pip.substvars
: # adjust ensurepip: package versions
ver_pip=$$(jq -r '.[] | select(.name=="pip") | .version' < debian/pip.list.json) ; \
ver_setuptools=$$(jq -r '.[] | select(.name=="setuptools") | .version' < debian/pip.list.json) ; \
sed -i -E \
-e 's/^_PIP_VERSION\s*=\s*.+/_PIP_VERSION = "'"$${ver_pip}"'"/' \
-e 's/^_SETUPTOOLS_VERSION\s*=\s*.+/_SETUPTOOLS_VERSION = "'"$${ver_setuptools}"'"/' \
debian/tmp/$(PYTHON_MODULES)/ensurepip/__init__.py
$(call remove_pycache, $(if $(strip $(1)),$(strip $(1)),$(CURDIR)/debian/tmp) )
: # file name mangling
cd debian/tmp/$(PYTHON_PREFIX)/bin ; \
mv pip$(PYTHON_BASE_VERSION) safe.pip ; \
find ./ -name 'pip*' -ls -delete ; \
mv safe.pip pip ; \
ln -s pip pip$(PYTHON_BASE_VERSION) ; \
ln -s pip pip$(PYTHON_MAJOR_VERSION) ; \
mv wheel safe.wheel ; \
find ./ -name 'wheel*' -ls -delete ; \
mv safe.wheel wheel ; \
ln -s wheel wheel$(PYTHON_BASE_VERSION) ; \
ln -s wheel wheel$(PYTHON_MAJOR_VERSION)
: # adjustments after ensurepip/pip
d='debian/tmp/$(PYTHON_MODULES)' ; \
src="$$d/site-packages" ; \
dst="$$d/dist-packages" ; \
mv "$${src}" "$${dst}" ; \
mkdir -p "$${src}" ; \
mv "$${dst}/README.txt" "$${src}/"
$(call fix_hashbangs_r, debian/tmp )
endef
shared_python = $(call x_python, $(INSTALL_SHARED)/$(PYTHON_PREFIX) , lib , bin/python$(PYTHON_BASE_VERSION) , fakeroot )
override_dh_auto_build:
$(call deb_python_configure, $(CONFIGURE_FLAGS_SHARED) )
$(call deb_python_build)
rm -rf debian/tmp $(INSTALL_SHARED)
$(call deb_python_install)
: # adjust ensurepip: download fresh wheels
wheel_dir='debian/tmp/$(PYTHON_MODULES)/ensurepip/_bundled' ; \
find "$${wheel_dir}/" -name '*.whl' -ls -delete ; \
jq -r '.[] | .name + " " + .version' < debian/pip.list.json \
| while read -r name version ; do \
[ -n "$${name}" ] || continue ; \
[ -n "$${version}" ] || continue ; \
env -C "$${wheel_dir}" $(limb_python) -m pip download "$${name}==$${version}" ; \
done ; \
find "$${wheel_dir}/" -name '*.whl' -ls
: # preserve shared install
mv debian/tmp $(INSTALL_SHARED)
: # minor hack for shared python
top='$(INSTALL_SHARED)/$(PYTHON_MODULES)' ; \
src="$${top}/dist-packages" ; \
dst="$${top}/site-packages" ; \
rm -rf "$${dst}" ; \
mv "$${src}" "$${dst}"
ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
$(shared_python) -m pip install $(CURDIR)/python-pyperformance
endif
$(call remove_pycache, $(CURDIR) )
: # propagate modified "ensurepip" to sources
rm -rf Lib/ensurepip ; \
tar -C $(INSTALL_SHARED)/$(PYTHON_MODULES) -cf - ensurepip \
| tar -C Lib -xf -
$(call deb_python_configure, $(CONFIGURE_FLAGS_BINARY) )
ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
$(shared_python) -m compileall -q $(INSTALL_SHARED)/
f='$(build_dir)/pyperformance.sh' ; \
: > "$$f" ; \
echo '#!/bin/sh' >> "$$f" ; \
echo 'exec $(shared_python) -m pyperformance "$$@"' >> "$$f" ; \
chmod 0755 "$$f"
endif
$(call deb_python_build)
override_dh_auto_test:
$(call deb_python_test)
override_dh_auto_install:
$(call deb_python_install)
$(call remove_pycache, $(CURDIR) )
: # unpatch Python (consult hybrid-layout.patch)
grep -FRl -e DEB_BUILD_CONTAINER_PYTHON debian/tmp/ \
| xargs -t -r sed -i "s, or ('DEB_BUILD_CONTAINER_PYTHON' in os.environ),,"
: # remove versioned symlinks
find debian/tmp/ -path '*/bin/*' -type l -exec rm -vf '{}' '+'
: # copy shared library
cp $(INSTALL_SHARED)/$(PYTHON_PREFIX)/lib/libpython$(PYTHON_BASE_VERSION).so.$(PYTHON_SO_ABI) \
debian/tmp/$(PYTHON_PREFIX)/lib/
execute_before_dh_install:
chmod +x debian/thin-ci.sh
include debian/rules.install-extras
override_dh_install:
dh_install -p thin-ci-container-python-$(PYTHON_BASE_VERSION)
$(call dh_install_move, container-python-$(PYTHON_BASE_VERSION)-misc )
$(call dh_install_move, container-python-$(PYTHON_BASE_VERSION)-dev )
$(call dh_install_move, container-python-$(PYTHON_BASE_VERSION)-full )
$(call dh_install_move, container-python-$(PYTHON_BASE_VERSION) )
: # move non-native platform files (if any)
s=debian/container-python-$(PYTHON_BASE_VERSION)-full ; \
d=debian/container-python-$(PYTHON_BASE_VERSION)-misc ; \
if find $$s/ -iname '*.exe' -printf . -quit | grep -Fq . ; then \
find $$s/ -iname '*.exe' -printf '%P\0' \
| tar -C $$s --null -T - -cf - \
| tar -C $$d -xf - ; \
find $$s/ -iname '*.exe' -delete ; \
fi
# if there're files left - dh_missing will do the job (raise error)
override_dh_strip_nondeterminism:
dh_strip_nondeterminism $(addprefix --exclude=,.exe .png .whl)
execute_after_dh_fixperms:
find debian/ -path '*/bin/*' -type f -exec chmod 0755 '{}' +
find debian/ -path '*/share/thin-ci.sh' -type f -exec chmod 0755 '{}' +
override_dh_dwz:
dh_dwz $(addprefix --exclude=,.exe)
override_dh_strip:
dh_strip $(addprefix --exclude=,.exe)
override_dh_gencontrol:
dh_gencontrol -- -Tdebian/pip.substvars -Tdebian/substvars
# sync with Debian (periodically)
execute_before_dh_builddeb:
set +e ; \
find $(foreach p, $(shell dh_listpackages), debian/$(p)/ ) -type f \
-exec grep -aFl -e '$(CURDIR)' '{}' '+' \
| sort -V > debian/build.reproducible ; \
if [ -s debian/build.reproducible ] ; then \
echo ; \
echo '# detected build path leakage in files:' ; \
echo ; \
cat debian/build.reproducible ; \
echo ; \
fi >&2 ; \
find $(foreach p, $(shell dh_listpackages), debian/$(p)/ ) -type f \
-exec grep -aEl -e '(LD_LIBRARY|LD_PRELOAD|fakeroot|eatmydata|f(debug|file|macro|profile)-prefix-map|flto|ffat-lto|fuse-linker-plugin|fprofile|param=ssp-buffer-size=4|specs=|Wl,-z,now)' '{}' '+' \
| sort -V > debian/build.reproducible ; \
if [ -s debian/build.reproducible ] ; then \
echo ; \
echo '# detected (possible) build env leakage in files:' ; \
echo ; \
cat debian/build.reproducible ; \
echo ; \
fi >&2 ; \
rm -f debian/build.reproducible
include debian/rules.selftemplate