Implement the logging package for mixer.
A common log file can be set for all the mixer commands in the
builder.conf. E.g. `mixer config set Mixer.LOG <filepath>`
The log file and level can also be set for individual mixer
commands using the `--log` and `--log-level` flags respectively.
The various log levels are:
ERROR (1), WARNING (2), INFO (3), DEBUG (4) and VERBOSE (5).
Default log level is 4.
Fixes#666
Signed-off-by: Ashlesha Atrey ashlesha.atrey@intel.com
Currently while catching errors using channels and select
statements, when the error is caught in select statements, it
is not breaking from the outside loop.
The correct approach is to let the existing go routines finish
executing and return one of the errors caught by the error channel.
It should also close the channel in order to stop executing new go
routines.
fixes#673
Signed-off-by: Ashlesha Atrey <ashlesha.atrey@intel.com>
Improve performance of zero pack creation by generating them in
parallel. Fixes#629
Although zero pack is technically a delta pack, the parallel code for
delta pack creation has not been reused because of the following:
- For zero packs, processing is stopped immediately in case of error.
Whereas for delta packs, processing is continued even in case of error
because delta packs are optional.
- The report and print statements are different for zero packs and delta
packs.
The delta-workers flag is used as the numWorker for zero packs.
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
This patch allows users to configure the compression methods that will
be used for fullfiles creation. The compression method can be set in the
Swupd.COMPRESSION property in builder.conf. Instead of enabling all
methods as previosly, xz is the only method that comes enabled by
default.
Note: internal gzip is still used for Link and Directory fullfile
creation.
Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
The latest file in version/formatXX and version/latest_version isn't signed by mixer.
Mixer signs the these files so clients could check the signature of that file too.
Signed-off-by: Ashlesha Atrey ashlesha.atrey@intel.com
Spawning a goroutine for each bundle when compressing files can cause the
system to reach the open file limit. This change allows the number of
goroutines used when compressing files to be configured by the adjusting the
bundle-workers argument.
Signed-off-by: John Akre <john.w.akre@intel.com>
The scope of the err variable was not limited to its local function, so
it was possible for outside errors from other goroutines to set it. This
change limits the scope of the err variable to the local function which
prevents this type of race condition.
Signed-off-by: John Akre <john.w.akre@intel.com>
The PREVIOUS_MIX_VERSION value from mixer.state has replaced LAST_VER
for setting the previous manifest header field. The LAST_VER value was
unable to properly set the previous header field when rebuilding a mix
with the clean flag. This change resolves the issue with the clean flag.
Signed-off-by: John Akre <john.w.akre@intel.com>
When creating manifests for a new build, also create to-Manifests
for each bundle that has changes in this version.
The goal on publishing to-Manifests is to reduce the download size
on updates, according to what was discussed on
clearlinux/swupd-client#498
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Fixes#391
This patch greatly improves code readability by breaking up the goliath
builder.go into several new files containing similar functionality. Now
builder.go only contains the top-level build functions, constructors,
and types.
This patch contains no code functionality changes, the code is simply
moved around.
The builder.go file has been split out as follows:
* builder.go: contains all the top-level commands accessible via the
commandline, such as BuildBundles, BuildUpdate, BuildImage etc. along
with the type and const definitions.
* bundle_control.go: contains the mixer bundle * top-level commands and
all the helpers that are used only by this functionality.
* bundle_validate.go: contains the bundle validation functions.
* bundles.go: added getClosestAncestorOwner to this file as it was the
only file using this function (plus one reference in builder.go by the
top-level BuildBundles).
* deltapacks.go: contains the internal function createDeltaPacks used by
exported function in builder.go.
* repo_control.go: contains the dnf configuration controlling functions
such as AddRepo, SetURLRepo, etc. Ideally this will eventually be
moved to the config package.
* helpers.go: contains generic helper functions used by several files in
the builder package.
* init.go: contains the functions to initialize the mix via mixer
init.
* metadata.go: contains various metadata getters and setters for reading
and updating versions, formats, and metadata files.
* update.go: contains the internal functions used by mixer build update.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>