g2

package module
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-2.0 Imports: 25 Imported by: 1

README

g2

Some Gentoo CLI tools I wrote for myself.

Manifest Tools

g2 includes a set of tools for working with Gentoo Manifest files.

manifest

The manifest command group handles operations related to Manifest files.

upsert-from-url

Updates or inserts a Manifest entry for a file downloaded from a URL. This command streams the file, calculates the specified checksums, and updates the Manifest file in the specified directory (or specific file path).

Usage:

g2 manifest [flags] upsert-from-url <url> <filename> <manifestFileOrDir>

Arguments:

  • <url>: The HTTP/HTTPS URL of the file to download.
  • <filename>: The filename to record in the Manifest (typically the distfile name).
  • <manifestFileOrDir>: The path to the Manifest file or the directory containing it (e.g., the ebuild directory).

Flags:

The following flags control which checksums are calculated. Note that BLAKE2B and SHA512 are enabled by default.

  • -blake2b (default: true): Calculate BLAKE2B checksum.
  • -blake2s (default: false): Calculate BLAKE2S checksum.
  • -md5 (default: false): Calculate MD5 checksum.
  • -rmd160 (default: false): Calculate RMD160 checksum.
  • -sha1 (default: false): Calculate SHA1 checksum.
  • -sha256 (default: false): Calculate SHA256 checksum.
  • -sha3_256 (default: false): Calculate SHA3-256 checksum.
  • -sha3_512 (default: false): Calculate SHA3-512 checksum.
  • -sha512 (default: true): Calculate SHA512 checksum.

Example:

To download a package, calculate SHA256 in addition to defaults, and update the Manifest in the current directory:

g2 manifest -sha256=true upsert-from-url https://example.com/software-1.0.tar.gz software-1.0.tar.gz .

Site Generation

g2 can generate a static HTML website representing your Gentoo overlay, including categories, packages, metadata, and git commit history. It also supports aggregating multiple remote overlays.

overlay site generate

Generates a static site for a single overlay.

Usage:

g2 overlay site generate [-out <dir>] [-clear] [<location>]

Arguments:

  • <location>: Path to the overlay directory, or a Git URL (defaults to .).

Flags:

  • -out: Output directory for the generated site (default: site_out).
  • -clear: Clear output directory before generation.
overlays site generate

Generates an aggregated static site for multiple remote repositories from a repositories.xml file.

Usage:

g2 overlays site generate [-out <dir>] [-clear] <repositoriesFile>

Arguments:

  • <repositoriesFile>: Path or URL to a Gentoo repositories.xml file, or - for stdin.

Linting

g2 provides linting to ensure overlay consistency.

lint

Checks the repository for errors such as ebuild IUSE variables missing in metadata.xml and missing md5-cache files.

Usage:

g2 lint [<location>]

Arguments:

  • <location>: Path to the overlay directory (defaults to .).

Documentation

Index

Constants

View Source
const (
	HashBlake2b  = "BLAKE2B"
	HashBlake2s  = "BLAKE2S"
	HashMd5      = "MD5"
	HashRmd160   = "RMD160"
	HashSha1     = "SHA1"
	HashSha256   = "SHA256"
	HashSha3_256 = "SHA3_256"
	HashSha3_512 = "SHA3_512"
	HashSha512   = "SHA512"
)

Variables

Functions

func ParseEbuildVariables

func ParseEbuildVariables(filename string) map[string]string

ParseEbuildVariables extracts PN, PV, P from the ebuild filename.

func ParseMetadata

func ParseMetadata(path string) (interface{}, error)

ParseMetadata parses a metadata.xml file and returns either a PkgMetadata or CatMetadata pointer (as interface{}), or an error.

func ParseMetadataBytes

func ParseMetadataBytes(data []byte) (interface{}, error)

ParseMetadataBytes parses metadata from a byte slice.

func ParseMetadataFromReader

func ParseMetadataFromReader(r io.Reader) (interface{}, error)

ParseMetadataFromReader parses metadata from an io.Reader.

func ResolveVariables

func ResolveVariables(text string, variables map[string]string) string

ResolveVariables replaces ${VAR} and $VAR in the text with values from variables map.

func UpsertManifest

func UpsertManifest(manifestPath string, newEntry *ManifestEntry) error

UpsertManifest updates or inserts a manifest entry.

func WriteLayoutConf added in v0.0.17

func WriteLayoutConf(lc *LayoutConf, path string) error

WriteLayoutConf writes a LayoutConf back to a file

func WriteMetadata

func WriteMetadata(path string, data interface{}) error

WriteMetadata writes the metadata to a file with proper headers.

Types

type Affected added in v0.0.15

type Affected struct {
	Packages []Package `xml:"package"`
	Services []Service `xml:"service"`
}

type Author added in v0.0.17

type Author struct {
	Name  string
	Email string
	Line  int
}

Author represents an entry in the metadata/AUTHORS file.

func ParseAuthors added in v0.0.17

func ParseAuthors(r io.Reader) ([]Author, error)

ParseAuthors parses the metadata/AUTHORS file format. It ignores blank lines and comments starting with '#'. Expected format: "Name <email@example.com>" or just "Name".

type Background added in v0.0.15

type Background struct {
	Text string `xml:",innerxml"`
}

type Cat

type Cat struct {
	// Text of the category.
	Text string `xml:",innerxml"`
}

Cat represents a cross-linking category. Note: This struct is not directly used in LongDescription to preserve mixed content via InnerXML, but is provided as part of the model definition.

type CatMetadata

type CatMetadata struct {
	XMLName         xml.Name          `xml:"catmetadata"`
	LongDescription []LongDescription `xml:"longdescription"`
}

CatMetadata represents metadata for a category. Source: https://github.com/gentoo-mirror/gentoo/blob/stable/metadata/dtd/metadata.dtd

func (*CatMetadata) String

func (c *CatMetadata) String() string

type Checksums

type Checksums struct {
	Size   int64
	Hashes map[string]string
}

func DownloadAndChecksum

func DownloadAndChecksum(url string, hashes []string) (*Checksums, error)

type Description

type Description struct {
	// Text of the description.
	Text string `xml:",innerxml"`
}

Description represents a description of a maintainer or change.

type Doc

type Doc struct {
	// URL of the documentation.
	URL string `xml:",chardata"`
	// Lang specifies the language of the documentation.
	Lang string `xml:"lang,attr,omitempty"`
}

Doc represents a documentation URL.

type DownloadProgress

type DownloadProgress struct {
	Resp      *http.Response
	TotalSize *int64
	Size      int
	Tick      time.Time
	Start     time.Time
}

func (*DownloadProgress) Write

func (d *DownloadProgress) Write(p []byte) (n int, err error)

type Ebuild

type Ebuild struct {
	Path   string
	Vars   map[string]string
	SrcUri []URIEntry
	Mode   ParsingMode
}

func ParseEbuild

func ParseEbuild(fsys fs.FS, path string, mode ParsingMode) (*Ebuild, error)

ParseEbuild parses an ebuild file with the specified mode.

func (*Ebuild) String

func (e *Ebuild) String() string

type Email

type Email struct {
	// Text of the email address.
	Text string `xml:",innerxml"`
}

Email represents an email address.

type Familyname added in v0.0.15

type Familyname struct {
	Text string `xml:",innerxml"`
	Sort string `xml:"sort,attr,omitempty"`
}

type Flag

type Flag struct {
	// Name of the USE flag.
	Name string `xml:"name,attr"`
	// Text of the flag.
	Text string `xml:",innerxml"`
	// Restrict specifies restrictions on the applicability of the flag.
	Restrict string `xml:"restrict,attr,omitempty"`
}

Flag represents a USE flag.

type GLSA added in v0.0.15

type GLSA struct {
	XMLName     xml.Name       `xml:"glsa"`
	ID          string         `xml:"id,attr"`
	Title       string         `xml:"title"`
	Synopsis    string         `xml:"synopsis"`
	Product     Product        `xml:"product"`
	Announced   string         `xml:"announced"`
	Revised     Revised        `xml:"revised"`
	Bugs        []string       `xml:"bug"`
	Access      string         `xml:"access,omitempty"`
	Affected    Affected       `xml:"affected"`
	Background  *Background    `xml:"background"`
	Description Description    `xml:"description"`
	Impact      Impact         `xml:"impact"`
	Workaround  Workaround     `xml:"workaround"`
	Resolution  Resolution     `xml:"resolution"`
	References  References     `xml:"references"`
	License     *License       `xml:"license"`
	Metadata    []GLSAMetadata `xml:"metadata"`
}

GLSA represents a Gentoo Linux Security Advisory. Source: https://github.com/gentoo-mirror/gentoo/blob/stable/metadata/dtd/glsa.dtd

func ParseGLSA added in v0.0.15

func ParseGLSA(path string) (*GLSA, error)

ParseGLSA parses a glsa.xml file and returns a GLSA pointer, or an error.

func ParseGLSABytes added in v0.0.15

func ParseGLSABytes(data []byte) (*GLSA, error)

ParseGLSABytes parses GLSA from a byte slice.

func ParseGLSAFromReader added in v0.0.15

func ParseGLSAFromReader(r io.Reader) (*GLSA, error)

ParseGLSAFromReader parses GLSA from an io.Reader.

type GLSADescription added in v0.0.15

type GLSADescription struct {
	Text string `xml:",innerxml"`
}

type GLSAMetadata added in v0.0.15

type GLSAMetadata struct {
	Text      string `xml:",innerxml"`
	Tag       string `xml:"tag,attr"`
	Revision  string `xml:"revision,attr,omitempty"`
	Author    string `xml:"author,attr,omitempty"`
	Timestamp string `xml:"timestamp,attr,omitempty"`
}

type Hash

type Hash struct {
	Type  string
	Value string
}

type Impact added in v0.0.15

type Impact struct {
	Text string `xml:",innerxml"`
	Type string `xml:"type,attr"`
}

type LayoutConf added in v0.0.17

type LayoutConf struct {
	Entries []LayoutConfEntry
}

LayoutConf represents the contents of a metadata/layout.conf file

func ParseLayoutConf added in v0.0.17

func ParseLayoutConf(path string) (*LayoutConf, error)

ParseLayoutConf parses a metadata/layout.conf file

func (*LayoutConf) GetValue added in v0.0.17

func (lc *LayoutConf) GetValue(key string) string

GetValue returns the value for a specific key

func (*LayoutConf) GetValuesAsSlice added in v0.0.17

func (lc *LayoutConf) GetValuesAsSlice(key string) []string

GetValuesAsSlice returns the value for a specific key split by spaces

func (*LayoutConf) SetValue added in v0.0.17

func (lc *LayoutConf) SetValue(key, value string)

SetValue sets the value for a specific key, updating it if it exists or appending if it doesn't

func (*LayoutConf) UnsetValue added in v0.0.17

func (lc *LayoutConf) UnsetValue(key string)

UnsetValue removes a specific key

type LayoutConfEntry added in v0.0.17

type LayoutConfEntry struct {
	Comments []string
	Key      string
	Value    string
}

LayoutConfEntry represents a single key-value entry with its preceding comments

type License added in v0.0.15

type License struct {
	Text string `xml:",innerxml"`
}

type Location added in v0.0.15

type Location struct {
	Text      string `xml:",innerxml"`
	Latitude  string `xml:"latitude,attr,omitempty"`
	Longitude string `xml:"longitude,attr,omitempty"`
}

type LongDescription

type LongDescription struct {
	// Body contains the inner XML of the long description.
	// We use InnerXML to preserve mixed content (text + <pkg>/<cat> tags) and ensure circularity.
	Body string `xml:",innerxml"`
	// Lang specifies the language of the description.
	Lang string `xml:"lang,attr,omitempty"`
	// Restrict specifies restrictions on the applicability of the description.
	Restrict string `xml:"restrict,attr,omitempty"`
}

LongDescription represents a long description of a package or category.

type Maintainer

type Maintainer struct {
	// Email of the maintainer.
	Email string `xml:"email"`
	// Name of the maintainer.
	Name string `xml:"name,omitempty"`
	// Description of the maintainer.
	Description string `xml:"description,omitempty"`
	// Type of the maintainer: person, project, or unknown.
	Type string `xml:"type,attr,omitempty"`
	// Proxied indicates whether the maintainer is proxied: yes, no, or proxy.
	Proxied string `xml:"proxied,attr,omitempty"`
	// Status of the upstream maintainer: active, inactive, or unknown.
	Status string `xml:"status,attr,omitempty"`
	// Restrict specifies restrictions on the applicability of the maintainer.
	Restrict string `xml:"restrict,attr,omitempty"`
}

Maintainer represents a maintainer of a package.

type Manifest

type Manifest struct {
	Entries []*ManifestEntry
}

func ParseManifest

func ParseManifest(path string) (*Manifest, error)

func ParseManifestContent

func ParseManifestContent(content string) (*Manifest, error)

func (*Manifest) AddOrReplace

func (m *Manifest) AddOrReplace(entry *ManifestEntry)

func (*Manifest) GetEntry

func (m *Manifest) GetEntry(filename string) *ManifestEntry

GetEntry returns the entry for a filename if it exists

func (*Manifest) Remove

func (m *Manifest) Remove(filename string)

func (*Manifest) Sort

func (m *Manifest) Sort()

Sort sorts the manifest entries by type then filename

func (*Manifest) String

func (m *Manifest) String() string

type ManifestEntry

type ManifestEntry struct {
	Type     string
	Filename string
	Size     int64
	Hashes   []Hash
}

func NewManifestEntry

func NewManifestEntry(typeStr, filename string, size int64, hashes ...Hash) *ManifestEntry

func ParseManifestEntry

func ParseManifestEntry(line string) (*ManifestEntry, error)

func (*ManifestEntry) AddHash

func (e *ManifestEntry) AddHash(hType, hValue string)

func (*ManifestEntry) GetHash

func (e *ManifestEntry) GetHash(hType string) string

func (*ManifestEntry) String

func (e *ManifestEntry) String() string

type Member added in v0.0.15

type Member struct {
	IsLead string `xml:"is-lead,attr,omitempty"` // 0|1
	Email  string `xml:"email"`
	Name   string `xml:"name"`
	Role   string `xml:"role"`
}

type Mirror added in v0.0.15

type Mirror struct {
	City        string      `xml:"city,attr,omitempty"`
	Coordinates string      `xml:"coordinates,attr,omitempty"`
	GentooBug   string      `xml:"gentoo-bug,attr,omitempty"`
	Name        string      `xml:"name"`
	URIs        []MirrorURI `xml:"uri"`
}

type MirrorGroup added in v0.0.15

type MirrorGroup struct {
	Region      string   `xml:"region,attr"`
	Country     string   `xml:"country,attr"`
	CountryName string   `xml:"countryname,attr,omitempty"`
	Mirrors     []Mirror `xml:"mirror"`
}

type MirrorURI added in v0.0.15

type MirrorURI struct {
	Text     string `xml:",innerxml"`
	IPv4     string `xml:"ipv4,attr,omitempty"`     // Y|y|N|n
	IPv6     string `xml:"ipv6,attr,omitempty"`     // Y|y|N|n
	Partial  string `xml:"partial,attr,omitempty"`  // Y|y|N|n
	Protocol string `xml:"protocol,attr,omitempty"` // http|ftp|rsync
}

type Mirrors added in v0.0.15

type Mirrors struct {
	XMLName      xml.Name      `xml:"mirrors"`
	MirrorGroups []MirrorGroup `xml:"mirrorgroup"`
}

Mirrors represents a set of mirror groups. Source: https://github.com/gentoo-mirror/gentoo/blob/stable/metadata/dtd/mirrors.dtd

func ParseMirrors added in v0.0.15

func ParseMirrors(path string) (*Mirrors, error)

ParseMirrors parses a mirrors.xml file and returns a Mirrors pointer, or an error.

func ParseMirrorsBytes added in v0.0.15

func ParseMirrorsBytes(data []byte) (*Mirrors, error)

ParseMirrorsBytes parses Mirrors from a byte slice.

func ParseMirrorsFromReader added in v0.0.15

func ParseMirrorsFromReader(r io.Reader) (*Mirrors, error)

ParseMirrorsFromReader parses Mirrors from an io.Reader.

type Name

type Name struct {
	// Text of the name.
	Text string `xml:",innerxml"`
}

Name represents a name of a person or maintainer.

type Package added in v0.0.15

type Package struct {
	Name       string       `xml:"name,attr"`
	Auto       string       `xml:"auto,attr"` // yes|no
	Arch       string       `xml:"arch,attr"`
	Vulnerable []Vulnerable `xml:"vulnerable"`
	Unaffected []Unaffected `xml:"unaffected"`
}

type PackageMove added in v0.0.17

type PackageMove struct {
	Old string
	New string
}

type PackageUpdate added in v0.0.17

type PackageUpdate struct {
	Moves []PackageMove
}

func ParseUpdatesDir added in v0.0.17

func ParseUpdatesDir(dir string) (*PackageUpdate, error)

type ParsingMode

type ParsingMode uint
const (
	ParseMetadataOnly ParsingMode = iota + 1 // Parse only filename-based metadata (PN, PV, etc.)
	ParseVariables                           // Parse variable definitions in the file
	ParseFull                                // Parse everything (e.g. SRC_URI)
)

func (ParsingMode) String

func (m ParsingMode) String() string

type Pkg

type Pkg struct {
	// Text of the package.
	Text string `xml:",innerxml"`
}

Pkg represents a cross-linking package. Note: This struct is not directly used in LongDescription to preserve mixed content via InnerXML, but is provided as part of the model definition.

type PkgMetadata

type PkgMetadata struct {
	XMLName            xml.Name          `xml:"pkgmetadata"`
	Maintainers        []Maintainer      `xml:"maintainer"`
	LongDescription    []LongDescription `xml:"longdescription"`
	Slots              *Slots            `xml:"slots"`
	StabilizeAllArches bool              `xml:"stabilize-allarches,omitempty"`
	Use                []Use             `xml:"use"`
	Upstream           *Upstream         `xml:"upstream"`
}

PkgMetadata represents metadata for a package. Source: https://github.com/gentoo-mirror/gentoo/blob/stable/metadata/dtd/metadata.dtd

func (*PkgMetadata) String

func (p *PkgMetadata) String() string

type Product added in v0.0.15

type Product struct {
	Text string `xml:",innerxml"`
	Type string `xml:"type,attr"` // ebuild|infrastructure|informational
}

type Project added in v0.0.15

type Project struct {
	Email       string       `xml:"email"`
	Name        string       `xml:"name"`
	URL         string       `xml:"url"`
	Description string       `xml:"description"`
	Subprojects []Subproject `xml:"subproject"`
	Members     []Member     `xml:"member"`
}

type Projects added in v0.0.15

type Projects struct {
	XMLName  xml.Name  `xml:"projects"`
	Projects []Project `xml:"project"`
}

Projects represents a list of projects. Source: https://github.com/gentoo-mirror/gentoo/blob/stable/metadata/dtd/projects.dtd

func ParseProjects added in v0.0.15

func ParseProjects(path string) (*Projects, error)

ParseProjects parses a projects.xml file and returns a Projects pointer, or an error.

func ParseProjectsBytes added in v0.0.15

func ParseProjectsBytes(data []byte) (*Projects, error)

ParseProjectsBytes parses Projects from a byte slice.

func ParseProjectsFromReader added in v0.0.15

func ParseProjectsFromReader(r io.Reader) (*Projects, error)

ParseProjectsFromReader parses Projects from an io.Reader.

type Realname added in v0.0.15

type Realname struct {
	Fullname   string     `xml:"fullname,attr,omitempty"`
	Firstname  string     `xml:"firstname"`
	Familyname Familyname `xml:"familyname"`
}

type References added in v0.0.15

type References struct {
	URIs []URI `xml:"uri"`
}

type RemoteID

type RemoteID struct {
	// Text of the remote identifier.
	Text string `xml:",innerxml"`
	// Type of the remote identifier.
	Type string `xml:"type,attr"`
}

RemoteID represents a remote identifier for a package. Supported types: bitbucket, codeberg, cpan, cpan-module, cpe, cran, ctan, freedesktop-gitlab, gentoo, github, gitlab, gnome-gitlab, google-code, hackage, heptapod, kde-invent, launchpad, osdn, pear, pecl, pypi, rubygems, savannah, savannah-nongnu, sourceforge, sourcehut, vim

type Repositories added in v0.0.15

type Repositories struct {
	XMLName      xml.Name     `xml:"repositories"`
	Version      string       `xml:"version,attr"`
	Repositories []Repository `xml:"repo"`
}

Repositories represents a list of Gentoo repositories. Source: https://github.com/gentoo-mirror/gentoo/blob/stable/metadata/dtd/repositories.dtd

func ParseRepositories added in v0.0.15

func ParseRepositories(path string) (*Repositories, error)

ParseRepositories parses a repositories.xml file and returns a Repositories pointer, or an error.

func ParseRepositoriesBytes added in v0.0.15

func ParseRepositoriesBytes(data []byte) (*Repositories, error)

ParseRepositoriesBytes parses Repositories from a byte slice.

func ParseRepositoriesFromReader added in v0.0.15

func ParseRepositoriesFromReader(r io.Reader) (*Repositories, error)

ParseRepositoriesFromReader parses Repositories from an io.Reader.

type Repository added in v0.0.15

type Repository struct {
	Priority         string                  `xml:"priority,attr,omitempty"`
	Quality          string                  `xml:"quality,attr"` // core|stable|testing|experimental|graveyard
	Status           string                  `xml:"status,attr"`  // official|unofficial
	Name             string                  `xml:"name"`
	Descriptions     []RepositoryDescription `xml:"description"`
	LongDescriptions []RepositoryDescription `xml:"longdescription"`
	Homepage         string                  `xml:"homepage,omitempty"`
	Owners           []RepositoryOwner       `xml:"owner"`
	Sources          []RepositorySource      `xml:"source"`
	Feeds            []string                `xml:"feed"`
}

type RepositoryDescription added in v0.0.15

type RepositoryDescription struct {
	Text string `xml:",innerxml"`
	Lang string `xml:"lang,attr,omitempty"`
}

type RepositoryOwner added in v0.0.15

type RepositoryOwner struct {
	Type  string `xml:"type,attr,omitempty"` // project|person
	Email string `xml:"email"`
	Name  string `xml:"name,omitempty"`
}

type RepositorySource added in v0.0.15

type RepositorySource struct {
	Text string `xml:",innerxml"`
	Type string `xml:"type,attr"` // bzr|cvs|darcs|git|mercurial|rsync|svn|tar
}

type Resolution added in v0.0.15

type Resolution struct {
	Text string `xml:",innerxml"`
}

type Revised added in v0.0.15

type Revised struct {
	Text  string `xml:",innerxml"`
	Count string `xml:"count,attr"`
}

type Service added in v0.0.15

type Service struct {
	Text  string `xml:",innerxml"`
	Type  string `xml:"type,attr"`            // rsync|web|mirror
	Fixed string `xml:"fixed,attr,omitempty"` // yes|no
}

type Slot

type Slot struct {
	// Name of the SLOT.
	Name string `xml:"name,attr"`
	// Text of the slot.
	Text string `xml:",innerxml"`
}

Slot represents a particular SLOT.

type Slots

type Slots struct {
	// Slot elements.
	Slot []Slot `xml:"slot"`
	// Subslots of the package.
	Subslots string `xml:"subslots,omitempty"`
	// Lang specifies the language of the slots.
	Lang string `xml:"lang,attr,omitempty"`
}

Slots represents the description of a package's SLOTs.

type Subproject added in v0.0.15

type Subproject struct {
	Text           string `xml:",innerxml"`
	InheritMembers string `xml:"inherit-members,attr,omitempty"` // 0|1
	Ref            string `xml:"ref,attr"`
}

type URI added in v0.0.15

type URI struct {
	Text string `xml:",innerxml"`
	Link string `xml:"link,attr,omitempty"`
}

type URIEntry

type URIEntry struct {
	URL      string
	Filename string
}

func ExtractURIs

func ExtractURIs(content string, variables map[string]string) ([]URIEntry, error)

ExtractURIs parses the ebuild content and extracts SRC_URI entries.

type Unaffected added in v0.0.15

type Unaffected struct {
	Text  string `xml:",innerxml"`
	Range string `xml:"range,attr"`
	Slot  string `xml:"slot,attr"`
	Name  string `xml:"name,attr,omitempty"`
}

type Upstream

type Upstream struct {
	// Maintainers of the upstream.
	Maintainers []Maintainer `xml:"maintainer"`
	// URL of the upstream changelog.
	Changelog string `xml:"changelog,omitempty"`
	// Documentation URL of the upstream.
	Doc []Doc `xml:"doc"`
	// URL or email address to report bugs.
	BugsTo string `xml:"bugs-to,omitempty"`
	// Remote identifiers for the package.
	RemoteID []RemoteID `xml:"remote-id"`
}

Upstream represents upstream metadata information.

type Use

type Use struct {
	// Flags representing the USE flags.
	Flags []Flag `xml:"flag"`
	// Lang specifies the language of the USE description.
	Lang string `xml:"lang,attr,omitempty"`
}

Use represents the description of USE flags for a package.

type User added in v0.0.15

type User struct {
	Username string    `xml:"username,attr"`
	Realname Realname  `xml:"realname"`
	PGPKeys  []string  `xml:"pgpkey"`
	Aliases  []string  `xml:"alias"`
	Emails   []string  `xml:"email"`
	Joined   []string  `xml:"joined"`
	Retired  []string  `xml:"retired"`
	Status   string    `xml:"status,omitempty"`
	Roles    string    `xml:"roles,omitempty"`
	Location *Location `xml:"location"`
}

type UserList added in v0.0.15

type UserList struct {
	XMLName xml.Name `xml:"userlist"`
	Users   []User   `xml:"user"`
}

UserList represents a list of users. Source: https://github.com/gentoo-mirror/gentoo/blob/stable/metadata/dtd/userinfo.dtd

func ParseUserInfo added in v0.0.15

func ParseUserInfo(path string) (*UserList, error)

ParseUserInfo parses a userinfo.xml file and returns a UserList pointer, or an error.

func ParseUserInfoBytes added in v0.0.15

func ParseUserInfoBytes(data []byte) (*UserList, error)

ParseUserInfoBytes parses UserList from a byte slice.

func ParseUserInfoFromReader added in v0.0.15

func ParseUserInfoFromReader(r io.Reader) (*UserList, error)

ParseUserInfoFromReader parses UserList from an io.Reader.

type Vulnerable added in v0.0.15

type Vulnerable struct {
	Text  string `xml:",innerxml"`
	Range string `xml:"range,attr"`
	Slot  string `xml:"slot,attr"`
}

type Workaround added in v0.0.15

type Workaround struct {
	Text string `xml:",innerxml"`
}

Jump to

Keyboard shortcuts

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