Bug 2209019

Summary: libselinux fails to build with pip 23.1.2
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: libselinuxAssignee: Petr Lautrbach <plautrba>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 39CC: dwalsh, mmalik, plautrba, vmojzis
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://copr.fedorainfracloud.org/coprs/churchyard/pip-23.1.2/package/libselinux/
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-01-02 14:20:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2168842, 2186979, 2231791    

Description Miro Hrončok 2023-05-22 10:14:44 UTC
When checking the impact of upgradign pip from 23.0.1 to 23.1.2 in https://src.fedoraproject.org/rpms/python-pip/pull-request/123 I realized libselinux repeatedly fails with the new pip but succeeds with the old one.

The error is:

+ make PYTHON=/usr/bin/python3 DESTDIR=/builddir/build/BUILDROOT/libselinux-3.5-1.fc39.x86_64 LIBDIR=/usr/lib64 SHLIBDIR=lib64 BINDIR=/usr/bin SBINDIR=/usr/sbin LIBSEPOLA=/usr/lib64/libsepol.a install-pywrap
make -C src install-pywrap
make[1]: Entering directory '/builddir/build/BUILD/libselinux-3.5/src'
...
running build_ext
/usr/bin/python3 -m pip install --prefix=/usr `test -n "/builddir/build/BUILDROOT/libselinux-3.5-1.fc39.x86_64" && echo --root /builddir/build/BUILDROOT/libselinux-3.5-1.fc39.x86_64 --ignore-installed --no-deps`  .
Processing /builddir/build/BUILD/libselinux-3.5/src
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f76865c9290>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
      WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f768653bf90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
      WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f76865568d0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
      WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f76865add90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
      WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f76865accd0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
      ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
      ERROR: No matching distribution found for setuptools>=40.8.0
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.


I believe pip defaults to isolated builds now and will always attempt to install build dependencies (setuptools>=40.8.0 in this case because that I the default when no build dependencies are mentioned in pyproject.toml) from the internet to a temporary virtual environment.

I think this can be fixed by adding --no-build-isolation to pip install:

$ pip install --help | grep isolation
  --no-build-isolation        Disable isolation when building a modern source

Reproducible: Always

Steps to Reproduce:
Build libselinux e.g. in https://copr.fedorainfracloud.org/coprs/churchyard/pip-23.1.2
Actual Results:  
Build fails.

Expected Results:  
Build succeeds.

All logs available at https://copr.fedorainfracloud.org/coprs/churchyard/pip-23.1.2/package/libselinux/

Comment 1 Miro Hrončok 2023-05-22 11:57:46 UTC
A possible fix: https://src.fedoraproject.org/rpms/libselinux/pull-request/26

Comment 2 Miro Hrončok 2023-05-26 09:37:00 UTC
A less controversial fix: https://src.fedoraproject.org/rpms/libselinux/pull-request/27

Comment 3 Fedora Release Engineering 2023-08-16 07:14:25 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.