fix(bifrost): detect package manager for non-Debian Linux hosts - #709
Open
Jon-Becker wants to merge 1 commit into
Open
fix(bifrost): detect package manager for non-Debian Linux hosts#709Jon-Becker wants to merge 1 commit into
Jon-Becker wants to merge 1 commit into
Conversation
The installer unconditionally assumed a Debian host, probing packages with `dpkg` and installing build dependencies with `sudo apt-get`. On non-Debian Linux (e.g. ARM64 Amazon Linux 2023, which ships `dnf`/`yum` and no `apt-get`) this aborted before heimdall could build, forcing manual binary-path workarounds. Detect the host package manager (apt-get, dnf, yum, pacman, zypper, apk), preferring apt-get so existing Debian/Ubuntu behavior is preserved, and map the OpenSSL headers + C toolchain to the correct packages for each. When no supported package manager is found, print actionable guidance instead of silently invoking the wrong one. Both x86_64 and aarch64 hosts are supported. Add a sourceable guard plus a network/root-free regression suite covering the detection and install-command decisions, and document supported platforms.
Contributor
❌ Eval Report for 4a8537e
|
Contributor
|
| Metric | Value |
|---|---|
| Base branch | 66.26% |
| PR branch | 66.15% |
| Diff | -0.12% |
Contributor
Benchmark for 4a8537eClick to view benchmark
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed? Why?
Reproduction: On an ARM64/aarch64 Linux host running Amazon Linux 2023, the bundled
bifrostinstaller aborted before heimdall could build. Itsensure_apt_packagehelper ran on every Linux host and probed packages withdpkg -l, then installed build dependencies withsudo apt-get install -y. Amazon Linux 2023 shipsdnf/yumand has neitherdpkgnorapt-get, so the step failed and forced a manual binary-path workaround before the native aarch64 binary (heimdall-cli v0.9.2) could be compiled.Root cause: The installer's supported-platform contract silently assumed Debian/Ubuntu for all of Linux. Package existence checks (
dpkg) and installation (apt-get) were hard-coded, and the Debian-only package names (libssl-dev,build-essential) had no equivalent mapping for other distributions.Fix:
bifrostnow detects the host package manager —apt-get,dnf,yum,pacman,zypper, orapk— preferringapt-getso existing Debian/Ubuntu behavior is unchanged. It maps the required OpenSSL development headers and C toolchain to the correct package names per manager and runs that manager's non-interactive install command. If no supported package manager is detected, it prints the dependencies to install manually rather than silently invoking the wrong one. Architecture selection (x86_64/amd64 and aarch64/arm64) for the pre-compiled--binarypath was already correct and is unchanged; the release workflow already publishes alinux-arm64artifact.Remaining platform limitations: Distribution support is limited to hosts providing one of the six package managers above; anything else falls back to a manual-install message (no automated dependency installation). Live end-to-end installation was verified only for the Amazon Linux 2023 aarch64 reproduction and the preserved Debian
apt-getdecision — the other package managers are covered by decision-level tests, not live installs on each distro. macOS/other non-Linux hosts continue to assume the toolchain and OpenSSL are provided by the system (or homebrew).Notes to reviewers
Key changes:
bifrost/bifrost— replacedensure_apt_packagewithdetect_package_manager,build_dependency_packages,package_install_command, andensure_build_dependencies; added aBASH_SOURCEguard so the script can be sourced by tests without runningmain.bifrost/tests/bifrost-tests— new regression suite (no.shextension, since the repo.gitignoreexcludes*.sh).bifrost/README.md— new "Supported platforms" section;README.md— brief platform-support note.How has it been tested?
bash bifrost/tests/bifrost-tests— 16 assertions, all passing. Tests mock package managers via fake executables on a controlledPATH, so they require noapt-get, root, network, or particular host distribution. Coverage includes: apt-get preferred when multiple managers coexist (Debian preserved);dnfdetected on the Amazon Linux 2023 reproduction with the resolved command asserted to never containapt-get;yum/pacman/zypper/apkdetection; unsupported-host yields no command; and the exact Debian package list/install command are unchanged.bash -nsyntax check passes on the installer and test script.