33 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
Ashlesha Atrey 361570bf10 Fix MCA bundle deletion during format bump
When bundle is deleted in a mix, bundle info file is not generated for that
bundle. When parsing the manifest, if bundle info is empty, consider that
bundle to be deleted in the mix and do not resolve packages for that
bundle during the MCA process.

Fixes #743

Signed-off-by: Ashlesha Atrey <ashlesha.atrey@intel.com>
2020-03-21 01:56:10 +00:00
John Akre dc79e60eab Parallelize bundle file resolving
By creating a separate installroot for each package resolving goroutine,
dnf can run in parallel without contention on the lock file when
accessing the dnf cache. Now, package and file resolution occurs within
the same installroot so that the dnf cache that was fetched when resolving
packages can be re-used when resolving files.

Fixes #730

Signed-off-by: John Akre <john.w.akre@intel.com>
2020-03-16 00:11:30 -07:00
John Akre af8d355a9c Initialize local yum repo
Newer versions of DNF require that yum repos are initialized, so Mixer
must initialize the local repo, even when it's empty.

Fixes #731

Signed-off-by: John Akre <john.w.akre@intel.com>
2020-03-03 15:28:34 -08:00
Ashlesha Atrey 5c6afffa1d Refactor error handling in channels
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>
2020-01-13 15:22:16 -08:00
John Akre 8165ef8419 MCA: Print warnings to stderr
Signed-off-by: John Akre <john.w.akre@intel.com>
2019-12-30 11:49:28 -08:00
John Akre 45dc7ae190 MCA: Add support for bundle tracking file
The bundle tracking file is added to each manifest by mixer and does not
exist in an rpm. This change adds a check for the bundle tracking file
when adding a bundle.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-12-30 11:49:28 -08:00
John Akre e17fadd43c MCA: Refactor diff results analysis
The diff results analysis section was refactored to make it easier to
handle special case manifest files.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-12-30 11:49:28 -08:00
John Akre 2a3d9a346f MCA: Set size change to none for small changes
When the size change between bundles is less than 0.01%, the size change
will be displayed as none.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-12-20 15:20:32 -08:00
John Akre 6b2ca23984 MCA: Refactor statistics table
The MCA statistics table replaced the tabwriter implementation with the
tablewriter package. Now the statistics table is a complete box with
line wrapping support for long lines.

This change also adds the --table-width parameter which is used to set the
maximum width of the MCA statistics table. The default value is the
width of the calling terminal and the table can be disabled by providing
a negative number for the table-width.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-12-20 15:20:32 -08:00
John Akre 9ebcdfc463 MCA: Suppress stdout while collecting data
Stdout is suppressed so that verbose mixer output is is omitted from the
results.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-12-18 20:15:47 -08:00
John Akre 1814680c29 MCA: Add retries to rpm queries
The rpm command can fail to download packages over the network, but can
recover with download retries.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-12-18 20:15:47 -08:00
John Akre c316a324f2 MCA: Refactor package metadata querying
To improve performance instead of querying packages downloaded by dnf,
the package URIs are resolved with dnf repoquery which are used to query
the packages with rpm. This implementation is much faster for dnf
repositories on the host system because no package downloads will occur.

Additionally, the new implementation does not require rpms to be named
with the NVRA format (name-version-release.arch.rpm), so alternatively
named rpms will be resolved successfully.

Fixes: #665

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-12-18 20:15:47 -08:00
Ashlesha Atrey f63e6e2752 Stop building bundles if missing dependencies
Currently, if dependencies are not resolved for a bundle, mixer ignores
it and continues processing other bundles. The user is not notified and
results in undesired output.

This fix ensures that the processing is stopped if dependencies are not
resolved and generates an error message.
Empty bundles are considered valid and does not stop processing.

Fixes #663

Signed-off-by: Ashlesha Atrey <ashlesha.atrey@intel.com>
2019-12-10 16:11:48 -08:00
John Akre e6c5d27391 MCA: Skip hash comparisons between md5 and sha256
rpm 4.12 used md5 file hashes by default and rpm 4.14 switched the
default to sha256. As a result, in version 31680 of Clear, rpms started
to use sha256 hashes instead of md5. Since MCA assumes that hash changes
indicate content changes, hash comparisons between md5 and sha256 are
skipped to avoid false positive errors.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-12-06 18:44:12 -08:00
Otavio Pontes f654378e58 Revert partially "Introducing the Iterative to-Manifest"
Reverting commit to remove Iterative Manifests from mixer

This reverts commit 8a35392a76.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-23 23:30:03 +02: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
John Akre 71e690e05a MCA: Parse rpm output with \a character
Previously, MCA parsed rpm output with the comma character which is a
valid filename character that is currently in use. Now, MCA parses rpm
output with the \a character which has also been added to the
blacklisted set of characters.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-08-05 15:45:22 +02:00
John Akre 42d653a24f MCA: Skip files with blacklisted characters
Mixer does not create manifest entries for files with blacklisted
characters, so MCA should not include files with blacklisted
characters in the comparison.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-07-08 16:26:58 +02:00
John Akre a6c61938ed MCA: Use resolveFileName function to remove duplicate code
The resolveFileName function can be used to account for the use of
symlinks in Clear Linux packages.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-07-08 16:26:58 +02:00
John Akre c6763f5546 MCA: Use recursive includes list for file/pkg subtraction
When subtracting files and packages each manifest in the recursive
includes list must be checked to consistently subtract files/packages
correctly.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-07-08 16:26:58 +02:00
John Akre 621369a399 MCA: Serialize package downloads
There was a race condition where the rpm command would try to query
corrupt (partially downloaded) packages. By serializing package
downloads, this race condition is no longer an issue. Also,
parallelized package downloads did not significantly improve
performance, so this change will not be a noticeable performance
regression.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-07-08 16:26:58 +02:00
John Akre 4e853f65ee MCA: Minor statistics reporting improvements
The following minor statistics reporting changes were added to improve
statistics readability:

* Add colons to the added/deleted package sections
* Add space between '|' character and bundle name

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-07-05 16:05:35 +02:00
John Akre 9aea3ea783 MCA: Sort bundles when printing statistics
Signed-off-by: John Akre <john.w.akre@intel.com>
2019-07-05 16:05:35 +02:00
John Akre f873574712 MCA: Support repo/baseurl overrides for from and to versions
In some cases a single DNF config file is not sufficient to correctly
download packages for the mix versions specified by the from and to
flags. The --from-repo-url and --to-repo-url flags were added to
temporarily override the baseurl value for the specified repo in the DNF
config when downloading packages for the from and to versions respectively.
Multiple instances of these flags can be used to override additional
repo/baseurl pairs. An example flag format is shown below:

--from-repo-url <repo>=<URL>
--to-repo-url <repo>=<URL>

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-07-02 00:00:50 +02:00
John Akre 137a505904 MCA: Return nonzero value when errors are detected
Signed-off-by: John Akre <john.w.akre@intel.com>
2019-05-09 19:40:26 +02:00
John Akre 6aadfa311e MCA: Add special case error handling for os-release file
/usr/lib/os-release is a special case file that must be updated by
Mixer for every mix with the exception of the +10 to +20. This file is
directly modified by Mixer and it is also part of the filesystem
package. As a result, a false positive error message will be generated
when /usr/lib/os-release is only modified by Mixer, but the error
message will not be generated when the filesystem package also modifies
the file. The false positive error message cannot be relied upon to
verify that /usr/lib/os-release was modified, so an additional error
message was added when the file is unchanged. In the case of a +10 to
+20 comparison, this error will be removed.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-05-09 19:40:26 +02:00
John Akre 64bc5f1031 MCA: Skip RPM download when bundle has no packages
When a bundle has no packages, there is no need to attempt to download
them.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-05-09 19:40:26 +02:00
John Akre 79fb0a112d MCA: Add minversion support
When any manifest file checked by MCA has a version change without a
hash change, the bundle is marked as a minversion and will have a
'minversion bump detected' field in the results summary.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-19 01:09:16 +02:00
John Akre e7af17dad5 MCA: Add format-bump support
Format bumps require additional special case file handling for the
os-core and os-core-update bundles. Error messages are generated when
any special case files are missing and warning messages are generated
when they may be missing. The warning messages are necessary because
there currently is not enough information to determine the +20 version
which has file exceptions. Also, this change adds bundle deletion
support.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-19 01:09:16 +02:00
John Akre 8b7dd6d7bd MCA: Add local RPM warning
RPMs in the local RPM repo override upstream RPMs which can impact the
results of MCA. MCA will print a warning message to make users aware that
their local RPMs may override the upstream RPMs used by MCA.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-19 01:09:16 +02:00
John Akre ea56038550 MCA: Parallelize package downloads
Parallelizes package downloads and file resolving.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-19 01:09:16 +02:00
John Akre 9fea2ce040 Add manifest correctness assurance (MCA) support
MCA compares two versions to validate that the manifest file changes
align with corresponding package changes. All manifest file changes (except
for a few special cases) will be compared against resolved package file
changes. Any mismatches will be reported as errors. When there are no
errors, package statistics will be displayed.

The following command runs the MCA test:

	mixer build validate --from <version> --to <version>

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-19 01:09:16 +02:00