768 Commits
Author SHA1 Message Date
Rodrigo Chiossi 3c7cca6097 Release v5.7.2
This release includes multiple fixes to mixer's MCA along with updated
versions of mixer's dependencies.

Dependencies update:

- github.com/BurntSushi/toml: v0.3.0 -> v0.3.1
- github.com/spf13/cobra: 0.0.1 -> 0.0.5
- github.com/go-ini/ini: 1.32.0 -> 1.42.0
- github.com/pkg/errors: 0.8.0 -> 0.8.1

MCA Fixes and Improvements:

- Skip files with blacklisted characters
- Use resolveFileName function to remove duplicate code
- Use recursive includes list for file/pkg subtraction
- Serialize package downloads
- Minor statistics reporting improvements
- Sort bundles when printing statistics
- Add documentation
- Support repo/baseurl overrides for from and to versions

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
v5.7.2
2019-07-08 07:48:25 -07: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 ed494e8674 MCA: Add documentation
Add documentation for the build validate command.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-07-02 00:00:50 +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 7346994ced bundles: Correctly return package download errors
Signed-off-by: John Akre <john.w.akre@intel.com>
2019-07-02 00:00:50 +02:00
Rodrigo Chiossi c02e87e6aa vendor: Update dependencies
Update to the latest available version of our dependencies.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-07-01 21:56:51 +02:00
Rodrigo Chiossi 5228ca5649 Release v5.7.1
This release contains a bug fix to wrong mixer.state initialization when
server_state_dir is outside the mix directory tree.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
v5.7.1
2019-05-15 13:18:29 -07:00
Rodrigo Chiossi 0a8edd41d4 docs: Add --skip-format-check information
Add information about --skip-format-check

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-05-15 20:55:35 +02:00
Rodrigo Chiossi 1c4b4a3819 config: Use server state dir when loading MixState
MixState needs to know the server state dir in order to find the value
for previous version since its path will not always be relative to the
execution folder.
With this patch, MixState is always loaded after MixConfig. Since the
conversion of older formats of MixConfig account for format transfer,
changing the order does not prevent the format value to be properly
moved to the state file.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-05-15 19:43:25 +02:00
Rodrigo Chiossi 79f096cccb Release v5.7.0
New features:

- A new flag `--skip-format-check` was added to allow downstream users
to cross an upstream format bump manually. The manual process was unable
to proceed in this scenario since the format check would prevent the +20
build from completing

- Custom `os-release` files can now be provided as a replacement for the
default one. The path for the custom file can be configured in the new
`OS_RELEASE_PATH` option in `builder.conf`

- A new `latest_version` file is now published under `www/version/`
directory. This file allows the latest published version to be retrieved
without requiring the latest format to be known.

- A new subcommand `build validate` was introduced. This command
validates the difference between manifest contents of two versions by
comparing it with the difference in content of the rpms from those
versions.

Bug Fixes:

- Compression goroutines now use the user provided bundle-workers as the
default number number of goroutines. This change prevents mixer from
hitting the file descriptor limit - "Too many open files" error. This
change may have some performance impact on larger builds with the
default parameters, but the problem can be circumvented by manually
tuning the number of bundle-workers.

- Directories are now excluded from content size calculation. This
change allows builds to be reproducible since the directory size may
change even if the content is the same.

- Fix `--clean` flag for build subcommand. The clean flag did not roll
back the previous version of the mix, which caused deleted entries to be
missing when manifests were generated.

- Fix race conditions found by go's built in race detector.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
v5.7.0
2019-05-14 08:00:46 -07:00
Rodrigo Chiossi b04762f782 cmd: skip format bump check
When doing manual format bumps, the upstream version for +20 needs to be
updated to the upstream version in the new format, but since the format
differs, the build will fail.
This PR adds a new flag to `mixer versions update` and to `mixer build`
subcommands that allows this check to be skipped.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-05-14 16:56:38 +02:00
John Akre cda8f817e9 swupd: Remove directories from contentsize calculation
Directories can be installed with inconsistent sizes. To make mixes
reproducible, the size of directories is omitted from the contentsize
calculation.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-05-10 05:53:20 +02:00
Caio Marcelo de Oliveira Filho fa8d6f16bb builder: publish a latest_version file
If publishing an update, also update the www/version/latest_version.
This is useful for various consumers of swupd data: swupd-client can
easily discover the latest version (and not only the latest version in
a given format); swupd-inspector and swupd-extract will be able to
automatically figure the latest version of a mix given the update URL.

If --no-publish is used, the file will not be updated like the other
related files.  Clear Linux itself uses that so it can decide later on
whether to publish or not an update to the end users.

Related to #467.  With latest_version is possible to peek at
www/<latest_version>/format and figure its format.
2019-05-09 20:56:07 +02:00
John Akre da2da4cfd4 update.go: Use bundle-workers for compression goroutines
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>
2019-05-09 19:40:55 +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 bf8920c7f7 builder.go: Add mutex to deltaErrors variable
The deltaErrors variable is shared between goroutines, so access must be
synchronized.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-26 15:07:06 +02:00
John Akre 6372966b3f hash.go: Add mutex to global Hashes variable
Reads to the Hashes variable must be inside of a reader mutex to prevent
race conditions with writes to the variable.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-26 15:07:06 +02:00
John Akre e2ef547395 Create single bsdiff logger
The bsdiff logger was shared globally between several goroutines and in
some cases, a goroutine would override the existing logger with a newly
created one.

This change centralizes the logger creation so that it is only created
once which prevents logger creation race conditions.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-26 15:07:06 +02:00
John Akre 2f8202d30d update.go: Prevent race condition for err variable
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>
2019-04-26 15:07:06 +02:00
Rodrigo Chiossi a448fb8ddc cmd: Improve error message for invalid upstream
The `--clear-version` flag in mixer init accepts a string as parameter
to allow the user to set it to `latest`, which will auto fetch the
upstream version. For all other cases, this flag must be provided an
integer number. This patch clarifies the valid values for this flag both
in the error message and in the help description.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-04-25 19:17:48 +02:00
John Akre bbcdedb420 mixin: Change directory before loading state file
The state file uses relative file paths, but Mixin does not create a
mix inside the current working directory. Changing the current working
directory to the mix directory solves relative file path issues for the
state file.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-25 18:23:40 +02:00
John Akre a2304e5b3a Add test for clean build
Adds bat test to verify that builds with the clean flag succeed.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-25 18:23:40 +02:00
John Akre ff334851e7 Use PREVIOUS_MIX_VERSION for previous manifest header field
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>
2019-04-25 18:23:40 +02:00
John Akre 608a9dbc76 Add PREVIOUS_MIX_VERSION field to mixer.state
The mixer.state file now tracks the previous mix version with the
PREVIOUS_MIX_VERSION field. When this value is not set, it will default
to the LAST_VER or 0 when LAST_VER is invalid.

Format bumps create an important exception for the value of
PREVIOUS_MIX_VERSION. During a format bump, PREVIOUS_MIX_VERSION will be
overridden by the LAST_VER which will prevent PREVIOUS_MIX_VERSION from
altering format bump behavior.

Additionally, the mixer.state version was incremented and tests for
state file version conversions were added.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-25 18:23:40 +02:00
John Akre da75c7e18c config: Add state file version conversion
Adds support to convert old versions of mixer.state to the latest.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-25 18:23:40 +02:00
yaroslavros 71f7a26609 Do not duplicate manifests
If custom bundle name matches upstream bundle name, use only custom bundle manifest in MoM.

Otherwise swupd picks up first manifest from MoM (upstream) and fails to validate manifest of custom bundle.
2019-04-25 18:20:48 +02:00
John Akre 3924a30793 MCA: Add tests
Adds bat tests to validate MCA error and package statistics reporting.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-19 01:09:16 +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
John Akre 62fb64bc8b bundles: Improve generic usage of parseNoopInstall
Now parseNoopInstall returns parsed package metadata from DNF output.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-19 01:09:16 +02:00
John Akre bf035a3a03 bundles: Improve generic usage of downloadRpms
To make downloadRpms more generic, it no longer cleans the DNF cache
after failures and returns the DNF output.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-04-19 01:09:16 +02:00
sweeaun 0f7f998b42 config: Allow OS identification customization after review
1. Remove original config backup in bats test
2. Improve custom os-release file content reading operation

Signed-off-by: sweeaun <swee.aun.khor@intel.com>
2019-04-11 16:27:37 +02:00
sweeaun 5c777c5701 config: Allow customize os-release file used in Mixer
New param added in builder.conf Mixer section to support
    customize os-release file.

    Example to specify modified os-release file path in Mixer section:
    [Mixer]
    OS_RELEASE_PATH = "/tmp/modified-os-release"

    Note: Either use empty string or do not specify the OS_RELEASE_PATH indicated
    Mixer to use default os-release file.

Signed-off-by: sweeaun <swee.aun.khor@intel.com>
2019-04-11 16:27:37 +02:00
Caio Marcelo de Oliveira Filho 3ac4408471 swupd-inspector: ignore "iterative manifests" when visiting all files
Fixes log and get.  In these we want to loop at the actual Manifests,
to peek at the entire file list of each.
2019-03-04 17:22:08 +01:00
Caio Marcelo de Oliveira Filho fb2e3f5dd2 builder: don't use logger date/time
Logger default date/time are prefixes and don't play well when
printing multiple lines.  What usually matters is the amount of time
elapsed since the start, so print that instead (when each new entry
that is not the first is starting).
2019-03-04 15:49:03 +00:00
Caio Marcelo de Oliveira Filho 3b79fe2fc7 builder: fix spurious print in stopWatch
Likely a typo when converting to the logger interface. Stops printing
a memory address of the writer given to the stopWatch and just print a
newline.
2019-03-04 16:45:34 +01:00
Rodrigo Chiossi 7b8ba4c573 bat: Fix bundle count
The bundle validation count only needs to account for the bundles that
have been directly added to the mix. With the fragmentation of the
default bundles into smaller bundles that are used as includes, the test
must ignore the included bundles and just count the ones that were
directly added.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2019-02-26 19:40:31 +01:00
Rodrigo Chiossi 0ba1d0b0d0 Release 5.6.0
This release reintroduce manifest delta support from the old
swupd-server.

Changes:
 - Enable create Manifest deltas in mixer

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
v5.6.0
2019-02-26 05:43:37 -08:00
William Douglas 623c60999b Enable create Manifest deltas in mixer
swupd-server used to support building bsdiff based deltas of manifest
files. This change adds that ability back for bundle manifests with
the 'mixer build delta-manifests' command.
2019-02-12 13:17:59 -02:00
Rodrigo Chiossi 2bbb8b09f4 Release 5.5.3
This release contains bug fixes for `--offline` option and for the
download timeout error when building large mixes.

BugFixes:
- Fail init offline with no clear version.
- Enforce offline mode in `mixer versions`.
- Skip format bump check in offline mode.

Changes:
- Deprecate new-swupd and new-config flags.
- Use cdn to download content on mixer.
- Increase Clear repo default timeout.
- Retry RPM downloads on failure.
- Add clean flag to mixer build all command.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
v5.5.3
2019-02-11 07:07:41 -08:00