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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
/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>
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>
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>
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>
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>