533 Commits
Author SHA1 Message Date
Tudor Marcu e4d4d3ba86 Release v4.6.7
This release updates mixer to build slim packs across minversions, reducing the
pack download size for clients and saving space on our infrastructure. Mixer
also properly avoids making a network connection except for commands that
absolutely need it.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v4.6.7
2018-07-06 16:10:20 -07:00
Tudor Marcu c0e7a72b76 Do not hit the network for some commands
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-07-06 16:03:51 -07:00
Matthew Johnson 77aeaad2f5 swupd: make slim packs across minversions
Add an additional fileContentInManifest check to pack creation to
exclude full files that are represented in the from manifest even if the
version changed in the to manifest. This allows mixer to exclude
unchanged files from delta packs over minversion bumps.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-07-02 17:13:52 -07:00
Tudor Marcu 6614ab1ab2 Release v4.6.6
This release includes fixes to place the <bundle>-extra-files into a persistent
location, which will automatically inject listed files into a mix, reducing
manual intervention by mixer users when building a mix with unconventional
or files that are not part of any bundle by default.  Bsdiff error output
is more standard and consistent, displaying the proper delta information to
make debugging failing cases easier.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v4.6.6
2018-06-29 16:30:46 -07:00
Tudor Marcu e8e81162b4 Fix linter errors
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-06-29 16:28:41 -07:00
Tudor Marcu c5a0129c35 Provide more standard output on bsdiff errors
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-06-27 17:38:04 -07:00
Tudor Marcu 76d67785e9 Remove source RPMs before creating the repo
Mixer will not work with source RPMs added and crash looking for files
that will not actually be provided. This patch removes them as it parses
the RPM list so only valid, usable RPMs get added to the repo.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-06-25 12:32:47 -07:00
Rodrigo Chiossi e314675b30 battest: Add test for format bump
This patch adds temporary tests for the format bump feature. A permanent
test will require the generation of custom docker images with an updated
build of mixer. Until this tooling is available, this test provides a
minimum integrity check on the feature.

The added test checks the operation of a format bump on a real format
boundary. In addition, it checks the integrity of 4 key values:
- image/LasT_VER should point to the +20 version
- Previous version in +20 MoM should point to +0
- Previous version in +10 MoM should point to +0
- FORMAT property in builder.conf should have the +20 format

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-06-25 12:32:34 -07:00
Matthew Johnson 520eb20028 swupd: read *-extra-files from persistent location
Instead of reading the bundle-extra-files configuration file from the
bundle directory under /image/<ver> (which does not exist until mixer
build bundles is run) read from the persistent mixer workspace. This
means users no longer have to copy these files into place after building
bundles.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-06-25 11:50:56 -07:00
Rodrigo Chiossi 8e9a01ec27 build: add skip-fullfiles and skip-packs option
This patch adds the --skip-fullfiles options for the 'build' subcommand
of mixer. This command will prevent fullfiles from being generated
during 'build update'. Likewise, the --skip-packs option prevents zero
packs form being generated.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-06-21 10:48:38 -07:00
Rodrigo Chiossi b510f40116 cmd: Deprecate prefix and keepchroots flags
The current code ignores those two flags.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-06-21 10:48:38 -07:00
Rodrigo Chiossi 2cbe74c869 builder: Refactor BuildUpdate API
BuildUpdate API has become too convoluted, to the point where some of
its parameters are not even used anymore. This patch reorganize the
function API and simplifies parameter passing to underlying functions.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-06-21 10:48:38 -07:00
Matthew Johnson 8558a3fb98 swupd: remove old file heuristics
Remove unused heuristics intended to set flags on manifest file records.

Fixes #345

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-06-20 10:16:21 -07:00
Matthew Johnson 23b1719e44 mixin: increment mixer version when necessary
Fixes #347

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-06-19 17:31:06 -07:00
Rodrigo Chiossi 40a2e3f23a format: Restore format to builder.conf after bump
Since we build +10 after we build +20 when doing a format bump, the last
built format will be the old format, so the new format must be manually
restored to builder.conf after +10 is built.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-06-19 17:30:14 -07:00
Rodrigo Chiossi b58670a88a format: Fix previous version in +10 build
Since we build +20 before +10, if LAST_VER file is not returned to the
original state, the manifest for +10 will erroneously point to +20 as
its previous version.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-06-19 17:30:14 -07:00
Rodrigo Chiossi 38bfdd2297 format: Restore upstream version before bump check
Since we build +20 before +10, when finishing the +10 build the upstream
points to the old upstream version. This means that fetching the format
will get +10 format instead of the +20 format which will make
checkBumpNeeded() erroneously return true.
This patch fix a crash where format bump would loop forever until it hit
a format beyond the last existing one and crash.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-06-19 17:30:14 -07:00
Rodrigo Chiossi fc39e15d2c format: revert rebase errors
Apparently there was an error during rebase of the format bump patch
that brought back BuildConf variable which is not supposed to exist
anymore. This reverts it back to the proper state.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-06-19 17:30:14 -07:00
Rodrigo Chiossi 13753373c1 docker: ignore unexported config fields
When using reflection to iterate the config fields, trying to iterate on
unexported fields will cause mixer to crash. Also, when checking for
docker mounts, there is no need to check any of the unexported fields.

This patch fix this crash by skipping the search on unexported fields.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-06-19 17:30:14 -07:00
Rodrigo Chiossi ee438cd25b format: Treat missing LAST_VER as error
The only use case where a missing LAST_VER is a valid use case is when
checking if a bump is needed since the user might be running the build
for the first time. In all other cases, the caller expects a valid
version to be returned is error is nil. This caused mixer to print some
cryptic errors if those other callers were used on a new workspace.

This patch changes the default behavior to always return an error if
LAST_VER is missing and let the caller decide using os.IsNotExist() api
if the error should be propagated or not.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-06-19 17:30:14 -07:00
Rodrigo Chiossi 1f9717b4fc format: Use SaveConfig instead of SetProperty
The SetProperty API is used to search for the property withing config,
set it and save the config. In this code, the property is set directly
just a few lines above, so saving is already enough to propagate it to
the config file.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-06-19 17:30:14 -07:00
Rodrigo Chiossi a3951896ac format: Remove deprecated comment
This comment is in the wrong function and is deprecated since now +20 is
build before +10.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-06-19 17:30:14 -07:00
Tudor Marcu 14a25d3380 Release v4.6.5
This release sets a timeout for delta creation time to 1 minute, in an effort
to skip deltas which typically end up being too large to use for packs anyway.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v4.6.5
2018-06-13 00:00:13 +00:00
Tudor Marcu 03711f29a1 Return error from timeout
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-06-12 23:59:47 +00:00
Tudor Marcu 1759dd9b7b Release v4.6.4
This release sets a timeout for delta creation time to 1 minute, in an effort
to skip deltas which typically end up being too large to use for packs anyway.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v4.6.4
2018-06-12 23:55:07 +00:00
Tudor Marcu 0020262f2b Set timeout on bsdiff delta creation
Set timeout to 1 minute for bsdiff. The majority of all delta creations
take significantly less than 1 minute to run, which signifies that bsdiff
is working on a delta that may be very large, or very difficult to diff. In
all the cases where bsdiff took multiple minutes to finish, the delta ended
up not being used because it was larger than the compressed fullfile. This
attempts to skip those cases and improve delta creation time.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-06-12 16:51:51 -07:00
Tudor Marcu 38bbbce8b3 Release v4.6.3
This release fixes mixer to not exit when upstreamurl is not found, and
to attempt to use the given format in the builder.conf. For some cases,
the mixer user may in fact be "upstream" so it does not make sense to check
upstream format compatibility.
A new tool is available called swupd-inspector, which contains various
commands that help read data of a swupd repository: download the fullfile for
a specific file, see the Manifest for a specific version, see the differences
between two versions.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v4.6.3
2018-06-11 22:37:11 +00:00
Caio Marcelo de Oliveira Filho 07b4003a08 Makefile: install swupd-extract and swupd-inspector 2018-06-11 15:32:22 -07:00
Caio Marcelo de Oliveira Filho edf50352ca swupd-inspector: use Cobra library for CLI
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2018-06-11 15:32:22 -07:00
Caio Marcelo de Oliveira Filho d11431e46d swupd-inspector: initial import
swupd-inspector contains various commands that help read data of a
swupd repository: download the fullfile for a specific file, see the
Manifest for a specific version, see the differences between two
versions.

The 'diff' subcommand was one of the tools used to evaluate whether
the new swupd implementation was generating correct results compared
with the existing clear implementation.

Like swupd-extract, it does have a shortcut to handle the main Clear
Linux repository

    // Shows the content of Manifest.vim at a specific OS version
    $ swupd-inspector cat clear/22460 Manifest.vim

    // Download a fullfile for a given file
    $ swupd-inspector get clear/22460 /usr/bin/vim

    // Show the differences between two versions
    $ swupd-inspector diff clear/22450 clear/22460

    // List the different versions of a file since a given OS version
    $ swupd-inspector log clear/22450 /usr/bin/vim

In those examples, "clear/..." could be replace for a URL of a
repository (plus version) of a mix. The downloaded metadata is cached
based on the URL, allowing further queries to be cached, even when
querying mixes.

Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2018-06-11 15:32:22 -07:00
Tudor Marcu cf2fdb6560 Fix bug for user who don't have upstreamurl file
This is the case for when an OSV *is upstream* and does not have a set
upstreamurl. There is nothing to download and figure out the format range
for since they set the bounds manually, so don't crash on this error unless
it is running in a container non-natively.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-06-11 12:36:50 -07:00
Tudor Marcu 1e57943733 Release v4.6.2
This release further parallelizes the delta creation code to do some
more complex breakup of tasks. Typically users create multiple versions
back of deltas. While each version ran massively parallel delta jobs,
each version itself ran one after another synchronously. This began to
cause problems when certain files took several minutes to complete,
because the next version could not start until the previous finished,
compounding the runtime by the number of versions back * long file.
Now, the code check if it can run a thread for each version, and then
splits up threads within those version pools so when the large file is
hit, all versions run at the same time, capping it to 1 long file run.

Signed-off-by: Tudor  Marcu <tudor.marcu@intel.com>
v4.6.2
2018-06-08 22:58:41 +00:00
Tudor Marcu 93aebf0ef7 Parallelize version back for deltas
Run each version back for delta packs in its own thread, and divide the total
number of CPUs available and use that in each version thread.  There are
cases where only a few files remain to delta, and they take multiple
minutes to finish. Each version runs synchronously with many threads, so
at the end of a version we have to wait for the long delta to finish before
running through another. version This changes it so by the end of the run -
all the large/slow files are building at the same time, capping it to just
one long file run, vs long run * number of versions back.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-06-08 15:32:41 -07:00
Tudor Marcu 0563df5326 Loop through bumps and hide commands for now
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-06-07 17:13:47 -07:00
Kevin C. Wells cebb0b1a81 Misc bug fixes
Fix a number of AFB bugs:

- Previous build's upstream format was being incorrectly looked up,
resulting in upstream format boundary crossing detection failing.

- PreRun check was incorrectly skipping format build commands, resulting
in "stage for mix" being run twice.

- Only the UInt32 upstream version was being modified, resulting in the
second half of 'mixer build upstream-format' being run in the wrong
container.

- The wrong format was being printed out for 'mixer versions' if
crossing an upstream format boundary.

Refactor Cobra command PreRun

Simplified the PreRun logic that happens before every command. This also
fixes an issue where format bump build commands could be run with
--native=false, when they need to be run natively.

Fix AFB mixversion and LAST_VER setting

1) Changes how the format bump builds set mixversion so that it no
longer skips a version number in some situations.

2) Updates the update/image/LAST_VER file after the +10 build back
to the +20 build value, so mixer is ready to do the next mix.

Refactor file download code

This patch refactors and consolidates the different file download code
scattered throughout helper.go and builder.go.

Signed-off-by: Kevin C. Wells <kevin.c.wells@intel.com>
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-06-07 17:13:47 -07:00
Kevin C. Wells cce1e82b41 Create SERVER_STATE_DIR with uid/gid of parent
This patch changes the way SERVER_STATE_DIR is created if it does not
already exist, in order to facilitate mounting the directory inside the
Docker container.

By default, SERVER_STATE_DIR in 'builder.conf' is set to PWD +
"/update", a path that typically does not already exist and is created
automaticallly the first time mixer builds bundles. Historically, 'mixer
build bundles' was run as root; now it is run as root within a Docker
container. In either case, this "update" directory ends up owned by
root.

For security reasons, mixer will not mount to the container any directory
to which the caller does not have read/write permissions. This means that
on subsequent calls, mixer refuses to mount the "update" directory it just
created, as it is owned by root.

This patch resolves this for most users by creating the SERVER_STATE_DIR
with the uid/gid of its closest existant ancester. In the default case,
this is the uid/gid of the PWD. Users with existing mixes will need to
manually chown the SERVER_STATE_DIR to a uid/gid they have read/write
permission to.

Signed-off-by: Kevin C. Wells <kevin.c.wells@intel.com>
2018-06-07 17:13:47 -07:00
Tudor Marcu 201110598b Fix order of format bump builds and bug fixes
This patch includes the following changes:

Reorder which version builds first to simplify

The +20 build can be built fully at the beginning all the way though,
removing the need to swap tooling to build the +10 (just so things are
built in chronological order). The +10 build is created with the -
possibly - old tooling only after, and reduces the amount of
back-and-forth swapping of tooling.

Fix misc errors with formats and version blocks

The right format number needs to be passed into both functions, and we
*must* ignore the fact that the version and format are lower than the
previous build in the format bump case. It reduces complexity and tool
changes by building the +20 version all the way through first.

Two top level commands now exist for running format bumps:
- build upstream-format This command builds the necessary builds to
			cross a mix over a format bump.
- build format-bump This command builds a bump for downstream users.

Fix docker mount path lookup

This patch fixes a bug with the way mixer determined which fields in
'builder.conf' were mountable paths.

Previously, mixer treated every field in [Builder] and [Mixer] as paths
on the filesystem (or paths to files whose parent directories needed to
be mounted). Introducing the "DOCKER_IMAGE_PATH" field broke this
approach.

This patch introduces a new "mount" tag on the config struct fields that
indicates whether a config field represents a mountable path. This has
several benefits:
1) It allows us to know definitively which fields we should look at.
2) It allows us to look at the entire 'builder.conf', not just the
[Builder] and [Mixer] sections.
3) It removes the restriction that paths in 'builder.conf' be absolute.
This absolute check was mostly a sloppy way of checking if a field was
in fact a path.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
Signed-off-by: Kevin C. Wells <kevin.c.wells@intel.com>
2018-06-07 17:13:47 -07:00
Kevin C. Wells 6c51a98564 Check access perms before mount, add unit tests
This patch adds an access check on each directory in the config file
before mounting it to the container. This prevents the user from
accidentally (or surreptitiously) granting the container access to
directories they shouldn't.

The config parsing for directory extraction code is also refactored to
provide better results and more accurate error messages.

This patch also adds unit tests for directory access checks, directory extraction,
and mount path list reduction.

For these tests to not fail inside the Docker container on Travis, they
need to not be run as root. This patch thus also creates a non-root user
(but with wheelnopw membership), and runs as this user instead.

Signed-off-by: Kevin C. Wells <kevin.c.wells@intel.com>
2018-06-07 17:13:47 -07:00
Kevin C. Wells 5bb0f6c298 Move stageMixForBump(), add UnstageMixFromBump()
This step cannot occur for every format bump build as it previously did,
as it is only valid for format bump builds for crossing an upstream
format boundary. If you are simply bumping your own mix format,
independent of upstream, this should not occur.

Moved the call to CheckFormatBumpNeeded, as this is the only place that
definitively knows this step needs to occur.

Adds an "UnstageMixFromBump" command that resets the "upstreamversion"
file back to the contents found in "upstreamversion.bump", if it exists.

Signed-off-by: Kevin C. Wells <kevin.c.wells@intel.com>
2018-06-07 17:13:47 -07:00
Kevin C. Wells ac22c9c95a Default to --native = true
This commit temporarily sets the default value for --native to true,
making running inside a container an opt-in behavior. This will make the
testing and transition to containerized mixer easier. Eventually this
switch will be flipped back to false, making containerized the default
running mode.

To run in container, append '--native=false' to your command.

Signed-off-by: Kevin C. Wells <kevin.c.wells@intel.com>
2018-06-07 17:13:47 -07:00
Kevin C. Wells effd61323d Dockerize mixer.
This patch Dockerizes mixer build commands. A new '--native' flag is added
that, if passed, will run mixer on the host system the way it always has.
This defaults to false.

For build commands, if '--native' is false, mixer now pulls an image file
published by upstream that contains the core Clear Linux OS and mixer
toolchain for the version of Clear Linux defined in the upstreamversion file,
which mixer than uses to build a Docker image. Mixer then re-runs the original
mixer build command within a container of that Docker image.

This ensures that you are always using a version of the mixer toolchain
compatible with the upstream version off of which you are building. This is
required for building across format boundaries. Additionally, mixer now
checks if a build crosses format boundaries, and instructs you how to
first perform a format-bump build.

Mixer attempts to re-use already downloaded or built Docker images to
minimize the performance impact of running inside a container. This eliminates
the time spent on re-building the container image across subsequent
runs. Mixer uses the latest-released version for a given format, however,
so image content will become stale regularly.

Signed-off-by: Kevin C. Wells <kevin.c.wells@intel.com>
2018-06-07 17:13:47 -07:00
Tudor Marcu d4ded4e349 Add format bump support
This adds support for detecting if a format bump is needed, and the
supplementary functions to perform one. All of the build steps are done
for the user, and just need to be called in the correct order to
generate the two builds.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-06-07 17:13:47 -07:00
Tudor Marcu 4389c54cd5 Release v4.6.1
This release includes fixes for mixin, notably enabling new config for all
executions instead of per cmd basis, and enables users to name the bundle
they want the package added to instead of defaulting to the repo name.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v4.6.1
2018-06-07 00:59:35 +00:00
Caio Marcelo de Oliveira Filho 654a4eb259 mixin: fix lint warning 2018-06-06 17:53:36 -07:00
Matthew Johnson 9c362143da mixin: update manual pages for --bundle flag
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-06-06 15:31:59 -07:00
Matthew Johnson 458c880f82 mixin: add --bundle flag for optional bundle name
When adding a package provide an optional --bundle flag so users can set
which bundle their package is added to instead of automatically adding
it to a bundle named after the repo the package came from.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-06-06 15:31:59 -07:00
Rodrigo Chiossi c4b8801d01 mixin: Enable new config for all executions
This patch fixes a bug where new config option was not enabled when
reading the config file. Instead of enabling it for every place config
is used, new config is now always enabled when the program executed.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-06-06 15:26:33 -07:00
Tudor Marcu da41f3a244 Release v4.6.0
This release adds bundle information files under /usr/share/clear/allbundles
to allow clients to perform future bundle-info operations. Write with 'pretty'
indented JSON so it is grep-able and human-readable in the mean-time.  Users
will have to install the os-core-update-index bundle to get this functionality.

The delta pack creation code has been re-written and parallelized to
greatly improve performance. All deltas are now created in parallel
using the full manifests, and then the packs are created in parallel by
just using the pre-created deltas from the delta/ folder, instead of
doing all the processing per bundle.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v4.6.0
2018-06-01 19:48:21 +00:00
Tudor Marcu 728e722431 Fix WritePack do only call findDeltas
All the deltas have been created already, so do not create them twice...

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-06-01 19:15:27 +00:00
Tudor Marcu 6412c094c6 Update comments and thread error return
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-06-01 11:37:11 -07:00