🐛 fix(channel): require a usable region profile for dev
- 🐛 an empty profile directory or a helper that cannot run passed the guard, linked dev, and then broke the refresh - ✅ the success case now uses a complete profile Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SdXqTwm63rRMwotZ1xqLC8
This commit is contained in:
1 parent
6be88d14a5
commit
7a60c8dea4
2 files changed
+25
-1
No files matched your search
@@ -55,7 +55,10 @@ validate_dev_region() {
|
|||||||
[[ -f $region_file ]] && region=$(<"$region_file")
|
[[ -f $region_file ]] && region=$(<"$region_file")
|
||||||
[[ $region == "global" ]] && return 0
|
[[ $region == "global" ]] && return 0
|
||||||
|
|
||||||
if [[ ! -f $checkout/bin/omarchy-apply-pacman || ! -d $checkout/default/regions/$region ]]; then
|
# The refresh after linking needs a runnable helper and both fragments, not
|
||||||
|
# just a directory with the region's name.
|
||||||
|
local profile="$checkout/default/regions/$region/pacman"
|
||||||
|
if [[ ! -x $checkout/bin/omarchy-apply-pacman || ! -r $profile/pacman.conf.append || ! -r $profile/mirrorlist.append ]]; then
|
||||||
fail "$checkout does not support the '$region' region, so switching would drop its package repositories. Check out a branch with default/regions/$region, or remove $region_file to use global defaults."
|
fail "$checkout does not support the '$region' region, so switching would drop its package repositories. Check out a branch with default/regions/$region, or remove $region_file to use global defaults."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,8 +201,29 @@ if grep -Eq $'^(link|refresh)\t' "$log_file"; then
|
|||||||
fi
|
fi
|
||||||
pass "dev refuses a checkout without the region before touching pacman"
|
pass "dev refuses a checkout without the region before touching pacman"
|
||||||
|
|
||||||
|
# A directory with the region's name, or a helper that cannot run, is not
|
||||||
|
# support: the refresh after linking would fail with dev already linked.
|
||||||
mkdir -p "$checkout/default/regions/cn"
|
mkdir -p "$checkout/default/regions/cn"
|
||||||
touch "$checkout/bin/omarchy-apply-pacman"
|
touch "$checkout/bin/omarchy-apply-pacman"
|
||||||
|
chmod +x "$checkout/bin/omarchy-apply-pacman"
|
||||||
|
if OMARCHY_TEST_REGION_FILE="$test_tmp/region" run_channel dev >"$test_tmp/region.out" 2>"$test_tmp/region.err"; then
|
||||||
|
fail "dev refuses an empty region profile"
|
||||||
|
fi
|
||||||
|
if grep -Eq $'^(link|refresh)\t' "$log_file"; then
|
||||||
|
fail "dev refuses an empty region profile before linking or refreshing pacman" "$(cat "$log_file")"
|
||||||
|
fi
|
||||||
|
mkdir -p "$checkout/default/regions/cn/pacman"
|
||||||
|
touch "$checkout/default/regions/cn/pacman/pacman.conf.append" "$checkout/default/regions/cn/pacman/mirrorlist.append"
|
||||||
|
chmod -x "$checkout/bin/omarchy-apply-pacman"
|
||||||
|
if OMARCHY_TEST_REGION_FILE="$test_tmp/region" run_channel dev >"$test_tmp/region.out" 2>"$test_tmp/region.err"; then
|
||||||
|
fail "dev refuses a checkout whose pacman helper cannot run"
|
||||||
|
fi
|
||||||
|
if grep -Eq $'^(link|refresh)\t' "$log_file"; then
|
||||||
|
fail "dev refuses incomplete region support before linking or refreshing pacman" "$(cat "$log_file")"
|
||||||
|
fi
|
||||||
|
pass "dev refuses an empty region profile or a helper that cannot run"
|
||||||
|
|
||||||
|
chmod +x "$checkout/bin/omarchy-apply-pacman"
|
||||||
OMARCHY_TEST_REGION_FILE="$test_tmp/region" run_channel dev
|
OMARCHY_TEST_REGION_FILE="$test_tmp/region" run_channel dev
|
||||||
assert_log_line $'refresh\tedge' "dev proceeds with a checkout that supports the region"
|
assert_log_line $'refresh\tedge' "dev proceeds with a checkout that supports the region"
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user