Skip to contentSkip to conversation

libselinux/src/Makefile: build python module without isolation

PATCH In review Thomas Petazzoni 2 participants 3 messages Dec 27, 2025 – Jan 28 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux/src/Makefile: build python module without isolation

From: Christian Göttsche <[email protected]>

The "pip install" logic in libselinux/src/Makefile tries to get setuptools from the network, which is not correct as during the build/installation, there shouldn't be any network access, or downloading of arbitrary resources from the network.

This causes build issues in Debian:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1121121

And in Buildroot:

https://autobuild.buildroot.net/results/0e9/0e9de0c0d8b6ec57eea9f8834f02076b296ba4f1/build-end.log

To fix this, we use the --no-build-isolation pip install argument so that pip install is allowed to use the system-provided setuptools, instead of wanting to download this one.

This patch is derived from
https://sources.debian.org/src/libselinux/3.9-4/debian/patches/Build-python-module-without-isolation-Closes-1119155.patch,
with the change that --no-build-isolation is passed unconditionally, regardless of whether $(DESTDIR) is empty or not.

---
 libselinux/src/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libselinux/src/Makefile +1 -1
index f7412cd1..0dbba7f4 100644
@@ -198,7 +198,7 @@ ifneq ($(DISABLE_SHARED),y)
 endif
 
 install-pywrap: pywrap
-	CFLAGS="$(CPPFLAGS) $(CFLAGS) $(SWIG_CFLAGS)" $(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
+	CFLAGS="$(CPPFLAGS) $(CFLAGS) $(SWIG_CFLAGS)" $(PYTHON) -m pip install --no-build-isolation --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
 	install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py
 	ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT)
 
Signature · 1 line
2.52.0
Acked-by on v1 1/1
#1 lore raw
Quoted 20 lines · Thomas Petazzoni

From: Christian Göttsche <[email protected]>

The "pip install" logic in libselinux/src/Makefile tries to get setuptools from the network, which is not correct as during the build/installation, there shouldn't be any network access, or downloading of arbitrary resources from the network.

This causes build issues in Debian:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1121121

And in Buildroot:

https://autobuild.buildroot.net/results/0e9/0e9de0c0d8b6ec57eea9f8834f02076b296ba4f1/build-end.log

To fix this, we use the --no-build-isolation pip install argument so that pip install is allowed to use the system-provided setuptools, instead of wanting to download this one.

Quoted 7 lines

This patch is derived from
https://sources.debian.org/src/libselinux/3.9-4/debian/patches/Build-python-module-without-isolation-Closes-1119155.patch,
with the change that --no-build-isolation is passed unconditionally, regardless of whether $(DESTDIR) is empty or not.

Quoted 21 lines
---
 libselinux/src/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libselinux/src/Makefile +1 -2
index f7412cd1..0dbba7f4 100644
@@ -198,7 +198,7 @@ ifneq ($(DISABLE_SHARED),y)
 endif
 
 install-pywrap: pywrap
-       CFLAGS="$(CPPFLAGS) $(CFLAGS) $(SWIG_CFLAGS)" $(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
+       CFLAGS="$(CPPFLAGS) $(CFLAGS) $(SWIG_CFLAGS)" $(PYTHON) -m pip install --no-build-isolation --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
        install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py
        ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT)
 
--

2.52.0

#2 lore raw
Quoted 28 lines · James Carter
Quoted 25 lines · Thomas Petazzoni

From: Christian Göttsche <[email protected]>

The "pip install" logic in libselinux/src/Makefile tries to get setuptools from the network, which is not correct as during the build/installation, there shouldn't be any network access, or downloading of arbitrary resources from the network.

This causes build issues in Debian:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1121121

And in Buildroot:

https://autobuild.buildroot.net/results/0e9/0e9de0c0d8b6ec57eea9f8834f02076b296ba4f1/build-end.log

To fix this, we use the --no-build-isolation pip install argument so that pip install is allowed to use the system-provided setuptools, instead of wanting to download this one.

This patch is derived from
https://sources.debian.org/src/libselinux/3.9-4/debian/patches/Build-python-module-without-isolation-Closes-1119155.patch,
with the change that --no-build-isolation is passed unconditionally, regardless of whether $(DESTDIR) is empty or not.

Quoted 5 lines
Quoted 2 lines

Merged.
Thanks,
Jim

Quoted 21 lines
Quoted 21 lines
---
 libselinux/src/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libselinux/src/Makefile +1 -2
index f7412cd1..0dbba7f4 100644
@@ -198,7 +198,7 @@ ifneq ($(DISABLE_SHARED),y)
 endif
 
 install-pywrap: pywrap
-       CFLAGS="$(CPPFLAGS) $(CFLAGS) $(SWIG_CFLAGS)" $(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
+       CFLAGS="$(CPPFLAGS) $(CFLAGS) $(SWIG_CFLAGS)" $(PYTHON) -m pip install --no-build-isolation --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
        install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py
        ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT)
 
--

2.52.0