repolayout

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package repolayout resolves rpm-repo-set templates and expands them into a concrete list of repo URLs for the `azldev repo` subcommands. Callers supply the templates map (typically `Resources.RpmRepoSetTemplates` from a loaded `*projectconfig.ProjectConfig`), so user/project overrides on top of the embedded defaults flow through naturally.

Index

Constants

This section is empty.

Variables

View Source
var DefaultArches = []string{"x86_64", "aarch64"}

DefaultArches is the per-arch expansion used when the user does not pass `--arch`.

Functions

func NormalizePrefix

func NormalizePrefix(prefix string) (string, error)

NormalizePrefix validates prefix as an http://, https://, or file:// URL. Bare paths are rejected. The returned string is the parsed URL re-serialized, so callers downstream can safely pass it to url.JoinPath.

func ResolveTemplate

func ResolveTemplate(
	templates map[string]projectconfig.RpmRepoSetTemplate, name string,
) (projectconfig.RpmRepoSetTemplate, error)

ResolveTemplate looks up name in the supplied templates map (typically `Resources.RpmRepoSetTemplates` from a loaded project config, which already has the embedded defaults — `azl-standard`, `koji-dist-repo` — merged in along with any project/user overrides). Errors when the template is not defined. The returned template is a copy; callers may mutate it freely.

func SubstituteBasearch

func SubstituteBasearch(raw, arch string) string

SubstituteBasearch replaces every `$basearch` occurrence in raw with arch. Used by the version-mode resolver to bake the host arch into a URL whose shape carries `$basearch` literally (dnf would substitute on its own, but our probe layer needs a concrete URL).

Types

type InputRepo

type InputRepo struct {
	// TemplateName is the rpm-repo-set-template the repo was expanded from.
	TemplateName string
	// SubrepoName is the [projectconfig.SubrepoSpec.Name] this repo was expanded from.
	SubrepoName string
	// Kind mirrors [projectconfig.SubrepoSpec.Kind], defaulted.
	Kind projectconfig.SubrepoKind
	// Arch is the substituted `$basearch` value, or "" when the subpath has no
	// `$basearch` (e.g., a single source/SRPM repo).
	Arch string
	// URL is the fully-resolved repo base URL.
	URL string
	// RepoID is the dnf repo id used to wire this slot up via --repofrompath /
	// --enablerepo. Callers are expected to set it before passing the row to
	// the dnf pipeline.
	RepoID string
	// GPGKey, when non-empty, is forwarded to dnf as --setopt=<id>.gpgkey=...
	// alongside gpgcheck=1. Only meaningful when the caller resolved this
	// repo from project config; the prefix-driven path leaves it empty.
	GPGKey string
}

InputRepo is one concrete (post-`$basearch`-expansion) upstream repo to query.

func DedupInputRepos

func DedupInputRepos(repos []InputRepo) []InputRepo

DedupInputRepos drops duplicate entries by URL while preserving order.

func ExpandTemplate

func ExpandTemplate(
	prefix, templateName string,
	tmpl projectconfig.RpmRepoSetTemplate,
	arches []string,
) []InputRepo

ExpandTemplate expands a template into one InputRepo per sub-repo, fanning out per arch where the subpath contains `$basearch`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL