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
golangci-lint identified a couple errors that were not found by
gometalinter. This patch fixes the detected errors.
Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
This patch changes how Warnings and Error messages are printed
throughout the code to use the `log` package instead of `fmt`. This
allows for finer control over what is printed and where it is printed
to.
Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
Make the number of worker goroutines a parameter in delta creation and
add a flag to set that in Mixer. When zero (default) the flag sets the
number of workers to the number of CPUs.
Having a flag let the users to control better how much resources mixer
can/will take.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
This is a --new-swupd replacement of mixer-pack-maker.sh script. There
are two ways to specify what delta packs to make: by setting a --from
version or by asking for (up to) K --previous-versions.
Unlike the script, only one --from is supported, if multiple specific
versions are needed, mixer must be called multiple times. The
rationale is the multiple --from was used to simulate
--previous-versions (by having the caller figuring out them), so not
very important anymore.
The implementation uses swupd.FindBundlesToPack to figure out
what (bundle, from, to) combinations it needs to build, then use
swupd.CreatePack to do the work.
The FindBundlesToPack was changed to take manifests instead of version
numbers and state dirs, the test program was updated accordingly.
Fixes#83.
Fixes#12.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
In CreatePacks, instead of a specific full chroot, take the main
chrootDir and build the path to the full chroot. This will make easier
later to pass the config around (that will have those high level
paths).
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Given two versions, the function returns a set of bundles and
corresponding version pairs that need to have packs created. This was
previously implemented in the test program, but we'll use it for mixer
too.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Add a function WritePack, that will take a pair of from/to versions of
a bundle, and produce a single tar with all the needed files to
perform an update of that bundle. For now, we are only packing
fullfiles -- which is functional but leads to larger pack sizes. Once
deltas are avaialble, we can make packs smaller.
The function supports an optional chrootDir argument, that will be
used to read the files directly instead of uncompressing them from the
"files/" directory.
Different from swupd-server, we don't copy the files to an staged
directory and then archive/compress. By taking advantage of Go
archive/tar package, we can create the tar file directly. Because of
this, the speed up from the chrootDir optimization is smaller in the
Go version.
Also add a test program create-pack, that has the equivalent
functionality of pack-maker.sh: it can generate a single pack for a
from/to pair, or all the relevant packs from a from/to pair. In the
second case, it will dig into the MoM to find the actual from/to pairs
for each relevant bundle.
The test program already contain some logic that will later be adopted
by Mixer and/or the swupd package.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>