[Rpm-maint] [rpm-software-management/rpm] Introduce an rpm-controlled per-build directory (PR #2885)
Tomasz Kłoczko
notifications at github.com
Mon Feb 5 16:19:28 UTC 2024
> Do I understand correctly that the `BUILDROOT` dir was replaced by `%{_builddir}/%{_target_cpu}-%{_target_os}-root`? The `%{_builddir}` is the right move IMHO, but what is the advantage of `%{_target_cpu}-%{_target_os}-root` over `BUILDROOT`, especially when e.g. `SPECPARTS` stays the same.
I'm using below patch
```patch
--- a/tests/rpmspec.at
+++ b/tests/rpmspec.at
@@ -333,8 +333,8 @@
exit $STATUS
fi
cd 'hello-1.0'
-rm -rf '/build/BUILD/hello-1.0-SPECPARTS'
-/usr/bin/mkdir -p '/build/BUILD/hello-1.0-SPECPARTS'
+rm -rf '/build/BUILD/hello-1.0/SPECPARTS'
+/usr/bin/mkdir -p '/build/BUILD/hello-1.0/SPECPARTS'
/usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
echo "Patch #0 (hello-1.0-modernize.patch):"
/usr/bin/patch --no-backup-if-mismatch -f -p1 -b --suffix .modernize --fuzz=0 < /build/SOURCES/hello-1.0-modernize.patch
--- a/macros.in
+++ b/macros.in
@@ -271,7 +271,7 @@
%buildroot %{_buildrootdir}/%{NAME}-%{VERSION}-%{RELEASE}.%{_arch}
# Path for spec file snippets generated during build
-%specpartsdir %{_builddir}/%{buildsubdir}-SPECPARTS
+%specpartsdir %{_builddir}/%{buildsubdir}/SPECPARTS
# Directory where temporaray files can be created.
%_tmppath %{_var}/tmp
--- a/build/build.c
+++ b/build/build.c
@@ -195,14 +195,8 @@
fprintf(fp, "cd '%s'\n", buildSubdir);
if (what == RPMBUILD_RMBUILD) {
- if (rpmMacroIsDefined(spec->macros, "specpartsdir")) {
- char * buf = rpmExpand("%{specpartsdir}", NULL);
- fprintf(fp, "rm -rf '%s'\n", buf);
- free(buf);
- }
if (buildSubdir[0] != '\0')
- fprintf(fp, "rm -rf '%s' '%s.gemspec'\n",
- buildSubdir, buildSubdir);
+ fprintf(fp, "rm -rf '%s'\n", buildSubdir);
} else if (sb != NULL)
fprintf(fp, "%s", sb);
```
After that I've tested that whit almost 5k of my src.rpm and found that only few packages are failing because of that change.
All those packages are python modules and fail s result of MISSING parts in pyprojects toml.
Because SPECPARTS **exposed those issue** IMO instead evacuating that directory outside source tree it should be INTENTIONALLY put in that location.
In meantime for all those cases I've opened issue tickets and ~half already have been sorted out.
Example fail on building `uc-micro-py` python module:
```console
+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting build dependencies for wheel...
No `packages` or `py_modules` configuration, performing automatic discovery.
`flat-layout` detected -- analysing .
discovered packages -- ['uc_micro', 'SPECPARTS ', 'uc_micro.categories', 'uc_micro.properties', 'uc_micro.categories.Cc', 'uc_micro.categories.Cf', 'uc_micro.categories.P', 'uc_micro.categories.Z', 'uc_micro.properties.Any']
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/usr/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
self.run_setup()
File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 311, in run_setup
exec(code, locals())
File "<string>", line 1, in <module>
File "/usr/lib/python3.8/site-packages/setuptools/__init__.py", line 103, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 159, in setup
dist.parse_config_files()
File "/usr/lib/python3.8/site-packages/setuptools/dist.py", line 627, in parse_config_files
pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 66, in apply_configuration
config = read_configuration(filepath, True, ignore_option_errors, dist)
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 131, in read_configuration
return expand_configuration(asdict, root_dir, ignore_option_errors, dist)
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 156, in expand_configuration
return _ConfigExpander(config, root_dir, ignore_option_errors, dist).expand()
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 204, in expand
self._expand_all_dynamic(dist, package_dir)
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 249, in _expand_all_dynamic
version=self._obtain_version(dist, package_dir),
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 298, in _obtain_version
return _expand.version(self._obtain(dist, "version", package_dir))
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 287, in _obtain
return self._expand_directive(
File "/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 281, in _expand_directive
return _expand.read_attr(directive["attr"], package_dir, root_dir)
File "/usr/lib/python3.8/site-packages/setuptools/config/expand.py", line 188, in read_attr
_parent_path, path, module_name = _find_module(module_name, package_dir, root_dir)
File "/usr/lib/python3.8/site-packages/setuptools/config/expand.py", line 229, in _find_module
if package_dir:
File "/usr/lib/python3.8/site-packages/setuptools/config/expand.py", line 459, in __len__
return len(self._target())
File "/usr/lib/python3.8/site-packages/setuptools/config/expand.py", line 452, in _target
self._value = self._obtain()
File "/usr/lib/python3.8/site-packages/setuptools/config/expand.py", line 422, in _get_package_dir
self()
File "/usr/lib/python3.8/site-packages/setuptools/config/expand.py", line 412, in __call__
self._dist.set_defaults(name=False) # Skip name, we can still be parsing
File "/usr/lib/python3.8/site-packages/setuptools/discovery.py", line 353, in __call__
self._analyse_package_layout(ignore_ext_modules)
File "/usr/lib/python3.8/site-packages/setuptools/discovery.py", line 387, in _analyse_package_layout
or self._analyse_flat_layout()
File "/usr/lib/python3.8/site-packages/setuptools/discovery.py", line 444, in _analyse_flat_layout
return self._analyse_flat_packages() or self._analyse_flat_modules()
File "/usr/lib/python3.8/site-packages/setuptools/discovery.py", line 450, in _analyse_flat_packages
self._ensure_no_accidental_inclusion(top_level, "packages")
File "/usr/lib/python3.8/site-packages/setuptools/discovery.py", line 480, in _ensure_no_accidental_inclusion
raise PackageDiscoveryError(cleandoc(msg))
setuptools.errors.PackageDiscoveryError: Multiple top-level packages discovered in a flat-layout: ['uc_micro', 'SPECPARTS '].
To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.
If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:
1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names
To find more information, look for "package discovery" on setuptools docs.
ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel
```
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2885#issuecomment-1927364368
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/2885/c1927364368 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240205/e4ac48ed/attachment-0001.html>
More information about the Rpm-maint
mailing list