- fetch_recipe_from_repos() iterates repos by priority, channels, with
mirror fallback — caches indexes at /cache/indexes/
- Conditional HTTP downloads (curl -z) to only re-fetch stale indexes
- build_registry and fetch-package prefer repos { } over remotes = [...]
when both are present
- Fallback chain: local .kap → repos (index-aware) → remotes (legacy)
27 lines
800 B
C++
27 lines
800 B
C++
#pragma once
|
|
|
|
#include "kappa/dsl/system.hpp"
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace kappa::fetch {
|
|
|
|
struct RecipeResult {
|
|
bool ok = false;
|
|
std::string path; // path to the cached .kap file
|
|
std::string version; // version of the fetched package
|
|
bool updated = false; // true if the cache was updated (remote was newer)
|
|
std::string error;
|
|
};
|
|
|
|
// Legacy: flat URL list (backward compat with remotes = [...])
|
|
RecipeResult fetch_recipe(const std::string& name,
|
|
const std::vector<std::string>& remotes);
|
|
|
|
// Index-aware: named repos with channels, mirrors, and cached indexes
|
|
RecipeResult fetch_recipe_from_repos(const std::string& name,
|
|
const std::vector<dsl::RepoDef>& repos);
|
|
|
|
} // namespace kappa::fetch
|