luci: go.chromium.org/luci/cipd/client/cipd/pkg Index | Files

package pkg

import "go.chromium.org/luci/cipd/client/cipd/pkg"

Package pkg contains interfaces and struct related to CIPD package files.

Index

Package Files

doc.go installmode.go instance.go manifest.go source.go

Constants

const (
    // ServiceDir is a name of the directory inside the package zip file reserved
    // for cipd stuff.
    ServiceDir = ".cipdpkg"

    // ManifestName is a full name of the manifest file inside the package.
    ManifestName = ServiceDir + "/manifest.json"

    // ManifestFormatVersion is a version to write to the manifest file.
    ManifestFormatVersion = "1.1"
)

func ValidateInstallMode Uses

func ValidateInstallMode(mode InstallMode) error

ValidateInstallMode returns non nil if install mode is invalid.

Valid modes are: "" (client will pick platform default), "copy" (aka InstallModeCopy), "symlink" (aka InstallModeSymlink).

func WriteManifest Uses

func WriteManifest(m *Manifest, w io.Writer) error

WriteManifest encodes and writes manifest JSON to io.Writer.

type FileInfo Uses

type FileInfo struct {
    // Name is slash separated file path relative to a package root.
    Name string `json:"name"`

    // Size is a size of the file. 0 for symlinks.
    Size uint64 `json:"size"`

    // Executable is true if the file is executable.
    //
    // Only used for Linux\Mac archives. False for symlinks.
    Executable bool `json:"executable,omitempty"`

    // Writable is true if the file is user-writable.
    Writable bool `json:"writable,omitempty"`

    // ModTime is Unix timestamp with modification time of the file as it is set
    // inside CIPD package.
    //
    // May be 0 if the package was built without preserving the modification
    // times.
    ModTime int64 `json:"modtime,omitempty"`

    // WinAttrs is a string representation of extra windows file attributes.
    //
    // Only used for Win archives.
    WinAttrs string `json:"win_attrs,omitempty"`

    // Symlink is a path the symlink points to or "" if the file is not a symlink.
    Symlink string `json:"symlink,omitempty"`
}

FileInfo is a definition of a file inside a CIPD package.

type InstallMode Uses

type InstallMode string

InstallMode defines how to install a package.

const (
    // InstallModeSymlink is default (for backward compatibility).
    //
    // In this mode all files are extracted to .cipd/*/... and then symlinked to
    // the site root directory. Version switch happens atomically.
    InstallModeSymlink InstallMode = "symlink"

    // InstallModeCopy is used when files should be directly copied.
    //
    // This mode is always used on Windows (and can be optionally) used on
    // other OSes. If installation is aborted midway, the package may end up
    // in inconsistent state.
    InstallModeCopy InstallMode = "copy"
)

func PickInstallMode Uses

func PickInstallMode(im InstallMode) (InstallMode, error)

PickInstallMode validates the install mode and picks the correct default for the platform if no install mode is given.

func (*InstallMode) Set Uses

func (m *InstallMode) Set(value string) error

Set is called by 'flag' package when parsing command line options.

func (InstallMode) String Uses

func (m InstallMode) String() string

String is needed to conform to flag.Value interface.

type Instance Uses

type Instance interface {
    // Pin identifies package name and concreted instance ID of this package file.
    Pin() common.Pin

    // Files returns a list of files to deploy with the package.
    //
    // One of them (named ManifestName) is the manifest file.
    Files() []fs.File

    // Source returns a reader that reads raw package data.
    Source() io.ReadSeeker

    // Close can be used to indicate to the storage (filesystem and/or cache)
    // layer that this instance is actually bad. The storage layer can then
    // evict/revoke, etc. the bad file.
    Close(ctx context.Context, corrupt bool) error
}

Instance represents an open CIPD package file (with manifest inside).

It owns the underlying raw data source and closes it whenever it is closed itself.

type Manifest Uses

type Manifest struct {
    FormatVersion string      `json:"format_version"`
    PackageName   string      `json:"package_name"`
    VersionFile   string      `json:"version_file,omitempty"` // where to put JSON with info about deployed package
    InstallMode   InstallMode `json:"install_mode,omitempty"` // how to install: "copy" or "symlink"
    Files         []FileInfo  `json:"files,omitempty"`        // present only in deployed manifest
}

Manifest defines structure of manifest.json file.

func ReadManifest Uses

func ReadManifest(r io.Reader) (manifest Manifest, err error)

ReadManifest reads and decodes manifest JSON from io.Reader.

type Source Uses

type Source interface {
    io.ReadSeeker

    // Close can be used to indicate to the storage (filesystem and/or cache)
    // layer that this source is actually bad. The storage layer can then evict
    // the bad file.
    Close(ctx context.Context, corrupt bool) error
}

Source is an underlying data source with CIPD package data.

type VersionFile Uses

type VersionFile struct {
    PackageName string `json:"package_name"`
    InstanceID  string `json:"instance_id"`
}

VersionFile describes JSON file with package version information that's deployed to a path specified in 'version_file' attribute of the manifest.

Package pkg imports 8 packages (graph) and is imported by 4 packages. Updated 2018-11-15. Refresh now. Tools for package owners.