layer

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

* Copyright (c) 2025 System233 * * This software is released under the MIT License. * https://opensource.org/licenses/MIT

Index

Constants

View Source
const DumpErofs = "dump.erofs"
View Source
const ErofsFuse = "erofsfuse"
View Source
const FuserMount = "fusermount"
View Source
const LayerMagic = "<<< deepin linglong layer archive >>>\x00\x00\x00"
View Source
const MkfsErofs = "mkfs.erofs"

Variables

This section is empty.

Functions

func Dump

func Dump(target string) error

func GetTriplet

func GetTriplet() string

func IsValidComponentVersion

func IsValidComponentVersion(version string) bool

func IsValidVersion added in v1.5.2

func IsValidVersion(version string) bool

func Mount

func Mount(opt *MountOption) error

func NormalizeVersion

func NormalizeVersion(version string) string

解析规则: * 若是deb版本号格式,去除epoch部分,其余4个部分,每个部分取其中首次出现的数字,如果存在rev,upstream中取3个部分,rev作为最后一个部分,数量不全的部分尾部补0; * 若是其他格式,按点号分割为4个部分,移除其中所有的非数字内容; * 若某个部分没有数字,则补0; * 若数字有前导0,删除前导0; * 删除所有空格;

func Pack

func Pack(opt *PackOption) error

func Umount

func Umount(opt *UmountOption) error

Types

type Config added in v1.4.6

type Config struct {
	Version string `yaml:"version"`
	Package struct {
		ID          string `yaml:"id"`
		Name        string `yaml:"name"`
		Version     string `yaml:"version"`
		Kind        string `yaml:"kind"`
		Description string `yaml:"description"`
	} `yaml:"package"`
	Command []string `yaml:"command"`
	Base    string   `yaml:"base"`
	Runtime string   `yaml:"runtime,omitempty"`
	Build   string   `yaml:"build"`
}

func (*Config) Verify added in v1.5.2

func (c *Config) Verify() []string

type DumpErofsOption

type DumpErofsOption struct {
	Args     []string
	ExecPath string
}

type LayerHeader

type LayerHeader struct {
	FileName string
	FileSize int64
	Magic    string
	Info     LayerInfoHeader
	InfoSize int
}

func NewLayerHeader

func NewLayerHeader(file *os.File) (*LayerHeader, error)

func NewLayerHeaderFromFile

func NewLayerHeaderFromFile(filePath string) (*LayerHeader, error)

func (*LayerHeader) DataOffset

func (l *LayerHeader) DataOffset() int

func (*LayerHeader) Print

func (l *LayerHeader) Print()

func (*LayerHeader) PrintAll

func (l *LayerHeader) PrintAll() error

func (*LayerHeader) PrintErofs

func (l *LayerHeader) PrintErofs(opt *DumpErofsOption) error

type LayerInfo

type LayerInfo struct {
	Arch          []string `json:"arch"`
	Base          string   `json:"base"`
	Runtime       string   `json:"runtime,omitempty"`
	Channel       string   `json:"channel"`
	Command       []string `json:"command"`
	Description   string   `json:"description"`
	ID            string   `json:"id"`
	Kind          string   `json:"kind"`
	Module        string   `json:"module"`
	Name          string   `json:"name"`
	SchemaVersion string   `json:"schema_version"`
	Size          int64    `json:"size"`
	Version       string   `json:"version"`
}

func (*LayerInfo) FileName

func (l *LayerInfo) FileName() string

func (*LayerInfo) ParseLayerInfo

func (info *LayerInfo) ParseLayerInfo(config Config) error

func (*LayerInfo) Print

func (info *LayerInfo) Print()

type LayerInfoHeader

type LayerInfoHeader struct {
	Info    LayerInfo `json:"info"`
	Version string    `json:"version"`
}

func NewLayerInfoHeader

func NewLayerInfoHeader(config Config) LayerInfoHeader

func (*LayerInfoHeader) Print

func (l *LayerInfoHeader) Print()

type MountOption

type MountOption struct {
	Source   string
	Target   string
	Args     []string
	ExecPath string
}

type PackOption

type PackOption struct {
	Source     string
	Target     string
	ExecPath   string
	Compressor string
	BlockSize  int
	Uid        int
	Gid        int
	Args       []string
}

type UmountOption

type UmountOption struct {
	Target   string
	Args     []string
	ExecPath string
}

Jump to

Keyboard shortcuts

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