🐛 fix(channel): require every region fragment for dev
- 🐛 leaving dev refreshes stable or rc with the checkout's tools, so a profile missing those fragments would drop regional repositories - ✅ refuse a profile missing any single fragment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QuATgjU4mnqpqSLAKMQ14g
This commit is contained in:
1 parent
fce85abf48
commit
9d74c813f1
2 files changed
+27
-6
No files matched your search
@@ -55,10 +55,15 @@ validate_dev_region() {
|
|||||||
[[ -f $region_file ]] && region=$(<"$region_file")
|
[[ -f $region_file ]] && region=$(<"$region_file")
|
||||||
[[ $region == "global" ]] && return 0
|
[[ $region == "global" ]] && return 0
|
||||||
|
|
||||||
# The refresh after linking needs a runnable helper and the edge fragments
|
# The refresh after linking needs a runnable helper and every fragment, not
|
||||||
# dev uses, not just a directory with the region's name.
|
# just a directory with the region's name: dev refreshes edge, and leaving
|
||||||
local profile="$checkout/default/regions/$region/pacman"
|
# dev later refreshes stable or rc with this checkout's tools.
|
||||||
if [[ ! -x $checkout/bin/omarchy-apply-pacman || ! -r $profile/pacman.conf.append || ! -r $profile/mirrorlist-edge.prepend ]]; then
|
local profile="$checkout/default/regions/$region/pacman" fragment supported=true
|
||||||
|
[[ -x $checkout/bin/omarchy-apply-pacman ]] || supported=false
|
||||||
|
for fragment in pacman.conf.append mirrorlist-stable.prepend mirrorlist-rc.prepend mirrorlist-edge.prepend; do
|
||||||
|
[[ -r $profile/$fragment ]] || supported=false
|
||||||
|
done
|
||||||
|
if ! $supported; 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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,7 +213,23 @@ if grep -Eq $'^(link|refresh)\t' "$log_file"; then
|
|||||||
fail "dev refuses an empty region profile before linking or refreshing pacman" "$(cat "$log_file")"
|
fail "dev refuses an empty region profile before linking or refreshing pacman" "$(cat "$log_file")"
|
||||||
fi
|
fi
|
||||||
mkdir -p "$checkout/default/regions/cn/pacman"
|
mkdir -p "$checkout/default/regions/cn/pacman"
|
||||||
touch "$checkout/default/regions/cn/pacman/pacman.conf.append" "$checkout/default/regions/cn/pacman/mirrorlist-edge.prepend"
|
cn_fragments=(pacman.conf.append mirrorlist-stable.prepend mirrorlist-rc.prepend mirrorlist-edge.prepend)
|
||||||
|
for missing in "${cn_fragments[@]}"; do
|
||||||
|
for fragment in "${cn_fragments[@]}"; do
|
||||||
|
if [[ $fragment == "$missing" ]]; then
|
||||||
|
rm -f "$checkout/default/regions/cn/pacman/$fragment"
|
||||||
|
else
|
||||||
|
touch "$checkout/default/regions/cn/pacman/$fragment"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
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 region profile without $missing"
|
||||||
|
fi
|
||||||
|
if grep -Eq $'^(link|refresh)\t' "$log_file"; then
|
||||||
|
fail "dev refuses a profile without $missing before linking or refreshing pacman" "$(cat "$log_file")"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
touch "${cn_fragments[@]/#/$checkout/default/regions/cn/pacman/}"
|
||||||
chmod -x "$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
|
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"
|
fail "dev refuses a checkout whose pacman helper cannot run"
|
||||||
@@ -221,7 +237,7 @@ fi
|
|||||||
if grep -Eq $'^(link|refresh)\t' "$log_file"; then
|
if grep -Eq $'^(link|refresh)\t' "$log_file"; then
|
||||||
fail "dev refuses incomplete region support before linking or refreshing pacman" "$(cat "$log_file")"
|
fail "dev refuses incomplete region support before linking or refreshing pacman" "$(cat "$log_file")"
|
||||||
fi
|
fi
|
||||||
pass "dev refuses an empty region profile or a helper that cannot run"
|
pass "dev refuses a region profile missing any fragment or a helper that cannot run"
|
||||||
|
|
||||||
chmod +x "$checkout/bin/omarchy-apply-pacman"
|
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
|
||||||
|
|||||||
Reference in new issue
Block a user