Documentation
¶
Index ¶
- Constants
- Variables
- func ParseEbuildVariables(filename string) map[string]string
- func ParseMetadata(path string) (interface{}, error)
- func ParseMetadataBytes(data []byte) (interface{}, error)
- func ParseMetadataFromReader(r io.Reader) (interface{}, error)
- func ResolveVariables(text string, variables map[string]string) string
- func UpsertManifest(manifestPath string, newEntry *ManifestEntry) error
- func WriteMetadata(path string, data interface{}) error
- type Cat
- type CatMetadata
- type Checksums
- type Description
- type Doc
- type DownloadProgress
- type Ebuild
- type Email
- type Flag
- type Hash
- type LongDescription
- type Maintainer
- type Manifest
- type ManifestEntry
- type Name
- type ParsingMode
- type Pkg
- type PkgMetadata
- type RemoteID
- type Slot
- type Slots
- type URIEntry
- type Upstream
- type Use
Constants ¶
const ( HashBlake2b = "BLAKE2B" HashBlake2s = "BLAKE2S" HashMd5 = "MD5" HashRmd160 = "RMD160" HashSha1 = "SHA1" HashSha256 = "SHA256" HashSha3_256 = "SHA3_256" HashSha3_512 = "SHA3_512" HashSha512 = "SHA512" )
Variables ¶
var AllHashes = []string{ HashBlake2b, HashBlake2s, HashMd5, HashRmd160, HashSha1, HashSha256, HashSha3_256, HashSha3_512, HashSha512, }
Functions ¶
func ParseEbuildVariables ¶
ParseEbuildVariables extracts PN, PV, P from the ebuild filename.
func ParseMetadata ¶
ParseMetadata parses a metadata.xml file and returns either a PkgMetadata or CatMetadata pointer (as interface{}), or an error.
func ParseMetadataBytes ¶
ParseMetadataBytes parses metadata from a byte slice.
func ParseMetadataFromReader ¶
ParseMetadataFromReader parses metadata from an io.Reader.
func ResolveVariables ¶
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 WriteMetadata ¶
WriteMetadata writes the metadata to a file with proper headers.
Types ¶
type Cat ¶
type Cat struct {
// Text of the category.
Text string `xml:",chardata"`
}
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.
func (*CatMetadata) String ¶
func (c *CatMetadata) String() string
type Description ¶
type Description struct {
// Text of the description.
Text string `xml:",chardata"`
}
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 Ebuild ¶
type Ebuild struct {
Path string
Vars map[string]string
SrcUri []URIEntry
Mode ParsingMode
}
func ParseEbuild ¶
ParseEbuild parses an ebuild file with the specified mode.
type Email ¶
type Email struct {
// Text of the email address.
Text string `xml:",chardata"`
}
Email represents an email address.
type Flag ¶
type Flag struct {
// Name of the USE flag.
Name string `xml:"name,attr"`
// Text of the flag.
Text string `xml:",chardata"`
// Restrict specifies restrictions on the applicability of the flag.
Restrict string `xml:"restrict,attr,omitempty"`
}
Flag represents a USE flag.
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 ParseManifestContent ¶
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
type ManifestEntry ¶
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 Name ¶
type Name struct {
// Text of the name.
Text string `xml:",chardata"`
}
Name represents a name of a person or maintainer.
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:",chardata"`
}
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.
func (*PkgMetadata) String ¶
func (p *PkgMetadata) String() string
type RemoteID ¶
type RemoteID struct {
// Text of the remote identifier.
Text string `xml:",chardata"`
// Type of the remote identifier.
Type string `xml:"type,attr"`
}
RemoteID represents a remote identifier for a package.
type Slot ¶
type Slot struct {
// Name of the SLOT.
Name string `xml:"name,attr"`
// Text of the slot.
Text string `xml:",chardata"`
}
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 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.