Skip to content
Snippets Groups Projects
Commit cde02a32 authored by Stefano Rivera's avatar Stefano Rivera
Browse files

Architecture-qualify py*compile and py*clean calls in maintainer scripts, for...

Architecture-qualify py*compile and py*clean calls in maintainer scripts, for architecture-specific Python packages. This allows co-installation (and even concurrent unpacking) of different architectures of a package. (closes: 991146)
parent 600ac906
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,10 @@ dh-python (4.20201104) UNRELEASED; urgency=medium
* Generate python3:Depends from Requires-Dist entries in .dist-info (e.g.
flit packages). (closes: 987296)
* Suggest: flit, python3-toml. (closes: 987236)
* Architecture-qualify py*compile and py*clean calls in maintainer scripts,
for architecture-specific Python packages. This allows co-installation
(and even concurrent unpacking) of different architectures of a package.
(closes: 991146)
-- Piotr Ożarowski <piotr@debian.org> Wed, 04 Nov 2020 11:46:16 +0100
......
......@@ -20,7 +20,7 @@
import logging
import re
from os import makedirs, chmod
from os import makedirs, chmod, environ
from os.path import basename, exists, join, dirname
from sys import argv
from dhpython import DEPENDS_SUBSTVARS, PKG_NAME_TPLS, RT_LOCATIONS, RT_TPLS
......@@ -191,8 +191,11 @@ class DebHelper:
if self.options.compile_all and args:
# TODO: should args be checked to contain dir name?
tpl = tpl.replace('-p #PACKAGE#', '')
else:
elif settings['arch'] == 'all':
tpl = tpl.replace('#PACKAGE#', package)
else:
arch = environ['DEB_HOST_ARCH']
tpl = tpl.replace('#PACKAGE#', '%s:%s' % (package, arch))
tpl = tpl.replace('#ARGS#', i)
if tpl not in data and tpl not in new_data:
new_data += "\n%s" % tpl
......
......@@ -7,6 +7,7 @@ export DEBPYTHON3_SUPPORTED ?= $(shell python3 ../../dhpython/_defaults.py suppo
export DEBPYPY_DEFAULT ?= $(shell python3 ../../dhpython/_defaults.py default pypy)
export DEBPYPY_SUPPORTED ?= $(shell python3 ../../dhpython/_defaults.py supported pypy)
export DEB_HOST_MULTIARCH=my_multiarch-triplet
export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
all: run check
......
......@@ -13,6 +13,7 @@ check:
grep -qe "Depends: .*python2\(:any\)\? (<<" debian/python-foo/DEBIAN/control
[ "`readlink debian/python-foo/usr/lib/python$(DPY)/dist-packages/foo/absolute_link_to_tmp`" = "/tmp" ]
[ "`readlink debian/python-foo/usr/lib/python$(DPY)/dist-packages/foo/link_to_parent_dir`" = ".." ]
grep -q 'pycompile -p python-foo\s*$$' debian/python-foo/DEBIAN/postinst
clean: clean-common
rm -rf lib/Foo.egg-info
......@@ -7,5 +7,5 @@ check:
test -f debian/python-foo/usr/lib/python2.7/dist-packages/foo.py
test -f debian/python-foo/usr/lib/python2.7/dist-packages/bar/bar.py
test \! -f debian/python-foo/usr/lib/python2.7/dist-packages/tests/__init__.py
grep -q pycompile debian/python-foo/DEBIAN/postinst
grep -q pyclean debian/python-foo/DEBIAN/prerm
grep -q 'pycompile -p python-foo\s*$$' debian/python-foo/DEBIAN/postinst
grep -q 'pyclean -p python-foo\s*$$' debian/python-foo/DEBIAN/prerm
......@@ -7,8 +7,10 @@ TRIPLET=.$(DEB_HOST_MULTIARCH)
endif
check:
grep -q "pycompile -p python-foo /usr/lib/python-foo -V $(DPY)"\
grep -q "pycompile -p python-foo:$(DEB_HOST_ARCH) /usr/lib/python-foo -V $(DPY)"\
debian/python-foo/DEBIAN/postinst
grep -q "pyclean -p python-foo:$(DEB_HOST_ARCH) /usr/lib/python-foo -V $(DPY)"\
debian/python-foo/DEBIAN/prerm
test -f debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/bar$(TRIPLET).so
test ! -f debian/python-foo/usr/share/pyshared/foo/bar.so
test ! -f debian/python-foo/usr/share/pyshared/foo/bar$(TRIPLET).so
......
......@@ -12,8 +12,8 @@ check:
grep -q foo debian/python-foo/usr/share/python/ns/python-foo
grep -q bar.baz debian/python-foo/usr/share/python/ns/python-foo
grep -q keep_this_one debian/python-foo/usr/share/python/ns/python-foo && false || true
grep -q "pycompile -p python-foo" debian/python-foo/DEBIAN/postinst
grep -q "pyclean -p python-foo" debian/python-foo/DEBIAN/prerm
grep -q "pycompile -p python-foo\s*$$" debian/python-foo/DEBIAN/postinst
grep -q "pyclean -p python-foo\s*$$" debian/python-foo/DEBIAN/prerm
# test pycompile
# DESTDIR=debian/python-foo/ ../../pycompile -v debian/python-foo/usr/lib/
# set -e; for i in remove_this_one bar bar/baz;\
......
......@@ -6,6 +6,9 @@ check:
grep -q "Recommends: .*python3-mako" debian/python3-foo/DEBIAN/control
test -f debian/python3-foo/usr/lib/python3/dist-packages/foo/__init__.py
test ! -f debian/python3-foo/usr/lib/python3/dist-packages/foo/spam.py
grep -q 'py3compile -p python3-foo -V 3\.1-3\.9' debian/python3-foo/DEBIAN/postinst
grep -q 'pypy3compile -p python3-foo -V 3\.1-3\.9' debian/python3-foo/DEBIAN/postinst
grep -q 'py3clean -p python3-foo\s*$$' debian/python3-foo/DEBIAN/prerm
clean:
./debian/rules clean
......
......@@ -2,8 +2,11 @@
include ../common.mk
check:
grep -q "py3compile -p python3-foo /usr/lib/python3-foo"\
grep -q "py3compile -p python3-foo:$(DEB_HOST_ARCH) /usr/lib/python3-foo"\
debian/python3-foo/DEBIAN/postinst
grep -q "pypy3compile -p python3-foo:$(DEB_HOST_ARCH) /usr/lib/python3-foo"\
debian/python3-foo/DEBIAN/postinst
grep -q "py3clean -p python3-foo:$(DEB_HOST_ARCH)" debian/python3-foo/DEBIAN/prerm
[ "`find debian/python3-foo/usr/lib/python3/dist-packages/foo -name 'bar.cpython-*.so'`" != "" ]
# test if moved from include/python3.X/ to include/python3.Xm/ (for Python << 3.8)
#test -f debian/python3-foo/usr/include/python$(DEBPYTHON3_DEFAULT)m/foo.h
......
......@@ -4,6 +4,9 @@ include ../common.mk
check:
test -f debian/python3-foo/usr/lib/python3/dist-packages/foo.py
test ! -d debian/python3-foo/usr/lib/python3.*/site-packages
grep -q 'py3compile -p python3-foo\s*$$' debian/python3-foo/DEBIAN/postinst
grep -q 'pypy3compile -p python3-foo\s*||\s*true$$' debian/python3-foo/DEBIAN/postinst
grep -q 'py3clean -p python3-foo\s*$$' debian/python3-foo/DEBIAN/prerm
clean:
./debian/rules clean
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment