generate

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package generate builds aqua-registry-g2's registry.json from an upstream release.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnInstance added in v0.9.0

func OnInstance(base *aquaregistry.PackageInfo) bool

OnInstance says whether the package is on a forge instance of its own rather than on github.com, which is what decides where its releases are read from.

Types

type Asset

type Asset = g2.Asset

Registry is the content of versions/<version>/registry.json, and Asset is one of its entries.

The types are aqua's. aqua reads what ar2 writes, so the format is described where it is read; defining it again here would be two descriptions of one thing kept in step by hand.

type File

type File = g2.File

Registry is the content of versions/<version>/registry.json, and Asset is one of its entries.

The types are aqua's. aqua reads what ar2 writes, so the format is described where it is read; defining it again here would be two descriptions of one thing kept in step by hand.

type Generator

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

Generator builds registry.json from a release.

func New

func New(gh genrgst.RepositoriesService, httpClient *http.Client) *Generator

New creates a Generator.

func (*Generator) Generate

func (g *Generator) Generate(ctx context.Context, logger *slog.Logger, input *Input) (*Registry, error)

Generate resolves a release into registry.json.

The asset naming rule is not read from a registry: aqua gr infers it from the release's own asset list, which is what stops an upstream renaming from breaking the registry. The inferred PackageInfo is then resolved for each os/arch the same way aqua resolves it at install time, so the static result installs identically.

type Input

type Input struct {
	// PkgName is the aqua package name, e.g. "cli/cli".
	PkgName string
	// Version is the release tag, e.g. "v2.101.0".
	Version string
	// Scaffold is the aqua gr configuration of the package, taken from
	// aqua-registry's scaffold.yaml. It supplies the filters that can't be inferred
	// from the release, such as which assets to ignore. It may be nil.
	Scaffold *genrgst.RawConfig
	// Base is the package's definition in aqua-registry, already resolved for the
	// version. It supplies what a release can't express: files, libc variants, and
	// the signing configuration. It may be nil for a package aqua-registry doesn't
	// have yet.
	Base *aquaregistry.PackageInfo
	// Config is the package's definition on its aqua-registry-g2 branch. When it is
	// set it replaces Base and Scaffold, because it is what those were converted
	// into: aqua-registry is where a package's definition comes from until
	// aqua-registry-g2 has one of its own, and after that it is no longer consulted.
	Config *g2.Config
	// Repos is where the release is read from, when that is not GitHub. A package on
	// a Forgejo or Gitea instance is read from the instance, by a client that answers
	// what GitHub's does: the asset naming is then inferred by the same code, and
	// only the host it was read from differs. It may be nil, which is GitHub.
	Repos genrgst.RepositoriesService
}

Input holds the parameters of a single generation.

type Registry

type Registry = g2.Registry

Registry is the content of versions/<version>/registry.json, and Asset is one of its entries.

The types are aqua's. aqua reads what ar2 writes, so the format is described where it is read; defining it again here would be two descriptions of one thing kept in step by hand.

Jump to

Keyboard shortcuts

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