Documentation ¶
Overview ¶
aurfetch is a library for managing the downloading, updating and reviewing of packages downloaded from the AUR.
The general workflow is:
// Create handle fetch := aurfetch.MakeHandle() pkgs := []string{"foo", "bar"} // Download pkgs fetched, err := fetch.Download(pkgs) // Filter to packages that need to be merged toMerge, err := fetch.NeedsMerge(fetched) // Insert review code with either fetch.PrintDiffs or fetch.DiffsToFile or fetch.MakeView // Merge err := fetch.Merge(toMerge) // Mark everything as seen err := fetch.MarkSeen(pkgs)
Index ¶
- Constants
- type DownloadCB
- type Handle
- func (h Handle) DiffsToFile(pkgs []string, colour bool) error
- func (h Handle) Download(pkgs []string) ([]string, *MultiError)
- func (h Handle) DownloadCB(pkgs []string, cb DownloadCB) []string
- func (h Handle) MakeView(pkgs []string, diffs []string) (string, error)
- func (h Handle) MarkSeen(pkgs []string) error
- func (h Handle) Merge(pkgs []string) error
- func (h Handle) MergeCB(pkgs []string, cb MergeCB) error
- func (h Handle) NeedsMerge(pkgs []string) ([]string, error)
- func (h Handle) PrintDiffs(pkgs []string) error
- func (h Handle) URL(pkgbase string) string
- type MergeCB
- type MultiError
Constants ¶
const EMPTY_TREE string = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
const REF_NAME string = "AUR_SEEN"
/ The ref used for tracking what commits have been seen
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DownloadCB ¶
DownloadCB is the callback passed into the download function. pkg: The pkgbase of the package being downloaded n: The number of packages that have been downloaded out: the output from git clone/fetch
type Handle ¶
type Handle struct { AURURL string CacheDir string PatchDir string GitCommand string GitArgs []string GitCommandArgs []string GitEnvironment []string }
func MakeHandle ¶
func (Handle) DiffsToFile ¶
DiffsToFile writes diffs of packages to DiffDir.
Each diff will be named <pkgbase>.diff
func (Handle) Download ¶
func (h Handle) Download(pkgs []string) ([]string, *MultiError)
Download downloads a list of packages. git clone will be used for new downloads and git fetch for existing rpos
func (Handle) DownloadCB ¶
func (h Handle) DownloadCB(pkgs []string, cb DownloadCB) []string
DownloadCB downloads a list of packages and calls cb after each download. git clone will be used for new downloads and git fetch for existing rpos
func (Handle) MakeView ¶
Creates a view of packages to be installed.
A view is intended for the user to inspect for security purposes. The view will include pkgbuilds of newly cloned packages and diffs of packages that have been updated. There is also a directory containing all the packages in the transaction.
The returning string is a path to the tempdir created to host this view. The directory should be deleted by the caller when the view is no longer needed.
Note the diffs should have already been created using DiffsToFile before calling.
func (Handle) MarkSeen ¶
MarkSeen marks a packages as seen.
If a package has been seen then it is assumed everything up to and including the current commit has been reviewed by the user. Therefore diffs will be between the repo at this point and upstream.
func (Handle) MergeCB ¶
MergeCB merges a list of packages with upstram, calling cb after each successful merge.
func (Handle) NeedsMerge ¶
NeedsMerge filters a list of packages to ones that need to be merged.
A package is considered to need merging if AUR_SEEN is equal or newer than upstream's HEAD If AUR_SEEN is not defined then HEAD is used instead.
func (Handle) PrintDiffs ¶
PrintDiffs prints a list of diffs using git diff. This means git's pager and other config settings will be respected
type MergeCB ¶
MergeCB is the callback passed into the merge function. pkg: The pkgbase of the package being merged n: The number of packages that have been merged
type MultiError ¶
type MultiError struct {
Errors []error
}
func (*MultiError) Add ¶
func (err *MultiError) Add(e error)
func (*MultiError) Error ¶
func (err *MultiError) Error() string
func (*MultiError) Return ¶
func (err *MultiError) Return() *MultiError