Documentation ¶
Index ¶
- Constants
- Variables
- func PathExists(path string) bool
- type BindConfiguration
- type GitSource
- func (g *GitSource) Clone() error
- func (g *GitSource) CreateCallbacks() git.RemoteCallbacks
- func (g *GitSource) Fetch() error
- func (g *GitSource) GetBindConfiguration(sourcedir string) BindConfiguration
- func (g *GitSource) GetCommitID(repo *git.Repository) string
- func (g *GitSource) GetHead(repo *git.Repository) (string, error)
- func (g *GitSource) GetIdentifier() string
- func (g *GitSource) HasTag(repo *git.Repository, tagName string) bool
- func (g *GitSource) IsFetched() bool
- type SimpleSource
- func (s *SimpleSource) Fetch() error
- func (s *SimpleSource) GetBindConfiguration(rootfs string) BindConfiguration
- func (s *SimpleSource) GetIdentifier() string
- func (s *SimpleSource) GetPath(hash string) string
- func (s *SimpleSource) GetSHA1Sum(path string) (string, error)
- func (s *SimpleSource) GetSHA256Sum(path string) (string, error)
- func (s *SimpleSource) IsFetched() bool
- type Source
Constants ¶
const ( // SourceDir is where we store all tarballs SourceDir = "/var/lib/solbuild/sources" // SourceStagingDir is where we initially fetch downloads SourceStagingDir = "/var/lib/solbuild/sources/staging" )
const (
// GitSourceDir is the base directory for all cached git sources
GitSourceDir = "/var/lib/solbuild/sources/git"
)
Variables ¶
var ( // ErrGitNoContinue is returned when git processing cannot continue ErrGitNoContinue = errors.New("Fatal errors in git fetch") )
Functions ¶
func PathExists ¶
PathExists is a helper function to determine the existence of a file path
Types ¶
type BindConfiguration ¶
type BindConfiguration struct { BindSource string // The localy cached source BindTarget string // Target within the filesystem }
A BindConfiguration is used by a source as a way to express bind mounts required for a given source.
In solbuild, *all* sources are bind mounted to the target cache, regardless of their type.
Special care is taken to ensure that they will be bound in a way compatible with the target system.
type GitSource ¶
type GitSource struct { URI string Ref string BaseName string ClonePath string // This is where we will have cloned into }
A GitSource as referenced by `ypkg` build spec. A git source must have a valid ref to check out to.
func (*GitSource) Clone ¶
Clone will set do a bare mirror clone of the remote repo to the local cache.
func (*GitSource) CreateCallbacks ¶
func (g *GitSource) CreateCallbacks() git.RemoteCallbacks
CreateCallbacks will create the default git callbacks
func (*GitSource) Fetch ¶
Fetch will attempt to download the git tree locally. If it already exists then we'll make an attempt to update it.
func (*GitSource) GetBindConfiguration ¶
func (g *GitSource) GetBindConfiguration(sourcedir string) BindConfiguration
GetBindConfiguration will return a config that enables bind mounting the bare git clone from the host side into the container, at which point ypkg can git clone from the bare git into a new tree and check out, make changes, etc.
func (*GitSource) GetCommitID ¶
GetCommitID will attempt to find the oid of the selected ref type
func (*GitSource) GetIdentifier ¶
GetIdentifier will return a human readable string to represent this git source in the event of errors.
type SimpleSource ¶
type SimpleSource struct { URI string File string // Basename of the file // contains filtered or unexported fields }
A SimpleSource is a tarball or other source for a package
func NewSimple ¶
func NewSimple(uri, validator string, legacy bool) (*SimpleSource, error)
NewSimple will create a new source instance
func (*SimpleSource) Fetch ¶
func (s *SimpleSource) Fetch() error
Fetch will download the given source and cache it locally
func (*SimpleSource) GetBindConfiguration ¶
func (s *SimpleSource) GetBindConfiguration(rootfs string) BindConfiguration
GetBindConfiguration will return the pair for binding our tarballs.
func (*SimpleSource) GetIdentifier ¶
func (s *SimpleSource) GetIdentifier() string
GetIdentifier will return the URI associated with this source.
func (*SimpleSource) GetPath ¶
func (s *SimpleSource) GetPath(hash string) string
GetPath gets the path on the filesystem of the source
func (*SimpleSource) GetSHA1Sum ¶
func (s *SimpleSource) GetSHA1Sum(path string) (string, error)
GetSHA1Sum will return the sha1sum for the given path
func (*SimpleSource) GetSHA256Sum ¶
func (s *SimpleSource) GetSHA256Sum(path string) (string, error)
GetSHA256Sum will return the sha1sum for the given path
func (*SimpleSource) IsFetched ¶
func (s *SimpleSource) IsFetched() bool
IsFetched will determine if the source is already present
type Source ¶
type Source interface { // IsFetched is called during the early build process to determine // whether this source is available for use. IsFetched() bool // Fetch will attempt to fetch the this source locally and cache it. Fetch() error // GetBindConfiguration should return a valid configuration specifying // the origin on our local filesystem, and the target within the container. // The target should include the full source dir. GetBindConfiguration(rootfs string) BindConfiguration // GetIdentifier will return the appropriate representation for a given // source URL. GetIdentifier() string }
A Source is a general representation of source listed in a package spec file.
Source's may be of multiple types, but all are abstracted and dealt with by the interfaces.
func New ¶
New will return a new source for the specified URL.
Validator is the value by which the source will be validated, depending on implementation. For example, the SimpleSource backend will expect a hashsum: sha256sum for package.yml, and sha1sum for legacy.
The legacy argument will determine whether special care should be taken for legacy packages (i.e. sha1sum vs sha256sum).
In all cases, New will fallback to the SimpleSource implementation