Documentation ¶
Index ¶
- Constants
- Variables
- type Builder
- func (b *Builder) AddBundles(bundles []string, allLocal bool, allUpstream bool, git bool) error
- func (b *Builder) AddRPMList(rpms []string) error
- func (b *Builder) AddRepo(name, url string) error
- func (b *Builder) BuildBundles(template *x509.Certificate, privkey *rsa.PrivateKey, signflag, clean bool, ...) error
- func (b *Builder) BuildDeltaManifests(from, to uint32) error
- func (b *Builder) BuildDeltaManifestsPreviousVersions(prev, to uint32) error
- func (b *Builder) BuildDeltaPacks(from, to uint32, printReport bool) error
- func (b *Builder) BuildDeltaPacksPreviousVersions(prev, to uint32, printReport bool) error
- func (b *Builder) BuildImage(format string, template string) error
- func (b *Builder) BuildUpdate(params UpdateParameters) error
- func (b *Builder) CheckBumpNeeded(silent bool) (bool, error)
- func (b *Builder) CheckManifestCorrectness(fromVer, toVer, downloadRetries int, ...) error
- func (b *Builder) CopyFullGroupsINI() error
- func (b *Builder) CreateBundles(bundles []string, add bool, git bool) error
- func (b *Builder) DownloadFileFromUpstream(subpath string, filePath string) error
- func (b *Builder) DownloadFileFromUpstreamAsString(subpath string) (string, error)
- func (b *Builder) GetHostAndUpstreamFormats() (string, string, error)
- func (b *Builder) GetLastBuildVersion() (string, error)
- func (b *Builder) InitMix(upstreamVer string, mixVer string, allLocal bool, allUpstream bool, ...) error
- func (b *Builder) ListBundles(listType listType, tree bool) error
- func (b *Builder) ListRepos() error
- func (b *Builder) ModifyBundles(action func([]string) error) error
- func (b *Builder) NewDNFConfIfNeeded() error
- func (b *Builder) PrintVersions() error
- func (b *Builder) ReadVersions() error
- func (b *Builder) RemoveBundles(bundles []string, mix bool, local bool, git bool) error
- func (b *Builder) RemoveBundlesGroupINI(bundles []string) error
- func (b *Builder) RemoveRepo(name string) error
- func (b *Builder) ReplaceInfoBundles(filenames []string) error
- func (b *Builder) RevertFullGroupsINI() error
- func (b *Builder) RunCommandInContainer(cmd []string) error
- func (b *Builder) SetExcludesRepo(reponame, pkgs string) error
- func (b *Builder) SetURLRepo(name, url string) error
- func (b *Builder) SignManifestMoM() error
- func (b *Builder) UnstageMixFromBump() error
- func (b *Builder) UpdateFormatVersion(version string) error
- func (b *Builder) UpdateMixVer(version int) error
- func (b *Builder) UpdatePreviousMixVersion(version string) error
- func (b *Builder) UpdateVersions(nextMix, nextUpstream uint32, skipFormatCheck bool) error
- func (b *Builder) ValidateBundles(bundles []string, lvl ValidationLevel) error
- func (b *Builder) ValidateLocalBundles(lvl ValidationLevel) error
- func (b *Builder) WriteRepoURLOverrides(tmpConf *os.File, repoURLs map[string]string) error
- type UpdateParameters
- type ValidationLevel
Constants ¶
const ( MixList listType = iota // List bundles in the mix (with includes) LocalList // List bundles available locally UpstreamList // List bundles available upstream )
Enum of available list types
Variables ¶
var Native = true
Native controls whether mixer runs the command on the native machine or in a container.
var Offline = false
Offline controls whether mixer attempts to automatically cache upstream bundles. In offline mode, all necessary bundles must exist in local-bundles.
var Version = ""
Version of Mixer. This is provided by ldflags in Makefile during compilation
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct { Config config.MixConfig State config.MixState MixVer string MixVerFile string MixBundlesFile string LocalPackagesFile string UpstreamURL string UpstreamURLFile string UpstreamVer string UpstreamVerFile string Signing int Bump int NumFullfileWorkers int NumDeltaWorkers int NumBundleWorkers int // Parsed versions. MixVerUint32 uint32 UpstreamVerUint32 uint32 }
A Builder contains all configurable fields required to perform a full mix operation, and is used to encapsulate life time data.
func New ¶
func New() *Builder
New will return a new instance of Builder with some predetermined sane default values.
func NewFromConfig ¶
NewFromConfig creates a new Builder with the given Configuration.
func (*Builder) AddBundles ¶
AddBundles adds the specified bundles to the Mix Bundles List. Values are verified as valid, and duplicate values are removed. The resulting Mix Bundles List will be in sorted order.
func (*Builder) AddRPMList ¶
AddRPMList copies rpms into the repodir and calls createrepo_c on it to generate a dnf-consumable repository for the bundle builder to use.
func (*Builder) AddRepo ¶
AddRepo adds and enables a repo configuration named <name> pointing at URL <url>. It calls b.NewDNFConfIfNeeded() to create the DNF config if it does not exist and performs a check to see if the repo passed has already been configured.
func (*Builder) BuildBundles ¶
func (b *Builder) BuildBundles(template *x509.Certificate, privkey *rsa.PrivateKey, signflag, clean bool, downloadRetries int) error
BuildBundles will attempt to construct the bundles required by generating a DNF configuration file, then resolving all files for each bundle using dnf resolve and no-op installs. One full chroot is created from this step with the file contents of all bundles.
func (*Builder) BuildDeltaManifests ¶
BuildDeltaManifests between two versions of the mix.
func (*Builder) BuildDeltaManifestsPreviousVersions ¶
BuildDeltaManifestsPreviousVersions builds manifests to version from up to prev versions. It walks the Manifest "previous" field to find those from versions.
func (*Builder) BuildDeltaPacks ¶
BuildDeltaPacks between two versions of the mix.
func (*Builder) BuildDeltaPacksPreviousVersions ¶
BuildDeltaPacksPreviousVersions builds packs to version from up to prev versions. It walks the Manifest "previous" field to find those from versions.
func (*Builder) BuildImage ¶
BuildImage will now proceed to build the full image with the previously validated configuration.
func (*Builder) BuildUpdate ¶
func (b *Builder) BuildUpdate(params UpdateParameters) error
BuildUpdate will produce an update consumable by the swupd client
func (*Builder) CheckBumpNeeded ¶
CheckBumpNeeded returns nil if it successfully deduces there is no format bump boundary being crossed.
func (*Builder) CheckManifestCorrectness ¶
func (b *Builder) CheckManifestCorrectness(fromVer, toVer, downloadRetries int, fromRepoURLOverrides, toRepoURLOverrides map[string]string) error
CheckManifestCorrectness validates that the changes in manifest files between two versions aligns to the corresponding RPM changes. Any mismatched files between the manifests and RPMs will be printed as errors. When there are no errors, package and file statistics for each modified bundle will be displayed.
func (*Builder) CopyFullGroupsINI ¶
CopyFullGroupsINI copies the initial ini file which has ALL bundle definitions
func (*Builder) CreateBundles ¶
CreateBundles copies a list of bundles from upstream-bundles to local-bundles if they are not already there or creates a blank template if they are new. 'add' will also add the bundles to the mix.
func (*Builder) DownloadFileFromUpstream ¶
DownloadFileFromUpstream will download a file from the Upstream URL joined with the passed subpath and write that file to the supplied file path. If the path is left empty, the file name will be inferred from the source and written to PWD.
func (*Builder) DownloadFileFromUpstreamAsString ¶
DownloadFileFromUpstreamAsString will download a file from the Upstream URL joined with the passed subpath. It will trim leading and trailing whitespace from the result.
func (*Builder) GetHostAndUpstreamFormats ¶
GetHostAndUpstreamFormats retreives the formats for the host and the mix's upstream version. It attempts to determine the format for the host machine, and if successful, looks up the format for the desired upstream version.
func (*Builder) GetLastBuildVersion ¶
GetLastBuildVersion returns the version number of the most recent build
func (*Builder) InitMix ¶
func (b *Builder) InitMix(upstreamVer string, mixVer string, allLocal bool, allUpstream bool, noDefaults bool, upstreamURL string, git bool) error
InitMix will initialise a new swupd-client consumable "mix" with the given based Clear Linux version and specified mix version.
func (*Builder) ListBundles ¶
ListBundles prints out a bundle list in either a flat list or tree view
func (*Builder) ListRepos ¶
ListRepos lists all configured repositories in the DNF configuration file. This will fail if a DNF conf has not yet been generated.
func (*Builder) ModifyBundles ¶
ModifyBundles goes through the bundle directory and performs an action when it finds a Deprecated bundle
func (*Builder) NewDNFConfIfNeeded ¶
NewDNFConfIfNeeded creates a new DNF configuration file if it does not already exist
func (*Builder) PrintVersions ¶
PrintVersions prints the current mix and upstream versions, and the latest version of upstream.
func (*Builder) ReadVersions ¶
ReadVersions will initialise the mix versions (mix and clearlinux) from the configuration files in the version directory.
func (*Builder) RemoveBundles ¶
RemoveBundles removes a list of bundles from the Mix Bundles List. If a bundle is not present, it is skipped. If 'local' is passed, the corresponding bundle file is removed from local-bundles. Note that this is an irreversible step. The Mix Bundles List is validated when read in, and the resulting Mix Bundles List will be in sorted order.
func (*Builder) RemoveBundlesGroupINI ¶
RemoveBundlesGroupINI removes the bundles from groups.ini and mixbundles so they are not tracked anymore and manifests do not get created for them
func (*Builder) RemoveRepo ¶
RemoveRepo removes a configured repo <name> if it exists in the DNF configuration. This will fail if a DNF conf has not yet been generated.
func (*Builder) ReplaceInfoBundles ¶
ReplaceInfoBundles wipes the <bundle>-info files and replaces them with <bundle>/ directories that are empty. When the manifest creation happens it will mark all files in that bundles as deleted.
func (*Builder) RevertFullGroupsINI ¶
RevertFullGroupsINI copies back the full ini to the manifest creator accounts for deleted bundles
func (*Builder) RunCommandInContainer ¶
RunCommandInContainer will pull the content necessary to build a docker image capable of running the desired command, build that image, and then run the command in that image.
func (*Builder) SetExcludesRepo ¶
SetExcludesRepo sets the ecludes for the repo <name> to [pkgs...]
func (*Builder) SetURLRepo ¶
SetURLRepo sets the URL for the repo <name> to <url>. If <name> does not exist it is created.
func (*Builder) SignManifestMoM ¶
SignManifestMoM will sign the Manifest.MoM file in in place based on the Mix version read from builder.conf.
func (*Builder) UnstageMixFromBump ¶
UnstageMixFromBump resets the upstreamversion file from the temporary ".bump" file, if it exists. This returns the user to their desired upstream version after having completed the upstream format boundary bump builds.
func (*Builder) UpdateFormatVersion ¶
UpdateFormatVersion updates the builder.conf file with a new format version
func (*Builder) UpdateMixVer ¶
UpdateMixVer sets the mix version in the builder object and writes it out to file
func (*Builder) UpdatePreviousMixVersion ¶
UpdatePreviousMixVersion updates the PREVIOUS_MIX_VERSION field in mixer.state
func (*Builder) UpdateVersions ¶
UpdateVersions will validate then update both mix and upstream versions. If upstream version is 0, then the latest upstream version in the current upstream format will be taken instead.
func (*Builder) ValidateBundles ¶
func (b *Builder) ValidateBundles(bundles []string, lvl ValidationLevel) error
ValidateBundles runs bundle parsing validation on a list of local bundles. In addition to parsing errors, errors are generated if the bundle is not found in local-bundles.
func (*Builder) ValidateLocalBundles ¶
func (b *Builder) ValidateLocalBundles(lvl ValidationLevel) error
ValidateLocalBundles runs bundle parsing validation on all local bundles.
type UpdateParameters ¶
type UpdateParameters struct { // Minimum version used to generate delta packs MinVersion int // Format version used in this update Format string // Update latest format version and image version files to current mix Publish bool // Skip signing Manifest.MoM SkipSigning bool // Skip fullfiles generation SkipFullfiles bool // Skip zero packs generation SkipPacks bool }
UpdateParameters contains the configuration parameters for building an update
type ValidationLevel ¶
type ValidationLevel int
ValidationLevel represents a specific validation level
const ( BasicValidation ValidationLevel = iota StrictValidation )
Enum of available validation levels