Opened 8 years ago
Closed 8 years ago
#201 closed defect (fixed)
rpmbuild
Reported by: | Silvan Scherrer | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | rpm | Version: | |
Severity: | low | Keywords: | |
Cc: |
Description
The below sequence is executed as in the macros to see how many CPU's are available. But as we don't have getconf, RPM_BUILD_NCPUS is uninitialized. This leads to warnings and errors in the log.
As we don't have getconf, I vote for initializing the value with 1
# Maximum number of CPU's to use when building, 0 for unlimited. #%_smp_ncpus_max 0 %_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\ && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\ ncpus_max=%{?_smp_ncpus_max}; \\\ if [ -n "$ncpus_max" ] && [ "$ncpus_max" -gt 0 ] && [ "$RPM_BUILD_NCPUS" -gt "$ncpus_max" ]; then RPM_BUILD_NCPUS="$ncpus_max"; fi; \\\ if [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo "-j$RPM_BUILD_NCPUS"; fi)
Change History (5)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Sure, that should also work but we at least should not interfere the rpmbuild process when this is not set. This popped up because of switching to dash which is more strict about numeric comparisons than ash and barfs on things like [ "" -gt 0 ]
(ash eats this and returns false in such cases).
A fix is to replace
%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\ && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
with
%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" -a -x /@unixroot/usr/bin/getconf ] \\\ && RPM_BUILD_NCPUS="`/@unixroot/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\ [ -z "$RPM_BUILD_NCPUS" ] && RPM_BUILD_NCPUS=1; \\\
This way, it will return 1 for now and once we have getconf that supports _NPROCESSORS_ONLN, it will return the proper value.
comment:3 by , 8 years ago
we should take care on that in the next rpm update, as it really annoys me :)
comment:4 by , 8 years ago
comment:5 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I simply set it in %HOME%\.rpmmacros