fix: strip arch suffix on install, fix doubled org in github_url
- bakery: strip -x86_64 / -aarch64 / -arm64 / -armv7 suffix when placing binary so `breadcrumbs-x86_64` installs as `breadcrumbs` - gen-index.sh: GH_BASE was "github.com/Breadway" but repo slugs already include the org, producing doubled paths; change to "github.com"
This commit is contained in:
parent
165e797cec
commit
bb1671cada
2 changed files with 14 additions and 3 deletions
|
|
@ -12,9 +12,10 @@ pub fn install_package(pkg: &Package, bin_dir: &Path) -> Result<()> {
|
||||||
// 1. Download and verify all binaries.
|
// 1. Download and verify all binaries.
|
||||||
let mut binary_names = Vec::new();
|
let mut binary_names = Vec::new();
|
||||||
for bin in &pkg.binaries {
|
for bin in &pkg.binaries {
|
||||||
let dest = bin_dir.join(&bin.name);
|
let install_name = strip_arch_suffix(&bin.name);
|
||||||
|
let dest = bin_dir.join(&install_name);
|
||||||
fetch_and_place(bin, &dest)?;
|
fetch_and_place(bin, &dest)?;
|
||||||
binary_names.push(bin.name.clone());
|
binary_names.push(install_name.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Scaffold config dir + example file.
|
// 2. Scaffold config dir + example file.
|
||||||
|
|
@ -240,6 +241,16 @@ fn expand_tilde(path: &str) -> PathBuf {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn strip_arch_suffix(name: &str) -> &str {
|
||||||
|
const SUFFIXES: &[&str] = &["-x86_64", "-aarch64", "-arm64", "-armv7"];
|
||||||
|
for s in SUFFIXES {
|
||||||
|
if let Some(base) = name.strip_suffix(s) {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
name
|
||||||
|
}
|
||||||
|
|
||||||
fn warn_path_if_needed(bin_dir: &Path) {
|
fn warn_path_if_needed(bin_dir: &Path) {
|
||||||
let path_var = std::env::var("PATH").unwrap_or_default();
|
let path_var = std::env::var("PATH").unwrap_or_default();
|
||||||
let bin_str = bin_dir.to_string_lossy();
|
let bin_str = bin_dir.to_string_lossy();
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ set -euo pipefail
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
DL_DIR="${DL_DIR:-/srv/breadway-dl}"
|
DL_DIR="${DL_DIR:-/srv/breadway-dl}"
|
||||||
DL_BASE="${DL_BASE:-https://dl.breadway.dev}"
|
DL_BASE="${DL_BASE:-https://dl.breadway.dev}"
|
||||||
GH_BASE="https://github.com/Breadway"
|
GH_BASE="https://github.com"
|
||||||
OUT="${DL_DIR}/index.json"
|
OUT="${DL_DIR}/index.json"
|
||||||
|
|
||||||
# Products are read from the registry. Each line is "name repo".
|
# Products are read from the registry. Each line is "name repo".
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue