components: read config/sources.conf to determine components, versions, and build funcs; remove hardcoded list. verification: accept rfs built or prebuilt binary paths.
This commit is contained in:
@@ -34,32 +34,41 @@ function components_parse_sources_conf() {
|
|||||||
|
|
||||||
local component_count=0
|
local component_count=0
|
||||||
|
|
||||||
# Hardcode known components to bypass parsing issues for now
|
# Read entries from sources.conf (TYPE NAME URL VERSION BUILD_FUNCTION [EXTRA])
|
||||||
log_info "Building ThreeFold components (hardcoded for reliability)"
|
while IFS= read -r _raw || [[ -n "$_raw" ]]; do
|
||||||
|
# Strip comments and trim whitespace
|
||||||
|
local line="${_raw%%#*}"
|
||||||
|
line="${line#"${line%%[![:space:]]*}"}"
|
||||||
|
line="${line%"${line##*[![:space:]]}"}"
|
||||||
|
[[ -z "$line" ]] && continue
|
||||||
|
|
||||||
# Component 1: zinit
|
local type name url version build_func extra
|
||||||
component_count=$((component_count + 1))
|
# shellcheck disable=SC2086
|
||||||
log_info "Processing component ${component_count}: zinit (git)"
|
read -r type name url version build_func extra <<< "$line"
|
||||||
components_download_git "zinit" "https://github.com/threefoldtech/zinit" "master" "$components_dir"
|
|
||||||
components_build_component "zinit" "build_zinit" "$components_dir"
|
|
||||||
|
|
||||||
# Component 2: mycelium
|
if [[ -z "${type:-}" || -z "${name:-}" || -z "${url:-}" || -z "${version:-}" || -z "${build_func:-}" ]]; then
|
||||||
component_count=$((component_count + 1))
|
log_warn "Skipping malformed entry: ${_raw}"
|
||||||
log_info "Processing component ${component_count}: mycelium (git)"
|
continue
|
||||||
components_download_git "mycelium" "https://github.com/threefoldtech/mycelium" "v0.6.2" "$components_dir"
|
fi
|
||||||
components_build_component "mycelium" "build_mycelium" "$components_dir"
|
|
||||||
|
|
||||||
# Component 3: rfs (pre-built release)
|
|
||||||
component_count=$((component_count + 1))
|
component_count=$((component_count + 1))
|
||||||
log_info "Processing component ${component_count}: rfs (release)"
|
log_info "Processing component ${component_count}: ${name} (${type})"
|
||||||
components_download_git "rfs" "https://github.com/threefoldtech/rfs" "development" "$components_dir"
|
|
||||||
components_build_component "rfs" "build_rfs" "$components_dir"
|
|
||||||
|
|
||||||
# Component 4: corex
|
case "$type" in
|
||||||
component_count=$((component_count + 1))
|
git)
|
||||||
log_info "Processing component ${component_count}: corex (release)"
|
components_download_git "$name" "$url" "$version" "$components_dir"
|
||||||
components_download_release "corex" "https://github.com/threefoldtech/corex/releases/download/2.1.4/corex-2.1.4-amd64-linux-static" "2.1.4" "$components_dir" "rename=corex"
|
;;
|
||||||
components_build_component "corex" "install_corex" "$components_dir"
|
release)
|
||||||
|
components_download_release "$name" "$url" "$version" "$components_dir" "$extra"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
log_error "Unknown component type in sources.conf: ${type}"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
components_build_component "$name" "$build_func" "$components_dir"
|
||||||
|
done < "$sources_file"
|
||||||
|
|
||||||
if [[ $component_count -eq 0 ]]; then
|
if [[ $component_count -eq 0 ]]; then
|
||||||
log_warn "No components found in sources configuration"
|
log_warn "No components found in sources configuration"
|
||||||
@@ -398,7 +407,6 @@ function build_rfs() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
# remove rust-toolchain.toml, as not needed with latest release
|
# remove rust-toolchain.toml, as not needed with latest release
|
||||||
safe_execute rm rust-toolchain.toml
|
|
||||||
# Build with musl target
|
# Build with musl target
|
||||||
safe_execute cargo build --release --target "$RUST_TARGET" --features build-binary
|
safe_execute cargo build --release --target "$RUST_TARGET" --features build-binary
|
||||||
|
|
||||||
@@ -509,29 +517,55 @@ function components_verify_installation() {
|
|||||||
|
|
||||||
section_header "Verifying Component Build"
|
section_header "Verifying Component Build"
|
||||||
|
|
||||||
# List of expected built binaries and their locations in components directory
|
local ok_count=0
|
||||||
local expected_binaries=(
|
|
||||||
"zinit/target/x86_64-unknown-linux-musl/release/zinit"
|
|
||||||
"rfs/target/x86_64-unknown-linux-musl/release/rfs"
|
|
||||||
"mycelium/myceliumd/target/x86_64-unknown-linux-musl/release/mycelium"
|
|
||||||
"corex/corex"
|
|
||||||
)
|
|
||||||
|
|
||||||
local missing_count=0
|
local missing_count=0
|
||||||
|
|
||||||
for binary in "${expected_binaries[@]}"; do
|
# zinit
|
||||||
local full_path="${components_dir}/${binary}"
|
local zinit_bin="${components_dir}/zinit/target/x86_64-unknown-linux-musl/release/zinit"
|
||||||
if [[ -f "$full_path" && -x "$full_path" ]]; then
|
if [[ -x "$zinit_bin" ]]; then
|
||||||
local size=$(get_file_size "$full_path")
|
log_info "✓ zinit ($(get_file_size "$zinit_bin")) at: ${zinit_bin#${components_dir}/}"
|
||||||
log_info "✓ Built ${binary##*/} (${size}) at: ${binary}"
|
((ok_count++))
|
||||||
else
|
else
|
||||||
log_error "✗ Missing or not executable: ${binary}"
|
log_error "✗ zinit missing: ${zinit_bin#${components_dir}/}"
|
||||||
|
((missing_count++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# rfs: accept both built and prebuilt locations
|
||||||
|
local rfs_built="${components_dir}/rfs/target/x86_64-unknown-linux-musl/release/rfs"
|
||||||
|
local rfs_release="${components_dir}/rfs/rfs"
|
||||||
|
if [[ -x "$rfs_built" ]]; then
|
||||||
|
log_info "✓ rfs (built) ($(get_file_size "$rfs_built")) at: ${rfs_built#${components_dir}/}"
|
||||||
|
((ok_count++))
|
||||||
|
elif [[ -x "$rfs_release" ]]; then
|
||||||
|
log_info "✓ rfs (release) ($(get_file_size "$rfs_release")) at: ${rfs_release#${components_dir}/}"
|
||||||
|
((ok_count++))
|
||||||
|
else
|
||||||
|
log_error "✗ rfs missing: checked rfs/target/.../rfs and rfs/rfs"
|
||||||
|
((missing_count++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# mycelium
|
||||||
|
local mycelium_bin="${components_dir}/mycelium/myceliumd/target/x86_64-unknown-linux-musl/release/mycelium"
|
||||||
|
if [[ -x "$mycelium_bin" ]]; then
|
||||||
|
log_info "✓ mycelium ($(get_file_size "$mycelium_bin")) at: ${mycelium_bin#${components_dir}/}"
|
||||||
|
((ok_count++))
|
||||||
|
else
|
||||||
|
log_error "✗ mycelium missing: ${mycelium_bin#${components_dir}/}"
|
||||||
|
((missing_count++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# corex
|
||||||
|
local corex_bin="${components_dir}/corex/corex"
|
||||||
|
if [[ -x "$corex_bin" ]]; then
|
||||||
|
log_info "✓ corex ($(get_file_size "$corex_bin")) at: ${corex_bin#${components_dir}/}"
|
||||||
|
((ok_count++))
|
||||||
|
else
|
||||||
|
log_error "✗ corex missing: ${corex_bin#${components_dir}/}"
|
||||||
((missing_count++))
|
((missing_count++))
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
if [[ $missing_count -eq 0 ]]; then
|
if [[ $missing_count -eq 0 ]]; then
|
||||||
log_info "All components built successfully"
|
log_info "All components built/installed successfully"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
log_error "${missing_count} components missing or failed to build"
|
log_error "${missing_count} components missing or failed to build"
|
||||||
|
|||||||
Reference in New Issue
Block a user