[DSE-Dev] Bug#1022964: libselinux FTCBFS: python and ruby extensions

Helmut Grohne helmut at subdivi.de
Fri Mar 24 11:49:25 GMT 2023


Hi James,

On Fri, Mar 24, 2023 at 11:09:32AM +0000, James Addison wrote:
> Could you check whether the patch is missing a 'call ruby_env' line in the
> debian/rules 'override_dh_auto_clean' target?

Thank you very much for your review and the attention to detail. I
concur with your observation and have updated the patch accordingly.
This part slipped my testing, because I never tried the clean target and
most cross builds never clean that way.

Helmut
-------------- next part --------------
diff --minimal -Nru libselinux-3.4/debian/changelog libselinux-3.4/debian/changelog
--- libselinux-3.4/debian/changelog	2022-06-04 12:41:40.000000000 +0200
+++ libselinux-3.4/debian/changelog	2022-10-28 10:33:35.000000000 +0200
@@ -1,3 +1,11 @@
+libselinux (3.4-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Support cross building python and ruby extensions.
+    (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Fri, 28 Oct 2022 10:33:35 +0200
+
 libselinux (3.4-1) unstable; urgency=medium
 
   [ Laurent Bigonville ]
diff --minimal -Nru libselinux-3.4/debian/control libselinux-3.4/debian/control
--- libselinux-3.4/debian/control	2022-06-04 12:41:40.000000000 +0200
+++ libselinux-3.4/debian/control	2022-10-28 10:33:35.000000000 +0200
@@ -8,13 +8,14 @@
            Russell Coker <russell at coker.com.au>
 Standards-Version: 4.6.0
 Build-Depends: debhelper-compat (= 13),
-               dh-python <!nopython>,
+               dh-sequence-python3 <!nopython>,
+               dh-sequence-ruby <!noruby>,
                file,
-               gem2deb <!noruby>,
                libsepol-dev (>= 3.4),
                libpcre2-dev,
+               libpython3-all-dev <!nopython>,
                pkg-config,
-               python3-all-dev <!nopython>,
+               python3-all-dev:any <!nopython>,
                swig <!nopython> <!noruby>
 XS-Ruby-Versions: all
 Homepage: https://selinuxproject.org
diff --minimal -Nru libselinux-3.4/debian/rules libselinux-3.4/debian/rules
--- libselinux-3.4/debian/rules	2022-06-04 12:41:40.000000000 +0200
+++ libselinux-3.4/debian/rules	2022-10-28 10:33:35.000000000 +0200
@@ -10,6 +10,13 @@
 ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
 export CC := $(DEB_HOST_GNU_TYPE)-gcc
 export PKG_CONFIG := $(DEB_HOST_GNU_TYPE)-pkg-config
+export _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__$(DEB_HOST_MULTIARCH)
+define ruby_env
+  RUBYLIB=/usr/lib/$(DEB_HOST_MULTIARCH)/ruby-crossbuild/$$($(1) -e "puts RbConfig::CONFIG['ruby_version']")
+endef
+else
+define ruby_env
+endef
 endif
 
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
@@ -27,18 +34,15 @@
 ## missing (hardening) flags. Also enable Wall and Wextra to spot basic irregularities.
 export DEB_CFLAGS_MAINT_APPEND += $(shell dpkg-buildflags --get CPPFLAGS) -Wall -Wextra
 
-DH_ADDONS =
 ifneq ($(filter python3-selinux,$(DOPACKAGES)),)
 PY3VERSIONS = $(shell py3versions -rv)
-DH_ADDONS += --with=python3
 endif
 ifneq ($(filter ruby-selinux,$(DOPACKAGES)),)
 RUBY_VERSIONS := $(shell dh_ruby --print-supported)
-DH_ADDONS += --with=ruby
 endif
 
 %:
-	@dh $@ $(DH_ADDONS)
+	@dh $@
 
 ## Set up some variables to be passed to the upstream Makefile
 extra_make_args = ARCH=$(patsubst i%86,i386,$(DEB_HOST_GNU_CPU))
@@ -52,6 +56,7 @@
 endif
 ifneq ($(filter ruby-selinux,$(DOPACKAGES)),)
 	set -e; for version in $(RUBY_VERSIONS); do      \
+	  $(call ruby_env,$$version) \
 	  $(MAKE) rubywrap $(extra_make_args) RUBY=$$version; \
 	done;
 endif
@@ -67,6 +72,7 @@
 endif
 ifneq ($(filter ruby-selinux,$(DOPACKAGES)),)
 	set -e; for version in $(RUBY_VERSIONS); do \
+	  $(call ruby_env,$$version) \
 	  $(MAKE) install-rubywrap $(extra_make_args) RUBY=$$version DESTDIR="${CURDIR}/debian/tmp"; \
 	done;
 endif
@@ -80,6 +86,7 @@
 endif
 ifneq ($(filter ruby-selinux,$(DOPACKAGES)),)
 	set -e; for version in $(RUBY_VERSIONS); do      \
+	  $(call ruby_env,$$version) \
 	  $(MAKE) clean-rubywrap $(extra_make_args) RUBY=$$version; \
 	done;
 endif


More information about the SELinux-devel mailing list