cran

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindIndex   = "cran.index"
	PropName    = "cran.name"
	PropVersion = "cran.version"
	PropFeed    = "cran.feed"
)
View Source
const (
	PackagesName     = "PACKAGES"
	PackagesGzipName = "PACKAGES.gz"
)

Variables

View Source
var ErrPackage = errors.New("cran: invalid cran package")

Functions

func CompareVersion

func CompareVersion(a, b string) int

CompareVersion follows R's numeric component ordering for version labels; separators divide components and numeric chunks compare by value.

func EncodeIndex

func EncodeIndex(in []Package, feed string) (map[string][]byte, error)

EncodeIndex records only the newest version per package, as a CRAN client expects from a terminal PACKAGES directory. Older files remain addressable.

func Feed

func Feed(p string) (string, bool)

Feed is a terminal R package directory, without a trailing slash.

func IndexPath

func IndexPath(p string) (feed, name string, ok bool)

func IsPackage

func IsPackage(p string) bool

func LegacyArchiveTarget

func LegacyArchiveTarget(p string) (string, bool)

LegacyArchiveTarget recognizes the source archive layout used by older Artifactory releases. The package and version directories must agree with the filename; unrelated paths and canonical archives are left alone.

func PackagePath

func PackagePath(p string) (feed, name, version string, ok bool)

PackagePath admits only paths from which a native R client can install.

func Serves

func Serves(t repo.PackageType) bool

func ValidName

func ValidName(name string) bool

func ValidVersion

func ValidVersion(version string) bool

Types

type Handler

type Handler struct{ generic.Handler }

func (Handler) Admit

func (Handler) Admit(
	ctx context.Context,
	env format.Env,
	c repo.Config,
	w format.Write,
) (format.Write, error)

func (Handler) Classify

func (Handler) Classify(_ repo.Config, p string) format.Class

func (Handler) Deleted

func (Handler) Deleted(
	ctx context.Context,
	env format.Env,
	c repo.Config,
	removed []types.Item,
) error

func (Handler) Deleting

func (Handler) Deleting(ctx context.Context, env format.Env, c repo.Config, it types.Item) error

func (Handler) Deployed

func (Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it types.Item) error

func (Handler) Inspect

func (Handler) Inspect(
	ctx context.Context,
	env format.Env,
	_ repo.Config,
	w format.Write,
) (any, error)

func (Handler) Owed

func (Handler) Owed(c repo.Config, cached bool, p string) []format.WorkRef

func (Handler) Reindex

func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error

func (Handler) Work

func (Handler) Work(ctx context.Context, env format.Env, work types.WorkItem) error

func (Handler) WorkKinds

func (Handler) WorkKinds() []string

type Package

type Package struct {
	Name, Version, Path, Feed string
	Fields                    map[string]string
	Size                      int64
	MD5, SHA256               string
}

func DecodeIndex

func DecodeIndex(body []byte, indexPath string) ([]Package, error)

func ReadPackage

func ReadPackage(ctx context.Context, r io.ReadSeeker, size int64, p string) (Package, error)

ReadPackage checks the entire archive, including trailing CRCs, before its DESCRIPTION is allowed to enter an index.

func ReadUploaded

func ReadUploaded(
	ctx context.Context,
	r io.ReadSeeker,
	size int64,
	feed, suffix string,
) (Package, error)

ReadUploaded infers the package identity from an archive whose POST URL supplies the feed but has no filename. The content still goes through the same complete archive validator as a direct path upload.

Jump to

Keyboard shortcuts

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