18 Commits
Author SHA1 Message Date
Ashlesha Atrey f6dcd44f21 Implement logging for mixer
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
2020-04-30 13:57:58 -07:00
Reagan Lopez b0450cc9d3 Remove unused numWorker param from functions
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
2019-11-08 18:11:10 +01:00
Rodrigo Chiossi e9909408a1 fullfiles: Add user configured compression list
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>
2019-11-05 15:23:22 +00:00
Rodrigo Chiossi 01e6ca3e43 lint: Fix errors identified by golangci-lint
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>
2019-09-19 16:57:37 +02:00
Rodrigo Chiossi 70a3f68c58 global: Use log package for Warnings and Errors
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>
2018-10-23 10:04:52 -07:00
Caio Marcelo de Oliveira Filho 0063f7a5f3 Add --delta-workers to build
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>
2018-02-16 14:41:28 -08:00
Caio Marcelo de Oliveira Filho d083c9427c Add --fullfile-workers to build
Make the number of worker goroutines a parameter in
swupd.CreateFullfiles and add a flag to set that. 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>
2018-02-16 14:41:28 -08:00
Caio Marcelo de Oliveira Filho f8e2184deb swupd: return information about fullfile creation
Fix an old TODO, this gives visibility in every build about the
compression algorithms being used.

Note the accounting "gzip" (and not "external-gzip") because at the
moment it is being used for links and directories. It probably should
just migrate to use the external gzip later.

Output looks like:

=> CREATE FULLFILES
- Already created: 0
- Not compressed:  0
- Compressed
  - external-bzip2       40
  - gzip                 389
  - external-xz          2520
  - external-gzip        953
Total fullfiles: 3902

Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2018-02-16 10:37:00 -08:00
Caio Marcelo de Oliveira Filho b1d5344dd0 builder, swupd: add mixer build delta-packs command
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>
2018-01-17 11:25:48 -08:00
Caio Marcelo de Oliveira Filho 0f38e81280 swupd: make CreatePacks take the chrootDir
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>
2018-01-17 11:25:48 -08:00
Caio Marcelo de Oliveira Filho 72580110a2 swupd: keep track of fullfiles and deltas added to pack
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2018-01-17 10:43:36 -08:00
Caio Marcelo de Oliveira Filho f6478e953b swupd: move FindBundlesToPack to the library
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>
2018-01-17 10:43:36 -08:00
Caio Marcelo de Oliveira Filho 81795d59a4 swupd: fix vetshadow errors in create-fullfiles test program
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2018-01-05 16:16:56 -08:00
Matthew Johnson 07605e078c Fix several issues identified by 'make lint'
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-01-05 16:16:56 -08:00
Caio Marcelo de Oliveira Filho a8f56fc586 swupd: create packs with fullfiles
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>
2018-01-05 16:16:56 -08:00
Caio Marcelo de Oliveira Filho 1008751e80 swupd: split manifest parsing from file opening logic
Split ReadManifestFromFile method into two new functions:
ParseManifest and ParseManifestFile. Both return a *Manifest and an
error.

Updated code to take that change into account. Some functions expect
the manifest to be always valid, but the functions now return nil in
case of an error, so adjust the functions to ensure there is an valid
empty manifest.

Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2018-01-05 16:16:56 -08:00
Caio Marcelo de Oliveira Filho ea2e2a1c05 swupd: update import path in create-fullfiles program
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2018-01-05 16:16:56 -08:00
Caio Marcelo de Oliveira Filho 28b8535f58 swupd: move swupd out of src
Now that we develop following the Go conventions, no need to be inside
src directory. This commit just does the move so hopefully git will be
able to rebase patches referring to previous structure.

Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2018-01-05 16:16:56 -08:00