603 Commits
Author SHA1 Message Date
Rodrigo Chiossi 51c3bdb79d Release v5.2.0
- Update os-release file with mix info
- Add automatic conversion to mix config
- Remove redundant parsing of config

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
v5.2.0
2018-09-07 15:35:17 -07:00
Reagan Lopez 302f03a70e bundles:Update os-release file with mix info (#113)
For a clear linux mix, the os-release file will be updated as follows:
- NAME="Clear Linux Mix"
  Eventually this value should be read from user input when #424 is implemented.
- ID=<based on above NAME field>
  E.g. ID=clear-linux-mix
- VERSION="<mix-ver> (<upstream-ver>)"
  E.g. VERSION="10 (24750)"
- PRETTY_NAME="<NAME> <mix-ver> (<upstream-ver)"
  E.g. PRETTY_NAME="Clear Linux Mix 10 (24750)"
- VERSION_ID=<mix-ver>
  E.g. VERSION_ID=10
- BUILD_ID=<upstream-ver>
  E.g. BUILD_ID=24750
- MIX_UPSTREAM_URL="<upstream-url>"
  This is a new field in os-release.
  E.g. MIX_UPSTREAM_URL="https://download.clearlinux.org"
2018-09-08 00:31:31 +02:00
Rodrigo Chiossi d62f007c25 battest: Add tests for config conversions
These automated tests will check if conversion between multiple older
versions to the current version is working properly.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-09-08 00:11:44 +02:00
Rodrigo Chiossi 09973d7752 config: Remove old config
With the automatic conversion on load time, mixer ill always use the new
config format. Even if the mix is initialized with the legacy config, it
will be converted right away. As such, there is no need to allow the
creation of legacy configs anymore nor to check if it is being used.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-09-08 00:11:44 +02:00
Rodrigo Chiossi 7f1e3f33a3 config: Add automatic conversion
This patch introduces automatic conversion of config files to the latest
format. This will seamlessly transition all users to the latest format
without the need for manually converting the config with the `mixer
config convert` command.

This patch also introduces the config_conver.go file, which centralizes
all conversion operations and also the parsing for the legacy config in
order to keep config.go clean and focused on current config features.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-09-08 00:11:44 +02:00
Rodrigo Chiossi 41f60493bc bundles: Remove redundant parsing of config file.
All the values inside buildBundlesConfig are already parsed and
available in the code through builder.Config, so there is no need to
parse them again from the config file.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-09-08 00:10:23 +02:00
Tudor Marcu eaf869155c Release v5.1.4
This release fixes many bugs in the tooling:
- Fix double parsing of the config file
- Do not add default bundles when 'init' called with offline
- Reduce download timeout to 10 seconds instead of 30 on file download
- Improve download upstream error message
- Enforce UTF-8 locale when running DNF commands in mixer
- Ignore possible %ghost files in RPMs
- Fix global --offline usage to completely block all outbound network
  checks on all commands, even when running in container mode
- Fix error in concurrent manifest creation code to properly exit on
  first error hit
- Use --bundle-workers for manifest generation like other commands
- Fix to use passed in minversion for +10 format bump build

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v5.1.4
2018-08-31 17:24:10 -07:00
Tudor Marcu ef862760f1 Don't minver the +10 by default
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-08-31 14:36:40 -07:00
Rodrigo Chiossi bdb3a51794 bundles: Use --bundle-workers for manifest gen
When generating the manifest for bundles, use the user defined
--bundle-workers to determine the number of goroutines to use instead of
spawning one goroutine per bundle.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-08-31 14:36:06 -07:00
Rodrigo Chiossi 6ca4342f6b manifests: Exit on error
When there is an error in one of the worker goroutines, the error is
read but before it is returned, the variable is reused inside the
following for loop to check the error of addFilesFromChroot(). Since we
always have a "full" bundle, it is always overwritten.

Another issue is that the err variable was shared among the goroutines
and was set directly instead of through the error channel. This would
allow one routine to overwrite the error from another.

Lastly, there is a problem with the loop that feeds bundleChan with
data. The second select statement calls 'break' when an error is found,
but 'break' will exit the 'select' block, not the 'for' loop. In order to
stop the loop, we move the break to an if statement that checks for a
condition set on error. This change ensures that the worker goroutines
stop once an error is found.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-08-31 14:36:06 -07:00
Tudor Marcu e61ff4e4bc Fix global --offline usage
When --offline is passed, any command executed should not reach over the
network. This introduces a tricky scenario when it is passed to a build
command with --native=false (default), because the command in the
container will be run with --offline, but the native mixer binary will
reach over the network to pull/update docker containers before executing
in them. This patch also makes that process offline only, attempting to
use a cached docker image so that it can run offline fully, but exits if
none exist.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-08-31 14:35:37 -07:00
Auke Kok d29cc44340 Ignore possible %ghost files in RPM files.
Due to the way that we use repoquery, we are returned files that
may be %ghost files in RPMs. These files may be missing and this
is legal and compliant.

While Clear Linux OS does not use %ghost files in any of the RPMs
created, there is nothing wrong with permitting other vendor RPM
files that may list %ghost files, and mixer should just ignore
these files.

This change does just that: If repoquery returns files that are
not existing in the fullimage, prints a warning and continues with
out dropping the manifest for that bundle.
2018-08-30 13:02:53 -07:00
Auke Kok 5d42cfdb14 gofmt -s this file. 2018-08-30 11:06:38 -07:00
Auke Kok cf271dd7b0 Missing argument to print. 2018-08-30 11:06:38 -07:00
Rodrigo Chiossi 0c9f0e3dd8 bundles: Enforce UTF-8 when running dnf
In some situations dnf may try to combine files from different
encodings. If the command is not running is a UTF-8 locale, this
combination will be missing a new line, causing and error.

An example of this occurrence is the command `dnf repoquery --quiet -l
systemd ca-certs-static ...` which combines a file list from systemd and
ca-certs-static

This patch enforces UTF-8 locale on every dnf execution.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-08-30 00:32:25 -07:00
Rodrigo Chiossi 07b3a3c182 builder: Improve download upstream error message
The error when mixer failed to download the upstream version was too
confusing since there were many layers of wrapped errors.
This patch removes the excessive wrapping and suggests a missing proxy
configuration to the user in case this error occurs.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-08-30 00:32:11 -07:00
Rodrigo Chiossi 9cf854d8d6 helpers: Reduce download timeout
Instead of the default 30 seconds timeout, use 10 seconds when trying to
download files.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-08-30 00:32:11 -07:00
Rodrigo Chiossi e78ab36e09 builder: No default bundles for offline init
When running 'mixer init' with the --offline flag, there is no upstream
to fetch the default bundles from, so the mix should be initialized
without the default bundles.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-08-30 00:31:45 -07:00
Rodrigo Chiossi 2034c8dc82 cmd: Fix double config parsing
When running any 'mixer config' sub-command, the config will be parsed
in the command itself, so there is no need to pre-parse them in the pre
execution. Those commands also don't rely on network nor cause any
format conflict, so it is safe to skip all the remaining checks like it
is done for the 'init' command.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-08-30 00:31:31 -07:00
Tudor Marcu 5d9055ebab Release v5.1.3
This release fixes a race condition when ranging over a syncmap to
add packages to a bundle.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v5.1.3
2018-08-23 23:55:20 -07:00
Matthew Johnson 3b812f7764 bundles: remove unneeded map assignment dance
We were assigning a map to a map to assign it to a string slice. Instead
just assign the map keys to the string slice directly.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-08-23 16:05:06 -07:00
Matthew Johnson 91434ca5fd bundles: Fix race condition on map.Range
When ranging over the syncmap to add packages to a bundle we were
mistakenly ranging over the entire set of bundles and adding all bundle
packages to the same bundle (nondeterministically, since we were doing
concurrent writes to a syncmap). In reality we just need to range over
the repoPkgMap itself and not load it from the syncmap at all. Do this
operation before even storing it.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-08-23 16:05:06 -07:00
Tudor Marcu 04c713623a Release v5.1.2
This release fixes mixer to force the runc runtime on docker runs, which
supports host networking.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v5.1.2
2018-08-21 02:06:38 -07:00
Tudor Marcu 26fe8cec93 Force runc runtime in docker
The default runtime in upstream Clear will be set to the kata runtime,
which does not support host networking. This is needed for mixer, so we
must force --runtime=runc during all docker runs.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-08-21 02:01:54 -07:00
Tudor Marcu 5225ad0da8 Release v5.1.1
This release fixes a data race which cause concurrent map read/writes
when resolving packages and bundles. Versioning is also moved into the
Makefile so it does not have to be updated in the source code anymore,
and added at compile time.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v5.1.1
2018-08-16 23:33:13 -07:00
Matthew Johnson 3f03e34bb4 bundles: fix data race in building bundles
Two issues, first is resolved by renaming the error variable so a
goroutine isn't sharing err from outer scope with all other goroutines.

The second issue is resolved by using a sync.Map to safely read and
write to a map via the Range function.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-08-16 12:29:46 -07:00
Alex Jaramillo 03dc57ba32 Using ldflags for mixer version string
This change moves the setting of mixer version string from source code
to a variable defined during compilation. This approach is preferable
because:

1- builder.go does not need to change just to change version though
   functionally is the same.
2- simplifies logic in Makefile, no need to retrieve value from source.
2018-08-15 14:50:07 -07:00
Tudor Marcu 9d39305586 Release v5.1.0
This release adds more customizability of the DNF conf through the mixer
command line, adds a --clean option and does not wipe the outputdir by default
when re-running a 'build' command for the same build number, switches to zstd
compression for delta packs, and adds misc fixes to internal code structure.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v5.1.0
2018-08-12 13:28:17 -07:00
Matthew Johnson bed2e36a3c repo: add use-case to exclude long text
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-08-09 17:31:09 -07:00
Tudor Marcu d2e466446c Add excludepkgs option to repo command
This features may help users guarantee correctness of bundles built by mixer in
lieu of some shortcomings with dnf where dnf produces an unexpected dependency
solution. This mainly happens when a user is intending to fully substitute
a package from upstream's repo with one from their own. If anything is wrong
with the substitution, a feature like this would expose the issue early on.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-08-09 16:50:26 -07:00
Tudor Marcu 9024eb61fd Don't wipe output dirs on build bundles
By default, build bundles removes image/ver and www/ver, so that builds
of the same number start with a clean slate. There are specific use cases
where this is not desirable, and the statedir already has a version folder
populated/mounted which shouldn't be wiped. This allows mixer to write
the full chroot into an actual mounted file system for example that is
attached to update/image/VER/full.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-08-09 16:09:54 -07:00
Tudor Marcu 9e421237c4 Add zstd to reader
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-08-09 15:43:26 -07:00
Tudor Marcu b114ee237b Update validate-swupd.sh script to use --native
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-08-09 15:43:26 -07:00
Tudor Marcu 57984ec946 Switch to zstd compression in pack creation
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-08-09 15:43:26 -07:00
Matthew Johnson 7b1b61b2e9 swupd: also export GetBundleInfo
Export the GetBundleInfo file so other packages can use it. Simplify
function signature so it doesn't need a swupd config file.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-08-09 15:26:36 -07:00
Matthew Johnson 17261fdeab swupd: export BundleInfo struct
This is useful for other projects trying to use the *-info file.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-08-09 15:26:36 -07:00
Tudor Marcu 6be6db5f2c Fix divide by zero when no previous manifests
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-08-09 15:25:56 -07:00
Matthew Johnson d67f98fba1 swupd: export IndexBundle for external use
Other packages want to use the IndexBundle const to skip processing this
manifest for some validation cases.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-08-08 18:15:06 -07:00
Tudor Marcu f54811ae46 Use cobra for exact args limits
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-08-07 11:59:47 -07:00
Patrick McCarty 72ac332ae5 Remove hardlink dependency check
Mixer does not use the hardlink binary anymore, so these dependency
checks can be removed.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-08-03 17:03:52 -07:00
Tudor Marcu 4b2e640ddc Release v5.0.2
This release fixes several bugs dealing with running in a docker
container, and provides better warnings/error messages when the
environment and conf are not setup correctly.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-07-31 10:57:39 -07:00
Tudor Marcu 03626db926 Update man pages with --native
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-07-31 10:57:39 -07:00
Rodrigo Chiossi 99eed0a84c docker: Pull image before running
If the docker image for a given format is updated, users with cached
version of the image may keep running in the older version.
This patch makes sure mixer tries to pull an updated version before
running. If the pull fails, mixer will print a warning instead of
failing to allow users with cached images to keep building offline.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-07-31 10:26:24 -07:00
Rodrigo Chiossi f403a7f200 docker: Fail on missing image name
If DOCKER_IMAGE_PATH is not set, the docker command will be malformed
and the user will receive a cryptic message.
This patch makes sure mixer fails early and provides the user an
informative error.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-07-31 10:26:24 -07:00
Rodrigo Chiossi 08e447cb08 config: Add missing default value for docker
The default value for DOCKER_IMAGE_PATH was only set for the old INI
config. As a result, TOML configs would have an empty path that would
generate an invalid docker command to be issued.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-07-31 10:01:15 -07:00
Rodrigo Chiossi 0784623cdb cmd: Add --format flag to mixer init
The --format flag allows a custom format to be provided to a mix on
initialization

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-07-27 16:45:47 -07:00
Tudor Marcu 68274c4257 Release v5.0.1
This release fixes issues with setting up the new mixer.state file. The
file now correctly transfers over the FORMAT version from the builder.conf,
falling back to the system /usr/share/defaults/swupd/format, and only then
defaulting to "1".
Deletes now persist in manifests over minversions. The only time they should
be removed is when performing a format bump.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v5.0.1
2018-07-26 10:51:45 -07:00
Tudor Marcu a3b75315e0 Remove LD_PRELOAD
The new dnf release in Clear now does this by default, so we do not have to
load the nosync library anymore.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-07-26 10:45:41 -07:00
Rodrigo Chiossi d25ce44708 config: Add default values on conversion
When config is created during mixer init, default values are set for
all variables. To mimic this behavior, LoadDefaults must be called on
conversion as well.
There is also no need to perform a conversion if the parsed version
number is the same as the current version number.

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-07-26 10:28:22 -07:00
Rodrigo Chiossi a5099994ed config: Set config version on conversion
The old INI config does not have versioning, so when performing a
conversion, it needs to be set.
Also, since now the config format is identified on parsing, there is no
need to force Old Config when starting the conversion. This allows the
convert command to also convert between different TOML versions

Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
2018-07-26 10:28:22 -07:00