Remove patchelf dependency for RHEL
Resolves: RHEL-36336
This commit is contained in:
		
							parent
							
								
									399e1711ea
								
							
						
					
					
						commit
						c88688dc68
					
				
							
								
								
									
										39
									
								
								meson_python-remove-patchelf.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								meson_python-remove-patchelf.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,39 @@ | |||||||
|  | diff --color -ruN a/mesonpy/__init__.py b/mesonpy/__init__.py
 | ||||||
|  | --- a/mesonpy/__init__.py	2024-06-05 11:10:53.628398345 +0200
 | ||||||
|  | +++ b/mesonpy/__init__.py	2024-06-05 11:31:13.600792738 +0200
 | ||||||
|  | @@ -410,6 +410,7 @@
 | ||||||
|  |                  # directory, in the form of a relative RPATH entry. meson-python | ||||||
|  |                  # relocates the shared libraries to the $project.mesonpy.libs | ||||||
|  |                  # folder. Rewrite the RPATH to point to that folder instead. | ||||||
|  | +                assert False, "Patchelf is not allowed to run on RHEL" 
 | ||||||
|  |                  libspath = os.path.relpath(self._libs_dir, destination.parent) | ||||||
|  |                  mesonpy._rpath.fix_rpath(origin, libspath) | ||||||
|  |   | ||||||
|  | @@ -1007,9 +1008,6 @@
 | ||||||
|  |      if os.environ.get('NINJA') is None and _env_ninja_command() is None: | ||||||
|  |          dependencies.append(f'ninja >= {_NINJA_REQUIRED_VERSION}') | ||||||
|  |   | ||||||
|  | -    if sys.platform.startswith('linux') and not shutil.which('patchelf'):
 | ||||||
|  | -        dependencies.append('patchelf >= 0.11.0')
 | ||||||
|  | -
 | ||||||
|  |      return dependencies | ||||||
|  |   | ||||||
|  |   | ||||||
|  | diff --color -ruN a/mesonpy/_rpath.py b/mesonpy/_rpath.py
 | ||||||
|  | --- a/mesonpy/_rpath.py	2024-06-05 11:10:53.628398345 +0200
 | ||||||
|  | +++ b/mesonpy/_rpath.py	2024-06-05 11:31:18.954861673 +0200
 | ||||||
|  | @@ -17,12 +17,13 @@
 | ||||||
|  |   | ||||||
|  |   | ||||||
|  |  if sys.platform == 'linux': | ||||||
|  | -
 | ||||||
|  |      def _get_rpath(filepath: Path) -> List[str]: | ||||||
|  | +        assert False, "Patchelf is not allowed to run on RHEL" 
 | ||||||
|  |          r = subprocess.run(['patchelf', '--print-rpath', os.fspath(filepath)], capture_output=True, text=True) | ||||||
|  |          return r.stdout.strip().split(':') | ||||||
|  |   | ||||||
|  |      def _set_rpath(filepath: Path, rpath: Iterable[str]) -> None: | ||||||
|  | +        assert False, "Patchelf is not allowed to run on RHEL" 
 | ||||||
|  |          subprocess.run(['patchelf','--set-rpath', ':'.join(rpath), os.fspath(filepath)], check=True) | ||||||
|  |   | ||||||
|  |      def fix_rpath(filepath: Path, libs_relative_path: str) -> None: | ||||||
| @ -13,6 +13,8 @@ License:        MIT | |||||||
| URL:            https://github.com/mesonbuild/meson-python | URL:            https://github.com/mesonbuild/meson-python | ||||||
| Source:         %{pypi_source meson_python} | Source:         %{pypi_source meson_python} | ||||||
| 
 | 
 | ||||||
|  | Patch2:         meson_python-remove-patchelf.patch | ||||||
|  | 
 | ||||||
| BuildArch:      noarch | BuildArch:      noarch | ||||||
| 
 | 
 | ||||||
| BuildRequires:  python3-devel | BuildRequires:  python3-devel | ||||||
| @ -40,8 +42,10 @@ Summary:        %{summary} | |||||||
| # When patchelf is not in the PATH, mesonpy.get_requires_for_build_wheel() adds | # When patchelf is not in the PATH, mesonpy.get_requires_for_build_wheel() adds | ||||||
| # https://pypi.org/project/patchelf/ to the dependencies. We always want to use | # https://pypi.org/project/patchelf/ to the dependencies. We always want to use | ||||||
| # the system patchelf. | # the system patchelf. | ||||||
|  | %if 0%{?rhel} == 0 | ||||||
| BuildRequires:  /usr/bin/patchelf | BuildRequires:  /usr/bin/patchelf | ||||||
| Requires:       /usr/bin/patchelf | Requires:       /usr/bin/patchelf | ||||||
|  | %endif | ||||||
| 
 | 
 | ||||||
| # https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_provides_for_importable_modules | # https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_provides_for_importable_modules | ||||||
| %py_provides    python3-mesonpy | %py_provides    python3-mesonpy | ||||||
| @ -50,8 +54,12 @@ Requires:       /usr/bin/patchelf | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| %prep | %prep | ||||||
| %autosetup -n meson_python-%{version} | %setup -n meson_python-%{version} -q | ||||||
| 
 | %patch 0 -p1 | ||||||
|  | %patch 1 -p1 | ||||||
|  | %if 0%{?rhel} | ||||||
|  | %patch 2 -p1 | ||||||
|  | %endif | ||||||
| # build: used only by skipped PEP 518 test | # build: used only by skipped PEP 518 test | ||||||
| # pytest-cov: https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters | # pytest-cov: https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters | ||||||
| sed -r -i "s/^  '(build|pytest-cov)/#&/" pyproject.toml | sed -r -i "s/^  '(build|pytest-cov)/#&/" pyproject.toml | ||||||
| @ -84,6 +92,13 @@ ignore="${ignore-} --ignore=tests/test_pep518.py" | |||||||
| k="${k-}${k+ and }not test_invalid_build_dir" | k="${k-}${k+ and }not test_invalid_build_dir" | ||||||
| k="${k-}${k+ and }not test_use_ansi_colors" | k="${k-}${k+ and }not test_use_ansi_colors" | ||||||
| %endif | %endif | ||||||
|  | %if 0%{?rhel} | ||||||
|  | k="${k-}${k+ and }not test_contents" | ||||||
|  | k="${k-}${k+ and }not test_local_lib" | ||||||
|  | k="${k-}${k+ and }not test_rpath" | ||||||
|  | k="${k-}${k+ and }not test_get_requires_for_build_wheel" | ||||||
|  | k="${k-}${k+ and }not test_uneeded_rpath" | ||||||
|  | %endif | ||||||
| 
 | 
 | ||||||
| %pytest ${ignore-} -k "${k-}" | %pytest ${ignore-} -k "${k-}" | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user