repo

package
v0.0.0-...-09fc46a Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyPath      = fmt.Errorf("Path to file is empty")
	ErrEmptyRepo      = fmt.Errorf("Repository is empty")
	ErrNilPackage     = fmt.Errorf("Package is nil")
	ErrNilStorage     = fmt.Errorf("Storage is nil")
	ErrNotInitialized = fmt.Errorf("Repository is not initialized")
)

Functions

This section is empty.

Types

type Package

type Package struct {
	Name      string        // Name
	Version   string        // Version
	Release   string        // Release
	Epoch     string        // Epoch
	ArchFlags data.ArchFlag // Archs flag
	Src       string        // Source package name
	Files     PackageFiles  // RPM files list

	Info *PackageInfo // Additional info
}

Package contains info about package

func (*Package) FullName

func (p *Package) FullName() string

FullName returns full package name

func (*Package) HasArch

func (p *Package) HasArch(arch string) bool

HasArch returns true if package have file for given arch

type PackageBundle

type PackageBundle []*Package

PackageBundle is slice of packages built from one source RPM

type PackageChangelog

type PackageChangelog struct {
	Author  string
	Records []string
}

PackageChangelog contains changelog data

type PackageFile

type PackageFile struct {
	Path         string        // Path to file
	ArchFlag     data.ArchFlag // Package arch flag
	BaseArchFlag data.ArchFlag // Sub-repo (i.e. directory arch) flag
}

PackageFile contains info about package file

type PackageFiles

type PackageFiles []PackageFile

PackageFiles is slice with package files

func (PackageFiles) HasArch

func (p PackageFiles) HasArch(arch string) bool

HasArch returns true if slice contains given arch

type PackageInfo

type PackageInfo struct {
	Summary       string            // Summary
	Desc          string            // Description
	URL           string            // URL
	Vendor        string            // Vendor
	Packager      string            // Packager
	Group         string            // Group
	License       string            // License
	Checksum      string            // Checksum
	SizePackage   uint64            // Size of package in bytes
	SizeInstalled uint64            // Size of installed data in bytes
	DateAdded     time.Time         // Add date as unix timestamp
	DateBuild     time.Time         // Build date as unix timestamp
	Changelog     *PackageChangelog // Changelog records
	Requires      []data.Dependency // Requires
	Provides      []data.Dependency // Provides
	Files         PayloadData       // Files and directories
}

PackageInfo contains additional information about package

type PackageStack

type PackageStack []PackageBundle

PackageStack is slice with package bundles

func (PackageStack) FlattenFiles

func (s PackageStack) FlattenFiles() PackageFiles

FlattenFiles returns slice with all packages files in stack

func (PackageStack) GetArchs

func (s PackageStack) GetArchs() []string

GetArchs returns slice with arch names presented in stack

func (PackageStack) GetArchsFlag

func (s PackageStack) GetArchsFlag() data.ArchFlag

GetArchsFlag returns flag for all packages in all bundles in stack

func (PackageStack) HasMultiBundles

func (s PackageStack) HasMultiBundles() bool

HasMultiBundles returns true if stack contains bundle with more than 1 package

func (PackageStack) IsEmpty

func (s PackageStack) IsEmpty() bool

IsEmpty returns true if package stack is empty

func (PackageStack) Len

func (p PackageStack) Len() int

func (PackageStack) Less

func (p PackageStack) Less(i, j int) bool

func (PackageStack) Swap

func (p PackageStack) Swap(i, j int)

type PayloadData

type PayloadData []PayloadObject

PayloadData is a slice with info about files or directories

func (PayloadData) Len

func (p PayloadData) Len() int

func (PayloadData) Less

func (p PayloadData) Less(i, j int) bool

func (PayloadData) Swap

func (p PayloadData) Swap(i, j int)

type PayloadObject

type PayloadObject struct {
	IsDir bool
	Path  string
}

PayloadObject contains info about file or directory

type Repository

type Repository struct {
	Name        string
	DefaultArch string
	FileFilter  string
	Replace     bool

	SigningKey *sign.Key

	Testing *SubRepository // Testing sub-repository (with unstable packages)
	Release *SubRepository // Release sub-repository (with stable packages)
	// contains filtered or unexported fields
}

Repository is main repository struct

func NewRepository

func NewRepository(name string, repoStorage storage.Storage) (*Repository, error)

NewRepository creates new struct for repostitory

func (*Repository) CopyPackage

func (r *Repository) CopyPackage(source, target *SubRepository, packageFile PackageFile) error

CopyPackage copies packages between sub-repositories

func (*Repository) HasArch

func (r *Repository) HasArch(arch string) bool

HasArch returns true if release and testing repositories have given arch

func (*Repository) Info

func (r *Repository) Info(name, arch string) (*Package, time.Time, error)

Info returns package struct with extended info and release date

func (*Repository) Initialize

func (r *Repository) Initialize(archList []string) error

Initialize initializes the new repository and creates all required directories

func (*Repository) IsPackageReleased

func (r *Repository) IsPackageReleased(pkg *Package) (bool, time.Time, error)

IsPackageReleased checks if package was released

func (*Repository) IsSigningRequired

func (r *Repository) IsSigningRequired() bool

IsSigningRequired returns true if signing key is set and repository requires package signing

func (*Repository) PurgeCache

func (r *Repository) PurgeCache() error

PurgeCache removes all cached data

func (*Repository) ReadSigningKey

func (r *Repository) ReadSigningKey(file string) error

ReadSigningKey securely reads signing key from file

type RepositoryStats

type RepositoryStats struct {
	Packages      map[string]int
	Sizes         map[string]int64
	TotalPackages int
	TotalSize     int64
	Updated       time.Time
}

RepositoryStats contains repository stats data

type SubRepository

type SubRepository struct {
	Name   string      // Sub-repository name
	Parent *Repository // Pointer to parent repository
}

SubRepository is sub-repository struct

func NewSubRepository

func NewSubRepository(name string) *SubRepository

NewSubRepository creates struct for sub-repository (release/testing)

func (*SubRepository) AddPackage

func (r *SubRepository) AddPackage(rpmFilePath string) error

AddPackage copies given file into sub-repository storage Important: This method DO NOT run repository reindex

func (*SubRepository) Find

func (r *SubRepository) Find(query search.Query) (PackageStack, error)

Find tries to find packages by given search query

func (*SubRepository) GetFullPackagePath

func (r *SubRepository) GetFullPackagePath(pkg PackageFile) string

GetFullPackagePath returns full path to package

func (*SubRepository) HasArch

func (r *SubRepository) HasArch(arch string) bool

HasArch returns true if sub-repository contains packages with given arch

func (*SubRepository) HasPackageFile

func (r *SubRepository) HasPackageFile(rpmFileName string) bool

HasPackageFile returns true if sub-repository contains file with given name

func (*SubRepository) Is

func (r *SubRepository) Is(name string) bool

Is is shortcut for checking sub-repository name

func (*SubRepository) IsCacheValid

func (r *SubRepository) IsCacheValid() bool

IsCacheValid returns true if cache for architectures is valid

func (*SubRepository) IsEmpty

func (r *SubRepository) IsEmpty(arch string) bool

IsEmpty returns true if sub-repository is empty (no packages)

func (*SubRepository) List

func (r *SubRepository) List(filter string, all bool) (PackageStack, error)

List returns list with packages

func (*SubRepository) Reindex

func (r *SubRepository) Reindex(full bool, ch chan string) error

Reindex generates repository metadata

func (*SubRepository) RemovePackage

func (r *SubRepository) RemovePackage(packageFile PackageFile) error

RemovePackage removes package with given relative path from sub-repository storage Important: This method DO NOT run repository reindex

func (*SubRepository) Stats

func (r *SubRepository) Stats() (*RepositoryStats, error)

Stats returns stats for sub-repository

func (*SubRepository) WarmupCache

func (r *SubRepository) WarmupCache() error

WarmupCache warmups cache for all architectures

Directories

Path Synopsis
fs

Jump to

Keyboard shortcuts

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