distro

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	X86_64Arch Arch = "x86_64"

	// Default architecture for which scrape for packages.
	DefaultArch = X86_64Arch

	// Default regex to base the distro version detection on.
	CentosMirrorsDistroVersionRegex = `^(0|[1-9]\d*)(\.(0|[1-9]\d*)?)?(\.(0|[1-9]\d*)?)?(-[a-zA-Z\d][-a-zA-Z.\d]*)?(\+[a-zA-Z\d][-a-zA-Z.\d]*)?\/$`
	CentosPackageFileExtension      = "rpm"
	CentosType                      = "centos"
)

Variables

View Source
var (
	// Default configuration for scrape Centos (RPM) packages.
	//
	// TODO: support for templating default PackagesURI.
	// As of now URI templating depends on distro's viper.AllSettings()
	// data.
	CentosDefaultConfig = Config{
		Mirrors: []Mirror{
			{URL: "https://mirrors.edge.kernel.org/centos/"},
			{URL: "https://archive.kernel.org/centos-vault/"},
		},
		Repositories: []Repository{
			{Name: "base", URI: URITemplate("/os/" + DefaultArch + "/Packages/")},
			{Name: "updates", URI: URITemplate("/updates/" + DefaultArch + "/Packages/")},
			{Name: "BaseOS", URI: URITemplate("/BaseOS/" + DefaultArch + "/os/Packages/")},
			{Name: "AppStream", URI: URITemplate("/AppStream/" + DefaultArch + "/os/Packages/")},
			{Name: "Devel", URI: URITemplate("/Devel/" + DefaultArch + "/os/Packages/")},
		},
		Archs:    []Arch{DefaultArch},
		Versions: nil,
	}
)
View Source
var DistroByType = map[Type]Distro{}

Functions

This section is empty.

Types

type Arch

type Arch string

type Centos

type Centos struct {
	// contains filtered or unexported fields
}

func (*Centos) Configure

func (c *Centos) Configure(config Config, vars map[string]interface{}) error

func (*Centos) GetPackages

func (c *Centos) GetPackages(filter Filter) ([]Package, error)

For each mirror, for each distro version, for each repository, for each architecture, scrape.

type Config

type Config struct {
	// A list of Mirrors to scrape.
	Mirrors []Mirror

	// The mirrored repositories.
	Repositories []Repository

	// A list of architecture for to which scrape packages.
	Archs []Arch

	// A list of Distro versions.
	Versions []Version
}

type Distro

type Distro interface {
	// Configure expects distro.Config and arbitrary variables
	// for config fields that support templating.
	Configure(Config, map[string]interface{}) error

	// GetPackages should return a slice of Package based on
	// the provided Filter-type filter.
	GetPackages(Filter) ([]Package, error)
}

func NewDistro

func NewDistro(distroType Type) (Distro, error)

type Filter

type Filter Prefix

A package filter string prefix.

type Mirror

type Mirror struct {
	Name string
	// The base URL of the package mirror
	// (e.g. https://mirrors.kernel.org/<distribution>)
	URL string
}

type Package

type Package string

type Prefix

type Prefix string

type Repository

type Repository struct {
	Name string
	URI  URITemplate
}

type Type

type Type string

type URITemplate

type URITemplate string

type Version

type Version string

Jump to

Keyboard shortcuts

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