manifestgo

package module
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 16 Imported by: 0

README

manifestgo

Build pkg manifest files

Documentation

Index

Constants

View Source
const ReadSizeLimit = 32768

Variables

This section is empty.

Functions

func Sha256SumReader

func Sha256SumReader(r io.Reader) (hash.Hash, error)

Types

type Asset

type Asset struct {
	Kind       string   `plist:"kind" json:"kind"`
	MD5Size    int64    `plist:"md5-size,omitempty" json:"md5_size,omitempty"`
	MD5s       []string `plist:"md5s,omitempty" json:"md5_hash_strings,omitempty"`
	SHA256Size int64    `plist:"sha256-size,omitempty" json:"sha256_size,omitempty"`
	SHA256s    []string `plist:"sha256s,omitempty" json:"sha256_hash_strings,omitempty"`
	URL        string   `plist:"url" json:"url"`
}

Asset represents an asset

type Bundle

type Bundle struct {
	ID      string `xml:"id,attr"`
	Path    string `xml:"path,attr"`
	Version string `xml:"CFBundleVersion,attr"`
}

type Choice

type Choice struct {
	ID          string   `xml:"id,attr"`
	Title       string   `xml:"title,attr"`
	Description string   `xml:"description,attr"`
	PkgRef      []PkgRef `xml:"pkg-ref"`
}

type Item

type Item struct {
	Assets   []*Asset  `plist:"assets" json:"assets"`
	Metadata *Metadata `plist:"metadata" json:"metadata"`
}

Item represents an item

type Line

type Line struct {
	Choice string `xml:"choice,attr"`
}

type Manifest

type Manifest struct {
	ManifestItems []*Item `plist:"items" json:"manifestItems"`
}

Manifest handles the manifest for install application command

func BuildPackageManifest

func BuildPackageManifest(p *Package) (*Manifest, error)

func (*Manifest) AsEncodedPlistString

func (m *Manifest) AsEncodedPlistString(indent int) (string, error)

func (*Manifest) AsJSON

func (m *Manifest) AsJSON(indent int) ([]byte, error)

func (*Manifest) AsPlist

func (m *Manifest) AsPlist(indent int) ([]byte, error)

type Metadata

type Metadata struct {
	BundleIdentifier string `plist:"bundle-identifier" json:"bundle_identifier"`
	BundleVersion    string `plist:"bundle-version" json:"bundle_version"`
	Kind             string `plist:"kind" json:"kind"`
	Title            string `plist:"title" json:"title"`
}

Metadata stores the command meta-data

type Package

type Package struct {
	Choice  Choice   `xml:"choice"`
	PkgInfo PkgInfo  `xml:"pkg-info"`
	PkgRef  []PkgRef `xml:"pkg-ref"`
	Title   string   `xml:"title"`
	Hashes  []hash.Hash
	URL     string
	Size    int64

	// Resource info
	ContentLength int64
	Etag          string
	// contains filtered or unexported fields
}

func NewPackage

func NewPackage(pr PackageReader, hashTypeSize uint, hashChunkSize int64) *Package

func ReadPkgFile

func ReadPkgFile(name string) (*Package, error)

func (*Package) AsJSON

func (p *Package) AsJSON(indent int) ([]byte, error)

func (*Package) BuildManifest

func (p *Package) BuildManifest() (*Manifest, error)

func (*Package) GetBundleIdentifier

func (p *Package) GetBundleIdentifier() string

func (*Package) GetHashStrings

func (p *Package) GetHashStrings() []string

func (*Package) GetKind

func (p *Package) GetKind() string

func (*Package) GetPath

func (p *Package) GetPath() string

func (*Package) GetTitle

func (p *Package) GetTitle() string

func (*Package) GetVersion

func (p *Package) GetVersion() string

func (*Package) ReadFromURL

func (p *Package) ReadFromURL() error

type PackageReader

type PackageReader interface {
	HashURL(uint) ([]hash.Hash, error)
	Length() int64
	Etag() string
	URL() string
	ReadAt(p []byte, off int64) (n int, err error)
}

type PkgInfo

type PkgInfo struct {
	Identifier string   `xml:"identifier,attr"`
	Version    string   `xml:"version,attr"`
	Bundle     []Bundle `xml:"bundle"`
}

type PkgRef

type PkgRef struct {
	Bundle            []Bundle `xml:"bundle-version>bundle"`
	ID                string   `xml:"id,attr"`
	PackageIdentifier string   `xml:"packageIdentifier,attr"`
	Version           string   `xml:"version,attr"`
	Package           string
}

Directories

Path Synopsis
Package xar provides for reading and writing XAR archives.
Package xar provides for reading and writing XAR archives.

Jump to

Keyboard shortcuts

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