Bug 481098 - For some distributions --initial-setup will not properly set the amount of usable cores
Summary: For some distributions --initial-setup will not properly set the amount of us...
Status: RESOLVED FIXED
Alias: None
Product: kdesrc-build
Classification: Developer tools
Component: setup wizard (show other bugs)
Version: Git
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Michael Pyne
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-08 23:32 UTC by youkai
Modified: 2024-03-02 18:12 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description youkai 2024-02-08 23:32:10 UTC
SUMMARY
***
On a high level kdesrc-build populates the two variables "num-cores" and "num-cores-low-mem" inside the kdesrc-buildrc config file like so:
num-cores = Result of nproc
num-cores-low-mem = min(num-cores, Total ram in GiB / 2GiB )

It does so only if it detects that the current platform is linux or freebsd. However, the platform detection logic is flawed on the linux side because it's relying on the OS identification parameter "ID" from /etc/os-release and testing if it's equal to "linux". On some (most?) distributions this is not the case and the script will default to assigning the value 4 to num-cores and num-cores-low-mem.
***

STEPS TO REPRODUCE
0. Temporarily backup and move/delete ~/.config/kdesrc-buildrc if it exists
1. Run through "./kdesrc-build --initial-setup" 

OBSERVED RESULT
The variables num-cores and num-cores-low-mem inside ~/.config/kdesrc-buildrc will have the default value of 4 when running on a distribution which sets the "ID" paramenter of /etc/os-release to something other than "linux".

EXPECTED RESULT
The variables should be set based on the amount of system memory. A 16-core 16GiB Ram System should have the following values: num-cores = 16; num-cores-low-mem = 8.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Linux 39
(available in About System)
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.113.0
Qt Version: 5.15.12

ADDITIONAL INFORMATION
The relevant code starts here
https://invent.kde.org/sdk/kdesrc-build/-/blob/master/modules/ksb/FirstRun.pm?ref_type=heads#L299
Comment 1 youkai 2024-02-08 23:41:44 UTC
Technically this bug report was intended for kde-builder but since they both have this issue it's relevant here too.
Comment 2 Andrew Shark 2024-03-02 18:12:55 UTC
Git commit f2392fe48d3113fd004704827e68af93dc491715 by Andrew Shark.
Committed on 02/03/2024 at 17:42.
Pushed by ashark into branch 'master'.

FirstRun: Actually use nproc for supported distros

M  +4    -4    ksblib/FirstRun.py
M  +1    -1    ksblib/OSSupport.py

https://invent.kde.org/sdk/kde-builder/-/commit/f2392fe48d3113fd004704827e68af93dc491715