system

package
v0.0.0-...-752702c Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

This is system package manager need implement for porting lastore-daemon

Index

Constants

View Source
const (
	DownloadJobType           = "download"
	InstallJobType            = "install"
	RemoveJobType             = "remove"
	UpdateJobType             = "update"
	DistUpgradeJobType        = "dist_upgrade"
	PrepareDistUpgradeJobType = "prepare_dist_upgrade"
	UpdateSourceJobType       = "update_source"
	CleanJobType              = "clean"
	FixErrorJobType           = "fix_error"
)
View Source
const (
	ErrTypeDpkgInterrupted    = "dpkgInterrupted"
	ErrTypeDependenciesBroken = "dependenciesBroken"
	ErrTypeUnknown            = "unknown"
	ErrTypeInvalidSourcesList = "invalidSourceList"
)
View Source
const DefaultMirrorsUrl = "http://packages.deepin.com/mirrors/community.json"
View Source
const SizeDownloaded = 0
View Source
const SizeUnknown = -1
View Source
const VarLibDir = "/var/lib/lastore"

Variables

View Source
var NotImplementError = errors.New("not implement")
View Source
var NotSupportError = errors.New("not support operation")
View Source
var RepoInfos []RepositoryInfo
View Source
var ResourceExitError = errors.New("resource exists")

Functions

func DecodeJson

func DecodeJson(fpath string, d interface{}) error

func EncodeJson

func EncodeJson(fpath string, d interface{}) error

func ListPackageFile

func ListPackageFile(packages ...string) []string

ListPackageFile list files path contained in the packages

func NormalFileExists

func NormalFileExists(fpath string) bool

func QueryPackageDependencies

func QueryPackageDependencies(pkgId string) []string

QueryPackageDependencies return the directly dependencies

func QueryPackageDownloadSize

func QueryPackageDownloadSize(packages ...string) (float64, error)

QueryPackageDownloadSize parsing the total size of download archives when installing the packages.

func QueryPackageInstallable

func QueryPackageInstallable(pkgId string) bool

QueryPackageInstallable query whether the pkgId can be installed

func QueryPackageInstalled

func QueryPackageInstalled(pkgId string) bool

QueryPackageInstalled query whether the pkgId installed

Types

type Architecture

type Architecture string

func SystemArchitectures

func SystemArchitectures() ([]Architecture, error)

SystemArchitectures return the system package manager supported architectures

type DirMonitor

type DirMonitor struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewDirMonitor

func NewDirMonitor(baseDir string) *DirMonitor

func (*DirMonitor) Add

func (f *DirMonitor) Add(fn DirMonitorCallback, names ...string) error

func (*DirMonitor) Start

func (f *DirMonitor) Start() error

func (*DirMonitor) Stop

func (f *DirMonitor) Stop()

type DirMonitorCallback

type DirMonitorCallback func(fpath string)

type DirMonitorChangeType

type DirMonitorChangeType string

type Indicator

type Indicator func(JobProgressInfo)

type JobError

type JobError struct {
	Type   string
	Detail string
}

func (*JobError) GetDetail

func (e *JobError) GetDetail() string

func (*JobError) GetType

func (e *JobError) GetType() string

type JobProgressInfo

type JobProgressInfo struct {
	JobId       string
	Progress    float64
	Description string
	Status      Status
	Cancelable  bool
	Error       *JobError
	FatalError  bool
}

type MirrorSource

type MirrorSource struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	Url  string `json:"url"`

	NameLocale  map[string]string `json:"name_locale"`
	Weight      int               `json:"weight"`
	Country     string            `json:"country"`
	AdjustDelay int               `json:"adjust_delay"` // ms
}

type NotFoundErrorType

type NotFoundErrorType string

func NotFoundError

func NotFoundError(w string) NotFoundErrorType

func (NotFoundErrorType) Error

func (e NotFoundErrorType) Error() string

type PkgSystemError

type PkgSystemError struct {
	Type   string
	Detail string
}

func (*PkgSystemError) Error

func (e *PkgSystemError) Error() string

func (*PkgSystemError) GetDetail

func (e *PkgSystemError) GetDetail() string

func (*PkgSystemError) GetType

func (e *PkgSystemError) GetType() string

type RepositoryInfo

type RepositoryInfo struct {
	Name   string `json:"name"`
	Url    string `json:"url"`
	Mirror string `json:"mirror"`
}

func DetectDefaultRepoInfo

func DetectDefaultRepoInfo(rInfos []RepositoryInfo) RepositoryInfo

type Status

type Status string
const (
	ReadyStatus   Status = "ready"
	RunningStatus Status = "running"
	FailedStatus  Status = "failed"
	SucceedStatus Status = "succeed"
	PausedStatus  Status = "paused"

	EndStatus = "end"
)

type System

type System interface {
	Download(jobId string, packages []string) error
	Install(jobId string, packages []string, environ map[string]string) error
	Remove(jobId string, packages []string, environ map[string]string) error
	DistUpgrade(jobId string, environ map[string]string) error
	UpdateSource(jobId string) error
	Clean(jobId string) error
	Abort(jobId string) error
	AttachIndicator(Indicator)
	FixError(jobId string, errType string, environ map[string]string) error
}

type UpdateInfoError

type UpdateInfoError struct {
	Type   string
	Detail string
}

func (*UpdateInfoError) Error

func (err *UpdateInfoError) Error() string

type UpgradeInfo

type UpgradeInfo struct {
	Package        string
	CurrentVersion string
	LastVersion    string
	ChangeLog      string
}

func SystemUpgradeInfo

func SystemUpgradeInfo() ([]UpgradeInfo, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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