source

package
v2.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package source provides source file download and management functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSSHPassword

func GetSSHPassword() string

GetSSHPassword returns the SSH password used for authenticated git clone operations.

func SetSSHPassword

func SetSSHPassword(password string)

SetSSHPassword sets the SSH password used for authenticated git clone operations.

Types

type Source

type Source struct {
	// Hash is the integrity hashsum for a source item
	Hash string
	// PkgName is the package name for component logging
	PkgName string
	// RefKey is the reference name for a VCS fragment (branch, tag) declared in the
	// URI. i.e: "myfile::git+https://example.com/example.git#branch=example"
	RefKey string
	// RefValue is the reference value for a VCS fragment declared in the URI. i.e:
	// myfile::git+https://example.com/example.git#branch=refvalue
	RefValue string
	// SourceItemPath is the absolute path to a source item (folder or file)
	SourceItemPath string
	// SourceItemURI it the full source item URI. i.e:
	// "myfile::git+https://example.com/example.git#branch=example" i.e:
	// "https://example.com/example.tar.gz"
	SourceItemURI string
	// SrcDir is the directory where all the source items are symlinked, extracted
	// and processed by packaging functions.
	SrcDir string
	// StartDir is the root where a copied PKGBUILD lives and all the source items
	// are downloaded. It generally contains the src and pkg folders.
	StartDir string
	// NoExtract is the list of filenames that should NOT be extracted from
	// their archives, matching makepkg's noextract semantics: exact basename
	// match, file is still symlinked into $srcdir but archive.Extract is skipped.
	NoExtract []string
	// SkipHashCheck disables sha256/sha512 integrity verification for this
	// source item. Equivalent to setting the checksum to SKIP in the PKGBUILD.
	SkipHashCheck bool
	// HashAlgo names the checksum array that supplied Hash (sha256sums,
	// sha512sums, b2sums, …). When empty, the algorithm is inferred from the
	// digest length (a 128-hex digest then tries sha512 and blake2b-512).
	HashAlgo string
}

Source defines all the fields accepted by a source item.

func (*Source) Get

func (src *Source) Get() error

Get retrieves the source file from the specified URI.

It is GetContext with context.Background().

func (*Source) GetContext added in v2.7.0

func (src *Source) GetContext(ctx context.Context) error

GetContext retrieves the source file from the specified URI, honouring cancellation of ctx while cloning or downloading.

It parses the URI and determines the source file path and type. If the source file does not exist, it retrieves it from the specified URI. It validates the source file and symlinks any additional source files. Finally, it extracts the source file if necessary.

Returns an error if any step fails, including ctx.Err() (wrapped) when the context is cancelled before or during the fetch.

Jump to

Keyboard shortcuts

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