Control: tags -1 patch
Control: tags 877125 patch

On Thu, 19 May 2022 08:49:27 -0700 Vagrant Cascadian <vagr...@debian.org> wrote:
I've tried several times, but always get stuck with:

  https://bugs.debian.org/877125

There was a hint at a proposed path forward ~2019, but I wasn't able to
get it to work...

Would be happy to see this fixed as well!

Please find a patch attached that depends on #877125's 
0001-Enable-pylibfdt-build-Closes-877125.patch.
Both patches applied should make the build work.
From cedf1902e0e845fdd273e052ad4137e0ce02f82c Mon Sep 17 00:00:00 2001
From: Bastian Germann <b...@debian.org>
Date: Mon, 6 Jun 2022 16:23:10 +0200
Subject: [PATCH] Create bin pkg python3-libfdt (Closes: #1011282)

Installing pylibfdt as python3-libfdt without pybuild needs adding some
setuptools install flags that cannot be passed to the install call without
an additional patch.
---
 debian/control                                | 11 +++++++++++
 debian/not-installed                          |  1 +
 .../patches/04_Install_to_dist_packages.patch | 19 +++++++++++++++++++
 debian/patches/series                         |  1 +
 debian/python3-libfdt.install                 |  2 ++
 debian/rules                                  |  2 +-
 6 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 debian/not-installed
 create mode 100644 debian/patches/04_Install_to_dist_packages.patch
 create mode 100644 debian/python3-libfdt.install

diff --git a/debian/control b/debian/control
index f82e53c..b366d16 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,7 @@ Maintainer: Héctor Orón Martínez <zu...@debian.org>
 Uploaders: Riku Voipio <riku.voi...@linaro.org>, Vagrant Cascadian <vagr...@debian.org>
 Standards-Version: 4.6.0
 Build-Depends: debhelper-compat (= 13),
+ dh-python,
  flex,
  bison,
  libyaml-dev,
@@ -50,3 +51,13 @@ Description: Flat Device Trees manipulation library - development files
  This is a library containing functions for manipulating Flat Device Trees.
  .
  This package contains the files needed for development against libfdt.
+
+Package: python3-libfdt
+Architecture: any
+Section: python
+Depends: ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}
+Provides: ${python3:Provides}
+Description: Flat Device Trees manipulation library - Python bindings
+ This is a library containing functions for manipulating Flat Device Trees.
+ .
+ This package contains the files needed for Python development with libfdt.
diff --git a/debian/not-installed b/debian/not-installed
new file mode 100644
index 0000000..b54b0c7
--- /dev/null
+++ b/debian/not-installed
@@ -0,0 +1 @@
+usr/lib/python3/dist-packages/__pycache__
diff --git a/debian/patches/04_Install_to_dist_packages.patch b/debian/patches/04_Install_to_dist_packages.patch
new file mode 100644
index 0000000..9c8abac
--- /dev/null
+++ b/debian/patches/04_Install_to_dist_packages.patch
@@ -0,0 +1,19 @@
+From: Bastian Germann <b...@debian.org>
+Date: Fri, 20 May 2022 19:00:00 +0200
+Subject: pylibfdt: Install to dist-packages
+
+Signed-off-by: Bastian Germann <b...@debian.org>
+---
+diff --git a/pylibfdt/Makefile.pylibfdt b/pylibfdt/Makefile.pylibfdt
+index b1c80af..deb3f91 100644
+--- a/pylibfdt/Makefile.pylibfdt
++++ b/pylibfdt/Makefile.pylibfdt
+@@ -21,7 +21,7 @@ $(PYMODULE): $(PYLIBFDT_srcs) $(LIBFDT_archive) $(SETUP) $(VERSION_FILE)
+ 
+ install_pylibfdt: $(PYMODULE)
+ 	@$(VECHO) INSTALL-PYLIB
+-	$(PYTHON) $(SETUP) $(SETUPFLAGS) install --prefix=$(PREFIX)
++	$(PYTHON) $(SETUP) $(SETUPFLAGS) install --prefix=$(PREFIX) --root=/ --install-lib=$(PREFIX)/lib/python3/dist-packages --install-layout=deb --single-version-externally-managed
+ 
+ pylibfdt_clean:
+ 	@$(VECHO) CLEAN "(pylibfdt)"
diff --git a/debian/patches/series b/debian/patches/series
index 3b4e70f..f384023 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 01_build_doc.patch
 02_Move_setup.py_to_the_top_level.patch
 03_fix_with_Python_3.10.patch
+04_Install_to_dist_packages.patch
diff --git a/debian/python3-libfdt.install b/debian/python3-libfdt.install
new file mode 100644
index 0000000..a2166f4
--- /dev/null
+++ b/debian/python3-libfdt.install
@@ -0,0 +1,2 @@
+usr/lib/python3/dist-packages/_libfdt*
+usr/lib/python3/dist-packages/libfdt*
diff --git a/debian/rules b/debian/rules
index 01a4155..968d0ca 100755
--- a/debian/rules
+++ b/debian/rules
@@ -18,7 +18,7 @@ EXTRA_CFLAGS = -Wno-error
 CPPFLAGS += -I libfdt -I .
 
 %:
-	dh $@
+	dh $@ --with python3
 
 override_dh_auto_build:
 	dh_auto_build -- V=1 EXTRA_CFLAGS="$(EXTRA_CFLAGS)" CPPFLAGS="$(CPPFLAGS)"

Reply via email to