Package: python3.9-minimal
Version: 3.9.12-1
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: systemd-binfmt
Hi,
your package python3.9-minimal declares a dependency (Suggests) on
binfmt-support and ships binfmt-support configuration files in
/usr/share/binfmts/.
systemd provides a builtin, cross-distro facility named systemd-binfmt to
register binary formats.
You can read more about it at
https://www.freedesktop.org/software/systemd/man/systemd-binfmt.html
https://www.freedesktop.org/software/systemd/man/binfmt.d.html
https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html
The systemd package provides a dpkg file trigger so it is sufficient to
simply install configuration files in /usr/lib/binfmt.d/, no
modifications in the maintainer scripts are necessary.
The attached patch ships a configuration file for systemd-binfmt which
will automatically enable binfmt support for python3.9 without requiring
further dependencies.
Regards,
Michael
diff -Nru python3.9-3.9.12/debian/mkbinfmtconf.py
python3.9-3.9.12/debian/mkbinfmtconf.py
--- python3.9-3.9.12/debian/mkbinfmtconf.py 1970-01-01 01:00:00.000000000
+0100
+++ python3.9-3.9.12/debian/mkbinfmtconf.py 2022-06-05 22:25:30.000000000
+0200
@@ -0,0 +1,9 @@
+# mkbinfmtconf.py
+import importlib.util, sys, string, os.path
+
+magic = "".join(["\\x%.2x" % c for c in importlib.util.MAGIC_NUMBER])
+
+name = sys.argv[1]
+
+sys.stdout.write(f":{name}:M::{magic}::/usr/bin/{name}:")
+sys.stdout.write('\n')
diff -Nru python3.9-3.9.12/debian/rules python3.9-3.9.12/debian/rules
--- python3.9-3.9.12/debian/rules 2021-09-24 11:52:44.000000000 +0200
+++ python3.9-3.9.12/debian/rules 2022-06-05 22:18:48.000000000 +0200
@@ -1175,11 +1175,15 @@
: # generate binfmt file
mkdir -p $(d_min)/usr/share/binfmts
+ mkdir -p $(d_min)/usr/lib/binfmt.d
ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
$(buildd_static)/python debian/mkbinfmt.py $(PVER) \
> $(d_min)/usr/share/binfmts/$(PVER)
+ $(buildd_static)/python debian/mkbinfmtconf.py $(PVER) \
+ > $(d_min)/usr/lib/binfmt.d/$(PVER).conf
else
$(PVER) debian/mkbinfmt.py $(PVER) > $(d_min)/usr/share/binfmts/$(PVER)
+ $(PVER) debian/mkbinfmtconf.py $(PVER) >
$(d_min)/usr/lib/binfmt.d/$(PVER).conf
endif
: # desktop entry