Skip to content

Move Alpine's repository setup into the guest prelude #102

Description

@NovusEdge

Problem

Four bundled recipes carry the same Alpine repository setup. devtools,
build-deps, service-tools, and pkg-tools each open install-alpine.sh
with the same loop:

n=0
until setup-apkrepos -c -1; do
    n=$((n + 1))
    [ "$n" -ge 30 ] && { echo "apk database stayed locked; giving up" >&2; exit 1; }
    sleep 2
done

Each copy carries a different comment, and each one skips stoat_pkg_setup.
The Global Constraints for a bundled recipe say every script calls
stoat_pkg_setup before it installs, so all four scripts state an exception.

Cause

Alpine's guest prelude defines stoat_pkg_setup as apk update. That command
does not enable the community repository, and it does not wait for the apk
database lock. setup-apkrepos -c -1 does both. No recipe wants what the
prelude offers, so every recipe replaced it.

Proposal

Move the loop into Alpine's stoat_pkg_setup in
internal/guest/bundled/alpine.toml. The four scripts then call
stoat_pkg_setup like the scripts for every other guest, the exception
disappears, and the retry behaviour has one definition.

Acceptance criteria

  • internal/guest/bundled/alpine.toml performs the mirror selection, the
    community repository, the index refresh, and the lock retry.
  • The four install-alpine.sh scripts call stoat_pkg_setup and hold no
    repository logic.
  • A test covers the retry: a locked database returns non-zero, and the setup
    verb tries again.
  • The Alpine row of the recipe live matrix passes with the recipes selected
    together.

Evidence

Found by the whole-branch review of #100. The duplication is byte-identical
apart from the comments.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

guestguest OS supportrecipesbundled or index recipes

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions