Repository navigation
Conversation
d215af0 to
47a2cc1
Compare
|
The advertised Make job cap can be replaced by makepkg configuration. Verified: starting from niceness 0, the updated invocation and its tested build children run at niceness 15 and best-effort I/O priority 7. Job defaults, the one-job floor, explicit overrides, yay arguments, and skip paths behaved as intended at the yay boundary. makepkg configuration can override the selected Make job countAt Impact: users with a configured Make job count do not receive the selected per-update cap, even with an explicit one-job override. Lower priority still applies. This is incomplete parallelism control, not newly introduced oversubscription or a reproduced desktop freeze. With no configured Suggested change: apply the selected Make job count after makepkg configuration is loaded, preserving unrelated Make flags, or explicitly document that makepkg configuration takes precedence over this override. A replacement implementation was not tested. Scope correction: describe these as job-count defaults for cooperating tools, not a guarantee that foreground work retains half the CPU. With all three environment values set for two jobs, the same four-task synthetic workload reached two concurrent jobs through Review informationTest scope: head Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review. Automated AI review: Astra initial inspection, independent Fable 5.1 and separate Astra reviews, followed by coordinator verification of claims against source and targeted saved evidence. |
Resolution of review comment (issuecomment-5768750538)Both points from the review are addressed in commit makepkg configuration overriding the Make job count: Verified with the review's exact scenario (user config Scope correction: the inline comment now describes the count as a job-count default offered to cooperating build tools (Make, Cargo, CMake), not a guarantee that foreground work retains half the CPU. Tests: new |
Automated AI review
Follow-up at head The cap still misses the
Verified: with real makepkg 7.1.0 and GNU Make 4.4.1, the reported case (user config The cap only recognizes the
|
User config MAKEFLAGS |
Merge base | This head |
|---|---|---|
"-j4" |
4 jobs | -j1: 1 job |
"--jobs=4" |
4 jobs | -j1 --jobs=4: 4 jobs |
"--jobs 4" |
not run | -j1 --jobs 4: 4 jobs |
"-j 4" |
4 jobs, build succeeds | -j1 4: Make stops with No rule to make target '4', makepkg exits 4 |
Impact: --jobs=$(nproc) is the form the Arch Wiki makepkg page suggests, so users who followed it still get their configured job count, even with an explicit override. A -j 4 config, which built before this PR, now makes Make-based AUR builds fail, because Make treats the leftover 4 as a target.
Suggested change: append the selected option after the retained flags instead of before them. At Make level, -j 4 -j1, --jobs=4 -j1, --jobs 4 -j1 and -j4 --output-sync=recurse -j1 each ran 1 job with exit 0. Alternatively, also strip --jobs[=N] and a separate number after -j or --jobs. A patched updater was not run.
Copying config text into one temporary file changes how makepkg loads it
makepkg sources each config file separately from its own path. At omarchy-update-aur-pkgs:52-66, the files are joined with cat into a mktemp file ending in the MAKEFLAGS= line, and makepkg sources that file instead. Measured with real makepkg 7.1.0, comparing the merge base and this head:
| User config | Merge base | This head |
|---|---|---|
Last line MAKEFLAGS="-j4", no final newline |
builds, 4 jobs | merged value -j4MAKEFLAGS=-j1: Make rejects the -j argument, makepkg exits 4 |
MAKEFLAGS="-j4", then a last-line comment with no final newline |
builds, 4 jobs | appended MAKEFLAGS becomes part of the comment: 4 jobs, cap not applied |
source "$(dirname "${BASH_SOURCE[0]}")/other.conf" |
included settings present | BASH_SOURCE names the temp file, the include is not found, the build runs without its settings |
Last line source /missing/path.conf |
Failed to source error, makepkg exits 6 |
makepkg exits 0 and builds |
In the last two rows the failure does not stop makepkg: it aborts only when sourcing a config file returns non-zero, and the merged file always ends with a successful assignment. A config file that failed to source and stopped the build before is now accepted.
Impact: valid user configs can now fail to build or lose settings, and config errors no longer stop the build. The same joining applies between /etc/makepkg.conf, each drop-in and the user file. That boundary was confirmed from source only.
Suggested change: write the merged file as source '<path>' || return lines for the system file, each drop-in and the user file, followed by the MAKEFLAGS= line. Each file then keeps its own path and line boundaries, and a config file that fails to source still aborts makepkg, as it does today. This approach was not run.
A custom makepkg config is replaced
The merged file always starts from /etc/makepkg.conf and the default user file. makepkg otherwise honors MAKEPKG_CONF, and --config overrides it. With MAKEPKG_CONF pointing to a custom file that sets -j2 and a marker variable, the merge base built with that file (2 jobs, marker set). This head ignored it (-j1, marker unset). yay reads its own config before the command line, so a makepkgconf saved in yay's settings is also replaced by --makepkgconf. The yay part was confirmed from yay 13.0.1 source only.
Impact: users who keep build settings in an alternate makepkg config lose them during omarchy update.
Suggested change: skip the merged config when MAKEPKG_CONF or a yay makepkgconf is set (or start from that file), or note the limitation in the updater comment.
Other notes
Base conflict: the branch conflicts with quattro in bin/omarchy-update-aur-pkgs. #9467, merged after this commit was pushed, changed the same line to yay "${sudo_options[@]}" -Sua ... || exit 1, with a no-update sudo wrapper. A resolution needs to keep both the sudo options and || exit 1, as well as this PR's nice/ionice, environment values and --makepkgconf. One such resolution passed this PR's new test and the base's update-hook-security-test.sh (all 23 checks, matching the base control).
Optional test improvement: in test/shell.d/aur-update-jobs-test.sh:9, skip only prints a line, so the test keeps running. With /etc/makepkg.conf absent (simulated in copies of the updater and test), it printed the SKIP line, then failed the updater hands yay a merged makepkg.conf, and the harness listed the file as both skipped and failed. Other whole-file skips in the repository follow skip with exit 0.
Documentation note: the updated code comment addresses the earlier scope correction, but the PR description still says the change caps parallelism "so foreground work always keeps half the CPU". Its Testing section also says "unchanged yay arguments", which no longer holds now that --makepkgconf is added.
Review information
Test scope: head a873e0a374534c0b012276f7424196a2a22aaefd, compared with the first commit 47a2cc14 and merge base 8f324c90, and checked for conflicts against quattro at 7e8d35ef. Real makepkg 7.1.0 and GNU Make 4.4.1 ran synthetic PKGBUILDs through the unmodified updater. yay was replaced by a stub that passes the config to makepkg as yay 13.0.1's source does. Source was read for pacman 7.1.0 and yay 13.0.1. No real AUR package, Cargo, CMake or Ninja build, and no desktop-responsiveness measurement. The full ./test/shell suite was not re-run.
AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.
Opt out: To stop receiving these reviews, reply to this comment saying so.
AUR source builds like libsignal-client fully saturate small laptops at default priority. Lower their scheduling (nice 15, ionice best-effort-low) and cap cargo/cmake parallelism so interactive apps win mid-update.
makepkg sources its configuration after the environment, so a MAKEFLAGS set in /etc/makepkg.conf or the user makepkg.conf silently replaced the updater's per-update job cap. Hand yay a merged makepkg.conf that mirrors the system config, its drop-ins, and the user config, then asserts the selected job count last while keeping any unrelated make flags. Add shell tests covering the override, default, one-job floor, and skip paths.
a873e0a to
9a2d3e4
Compare
Resolution of the follow-up review (issuecomment-5856697923)Thanks — the Cap misses Cat-joining changed how makepkg loads configs; masked errors. The merged config is now a list of Custom Base conflict with Test skip. PR description. Reworded: the count is a job-count default for cooperating tools, not a guarantee that foreground work keeps half the CPU; the Testing section notes the Verification: |
Automated AI review
Outcome: a yay-saved Follow-up at A yay-saved
|
| Revision | MAKEFLAGS in build() |
Make result |
|---|---|---|
| merge base 97a9fce | -j4 -- OMARCHY_MAKEVAR=1 |
4 concurrent jobs, exit 0 |
| earlier head a873e0a | -j1 -- OMARCHY_MAKEVAR=1 |
1 job, exit 0 |
| head 9a2d3e4 | -j4 -- OMARCHY_MAKEVAR=1 -j1 |
No rule to make target '-j1', exit 2 |
MAKEFLAGS="-j4 --" gave the same exit 2 at the head. MAKEFLAGS="-j4 OMARCHY_MAKEVAR=1" (no --) was capped to 1 job and built.
A review-only patch that inserts the job option before the first standalone -- when there is one (and appends it otherwise) built every spelling tested (-j4, --jobs=4, --jobs 4, -j 4, -j4 --output-sync=recurse, --jobs, -j4 -- V=1, -j4 --) with 1 job, and the PR's 10 checks plus this block passed.
Reproducer: $MAKEPKG_CONF reference
Inside the generated config, $MAKEPKG_CONF names the temporary file
makepkg 7.1.0 sets MAKEPKG_CONF from --config (makepkg.sh.in:994) and sources the config with that variable in scope (libmakepkg/util/config.sh.in:35-39, 68-78). At 9a2d3e4 the updater passes its temporary file as --config. So while the real system or custom config, its drop-ins and the user file are sourced from that file, $MAKEPKG_CONF is the temporary path, not the real config path. A config that finds a companion file through the variable now looks next to the temporary file.
Reproducer (PR test style)
Append to test/shell.d/aur-update-jobs-test.sh and run bash test/shell.d/aur-update-jobs-test.sh. The MAKEPKG_CONF="$merged_config" prefix models what makepkg does with --config.
# makepkg sets MAKEPKG_CONF to its --config file before sourcing it, and a
# config can locate a companion file through that variable.
write_stub omarchy-pkg-aur-accessible 'exit 0'
companion_conf="$test_tmp/companion-makepkg.conf"
printf 'source "$MAKEPKG_CONF.local"\n' >"$companion_conf"
printf 'OMARCHY_PROBE_COMPANION=1\n' >"$companion_conf.local"
run_updater 1 8 "$companion_conf"
companion_seen=$(MAKEPKG_CONF="$merged_config" bash --noprofile --norc -c \
'source "$1" && printf "%s" "${OMARCHY_PROBE_COMPANION-}"' _ "$merged_config" 2>&1) || true
[[ $companion_seen == "1" ]] || fail "a config that finds files through \$MAKEPKG_CONF still finds them" "got: $companion_seen"
pass "a config that finds files through \$MAKEPKG_CONF still finds them"Actual output at 9a2d3e4
Run with a stock pacman 7.1.0 makepkg.conf (no MAKEFLAGS) standing in for /etc/makepkg.conf; stdout and stderr combined.
ok - explicit one-job override beats a configured MAKEFLAGS while keeping its flags
ok - a --jobs=N configuration is capped by the appended count
ok - a spaced -j N configuration is capped without breaking its argument
ok - default job count caps at half the cores
ok - job count floors at one job on a single-core machine
ok - OMARCHY_AUR_BUILD_JOBS overrides the default half-core count
ok - an alternate MAKEPKG_CONF file keeps its settings and is capped
ok - relative sources inside a user config keep resolving from that file
/tmp/tmp.gyfxFuwpSW/config/pacman/makepkg.conf: line 1: /missing/path.conf: No such file or directory
ok - a failing user config still aborts the build config load
ok - AUR updates are skipped when the AUR is unreachable
got: /tmp/tmp.gyfxFuwpSW/companion-makepkg.conf: line 1: /tmp/tmp.gyfxFuwpSW/merged-makepkg.conf.local: No such file or directory
not ok - a config that finds files through $MAKEPKG_CONF still finds them
exit status: 1
(In the real updater the temporary file is a mktemp name such as /tmp/tmp.XXXXXXXXXX; the test copies it to merged-makepkg.conf.)
End to end with real makepkg 7.1.0
yay replaced by a stub that runs makepkg as yay 13.0.1 does; OMARCHY_AUR_BUILD_JOBS=1.
| Setup | Merge base 97a9fce | Head 9a2d3e4 |
|---|---|---|
Custom MAKEPKG_CONF whose last line is source "$MAKEPKG_CONF.local" (.local sets a marker and MAKEFLAGS="-j2") |
builds, marker set, 2 jobs | makepkg exit 6 (log below), updater exit 1 |
| Same line followed by another setting | builds, marker set, 2 jobs | the same No such file or directory line, then builds without the .local settings (marker unset, -j1 -j1, 1 job) |
System config ending if [[ -r $MAKEPKG_CONF.local ]]; then source "$MAKEPKG_CONF.local"; fi |
marker set | silently skipped, marker unset |
Recorded $MAKEPKG_CONF while system file, drop-in and user file are sourced |
/etc/makepkg.conf stand-in for all three |
the temporary file for all three |
Exported custom MAKEPKG_CONF, value seen by a child process of build() |
the custom file | the temporary file |
makepkg log lines at the head for the first row (sandbox paths from the run):
/tmp/work/cases/head/Q1a/custom/c.conf: line 163: /tmp/work/tmp/tmp.YlRFrx9T5Z.local: No such file or directory
==> ERROR: Failed to source /tmp/work/tmp/tmp.YlRFrx9T5Z
Reproducer: test with host MAKEFLAGS
The new test fails when the host or caller already sets MAKEFLAGS
test/shell.d/aur-update-jobs-test.sh builds its merged config from the host's /etc/makepkg.conf and /etc/makepkg.conf.d/*.conf, and merged_makeflags (lines 75-77) evaluates it in a shell that inherits the caller's environment. The default-count checks (lines 110-127) expect exactly -j4, -j1 and -j2. When the system config, a drop-in or the caller's environment sets MAKEFLAGS (the Arch Wiki's makepkg page suggests setting it in makepkg.conf), the appended count follows that value and the file fails, although the updater behaves correctly.
Reproducer
On a machine whose /etc/makepkg.conf sets no MAKEFLAGS:
MAKEFLAGS=-j8 bash test/shell.d/aur-update-jobs-test.shActual output at 9a2d3e4
Run with a stock pacman 7.1.0 makepkg.conf (no MAKEFLAGS) standing in for /etc/makepkg.conf; stdout and stderr combined.
ok - explicit one-job override beats a configured MAKEFLAGS while keeping its flags
ok - a --jobs=N configuration is capped by the appended count
ok - a spaced -j N configuration is capped without breaking its argument
got: -j8 -j4
not ok - default job count is half the cores
exit status: 1
The same two failing lines appeared, with an empty environment, when the stand-in system config ended with MAKEFLAGS="-j8", and when a drop-in in its .d directory set MAKEFLAGS="-j8". For the updater, -j8 -j4 is the correct result (Make uses the last job option); only the test's expectation is host-dependent.
Details
Verified at 9a2d3e46 with real makepkg 7.1.0 and GNU Make 4.4.1 (yay replaced by a stub that calls makepkg as yay 13.0.1 does, synthetic system config):
- With
OMARCHY_AUR_BUILD_JOBS=1, user configs-j4,--jobs=4,--jobs 4,-j 4,-j4 --output-sync=recurseand bare--jobseach ran 1 job;-j 4builds again. - A last line without a final newline, a trailing comment, a
BASH_SOURCE-relative include and a failingsourceon the last line behave as at the merge base (the failingsourceagain makes makepkg exit 6 and the updater exit 1). - A custom
MAKEPKG_CONFkeeps its settings and drop-ins, the user file is not read on top of it, and the job count is capped. - yay and
build()run at niceness 15 and best-effort I/O priority 7; the temporary file is removed after success, a yay failure, and TERM, INT or HUP. sudo_optionsand|| exit 1are kept after the rebase;update-hook-security-test.shpasses 23/23 at head and base. The new test fails against thea873e0a3updater.
Optional notes:
OMARCHY_AUR_BUILD_JOBS=0produces-j0, which Make rejects (the '-j' option requires a positive integer argument); validating a positive integer would avoid it.- The test does not check
nice/ionice(a mutant without them passes all 10 checks), although the PR's Testing section lists "the priority drop". The comment at test lines 131-132 says the user file is not read with a customMAKEPKG_CONF, but the user file is empty at that point, so a mutant that reads it also passes. bin/omarchy-update-aur-pkgsloses its final newline and the new test has none; every file inbin/on the base branchquattroends with one.
Review information
Test scope: source and sandbox runs at 9a2d3e46 with real makepkg 7.1.0 and GNU Make 4.4.1; no real AUR build.
AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.
Opt out: To stop receiving these reviews, reply to this comment saying so.
A makepkgconf saved in yay's own configuration was silently replaced by the merge config, contradicting the comment. Start it from yay's effective value (yay -Pg) when one is saved. Restore to the real config path while the real files are sourced so companion-file references keep working, and to the generated path afterwards. Emit source lines for drop-ins by existence so an unreadable one still aborts the load as makepkg does, insert the job option before a standalone -- section instead of appending after it (Make reads post--- words as targets), fall back to one job for a non-positive OMARCHY_AUR_BUILD_JOBS, and harden the tests (niceness check, yay -Pg stub, make smoke tests, host-independent MAKEFLAGS assertions).
Resolution of review 5920132399All findings addressed in commit yay-saved Unreadable drop-in no longer stops makepkg. The merged config now emits
Configs that reference Optional notes. Verification: 16/16 checks in |
|
The updater replaced an exported MAKEFLAGS with -jN at the yay boundary, even when no makepkg config assigns one, dropping flags and variable assignments such as CC=clang. Stop setting MAKEFLAGS on the invocation: the merged config already appends the cap to whatever survives into makepkg (exported value, then any config assignment), so an export is preserved and still capped. Point the system makepkg config at TEST_MAKEPKG_CONF when set so the tests run from a sandbox config instead of skipping on hosts without a readable /etc/makepkg.conf, and add a test asserting the exported value reaches the yay boundary and the merged config unchanged.
A TEST_MAKEPKG_CONF honored by the updater could leak into real updates when inherited: a readable test path would load the wrong configuration, and an unreadable one would skip the cap even when /etc/makepkg.conf is usable. Drop the hook; the test suite is hermetic by construction instead, with sandboxed user configs overriding the system file in the merged config's own resolution order and a custom MAKEPKG_CONF driving the exported-flags case, so nothing test-only exists in production code paths.
Summary
omarchy-updateruns AUR source builds (via yay/makepkg) at default process priority with unbounded build parallelism. A heavy source build — e.g.libsignal-client's cargo + cmake stack — can therefore compete head-to-head with foreground apps for the CPU while it compiles: observed on a 4-thread machine, load average reached ~10, PSI cpusomesat at ~56%, and interactive apps (editor, terminal, compositor) were effectively frozen until the build finished.This change treats updates as background work: the AUR build step runs at lowered CPU and I/O priority — costless when the machine is otherwise idle — and offers build tools a default job count of half the machine's cores, so a source build stops elbowing interactive apps for the whole machine. The count is delivered through each tool's usual variable (Make, CMake, Cargo) as a default; tools that ignore those variables are not capped, so this is polite backgrounding rather than a hard guarantee.
Changes
bin/omarchy-update-aur-pkgsyaynow runs undernice -n 15 ionice -c 2 -n 7(inherited by makepkg, rustc, cc, cmake and ninja)CARGO_BUILD_JOBSandCMAKE_BUILD_PARALLEL_LEVELdefault tonproc / 2(floor 1) via the environmentOMARCHY_AUR_BUILD_JOBS(validated as a positive integer; non-positive falls back to 1)--makepkgconf) that sources the real configuration files from their own paths —$MAKEPKG_CONF(or/etc/makepkg.conf; amakepkgconfsaved in yay's own configuration is honored by starting from yay's effective value,yay -Pg), its drop-ins, then the user file — and appends-jNjust before any standalone--(or last), where GNU Make reads the final job option as the effective one regardless of spelling (-jN,-j N,--jobs=N,--jobs N).MAKEFLAGSis preserved: the updater never replaces it, so flags and assignments such asCC=clangsurvive into makepkg and the cap is appended to whatever is effective after configuration loads. Unrelated Make flags stay intact, relative sources inside a config keep resolving from that file's own path,$MAKEPKG_CONFnames the real config path while the real files are sourced, a config file that fails to source (including an unreadable drop-in) still aborts the build as it does without this file, and the temporary config is removed on every exit path.Testing
bash -nsyntax check clean.test/shell.d/aur-update-jobs-test.sh(new): mocked-PATHharness with stubbedpacman,omarchy-pkg-aur-accessible,yayandnproc, host-independent by construction (sandboxed user configs override the system file in the merged config's own resolution order; customMAKEPKG_CONFs fully replace it; default-count checks assert only the appended count). Covers the priority drop (niceness 15 asserted), the env caps (nproc 8 → 4 jobs, floor 1,OMARCHY_AUR_BUILD_JOBS=2→ 2), the one-job override beating everyMAKEFLAGSspelling (incl.-j 4,--jobs=4and a standalone--section, each smoke-built with real Make), an exportedMAKEFLAGSpreserved at the yay boundary and capped in the merged config, a non-positive override falling back to one job, an alternateMAKEPKG_CONFfile keeping its settings (user file not read on top), a yay-savedmakepkgconfhonored, relative config includes,$MAKEPKG_CONFcompanion references, config-error propagation, an unreadable drop-in aborting the load, and the unreachable-AUR skip path.test/shell.d/update-hook-security-test.sh(base): all checks pass — thesudo_optionswrapper and|| exit 1coexist with the new invocation../test/shelland./test/clifailure sets are identical to thequattrobase control on the same machine.yay -Suarun on a current system reported "there is nothing to do" — no system changes.