repo

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package repo registers extra distribution repositories (apt sources or dnf/yum repos) on the build host before any package manager operation. It supports configuration via yap.json (top-level "repos" array) and via the repeatable `--repo key=val,...` command-line flag.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(distro string, repos []Repo) error

Setup writes apt/dnf repository definitions for every Repo applicable to the current distro. distro is the bare distro key (e.g. "ubuntu", "rocky"); only repos with empty Distros, or whose Distros entry matches, are installed. Repos that target a different package format than the active distro are silently skipped.

func SetupCrossAPT

func SetupCrossAPT(opts CrossAptOptions) error

SetupCrossAPT prepares the apt configuration for cross-architecture builds. On Debian-like hosts it:

  1. enables the target architecture via dpkg --add-architecture;
  2. restricts the pre-installed sources to the build-host architecture so apt does not fetch foreign-arch indexes from archive.ubuntu.com (which only carries amd64/i386);
  3. registers the matching ports.ubuntu.com / deb.debian.org repository for the target arch through the standard repo.Setup pipeline; and
  4. refreshes the apt indexes so subsequent dependency installs resolve packages from the new repo.

The function is a no-op when the host already runs on the requested target architecture or when the distro is not Debian-based.

Types

type CrossAptOptions

type CrossAptOptions struct {
	Distro     string
	Codename   string
	TargetArch string
}

CrossAptOptions describes the configuration required to make `apt` resolve foreign-architecture packages on the build host. Distro and codename can be left empty: when so, both are read from /etc/os-release.

type Repo

type Repo struct {
	Name       string   `json:"name"`
	URL        string   `json:"url"`
	Suite      string   `json:"suite,omitempty"`
	Components []string `json:"components,omitempty"`
	KeyURL     string   `json:"keyURL,omitempty"`
	Distros    []string `json:"distros,omitempty"`
	Format     string   `json:"format,omitempty"`
	GPGCheck   bool     `json:"gpgCheck,omitempty"`
}

Repo describes one additional package repository. The same structure is used for both yap.json declarations and CLI parsing. Fields that do not apply to a given format are ignored at write time.

func ParseFlags

func ParseFlags(tokens []string) ([]Repo, error)

ParseFlags converts repeatable `--repo k=v,...` tokens into Repo values. Supported keys: name, url, suite, components (comma-separated subkeys are escaped with '+'), keyURL, distros (use '+'), format, gpgCheck.

Jump to

Keyboard shortcuts

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